<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162114] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162114">162114</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-15 22:42:39 -0800 (Wed, 15 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move user agent code to WebCore and unify some code between OS X and iOS
https://bugs.webkit.org/show_bug.cgi?id=127080

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-01-15
Reviewed by Sam Weinig.

Source/WebCore: 

Move the duplicated code from WebView and WebPageProxy to two files
in WebCore: UserAgentMac and UserAgentIOS.

* Configurations/WebCore.xcconfig:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/ios/UserAgentIOS.mm: Added.
(WebCore::platformSystemRootDirectory):
(WebCore::osMarketingVersion):
(WebCore::standardUserAgentWithApplicationName):
* page/mac/UserAgent.h: Added.
* page/mac/UserAgentMac.mm: Added.
(WebCore::systemMarketingVersionForUserAgentString):
(WebCore::standardUserAgentWithApplicationName):
* platform/ios/WebCoreSystemInterfaceIOS.h:
* platform/ios/WebCoreSystemInterfaceIOS.mm:

Source/WebKit/mac: 

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
* WebView/WebView.mm:
(userVisibleWebKitVersionString):
(+[WebView _standardUserAgentWithApplicationName:]):
(-[WebView _setUIWebViewUserAgentWithBuildVersion:]):

Source/WebKit2: 

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::userVisibleWebKitVersionString):
(WebKit::WebPageProxy::standardUserAgent):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::standardUserAgent):
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreConfigurationsWebCorexcconfig">trunk/Source/WebCore/Configurations/WebCore.xcconfig</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSh">trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm">trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm">trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepageiosUserAgentIOSmm">trunk/Source/WebCore/page/ios/UserAgentIOS.mm</a></li>
<li><a href="#trunkSourceWebCorepagemacUserAgenth">trunk/Source/WebCore/page/mac/UserAgent.h</a></li>
<li><a href="#trunkSourceWebCorepagemacUserAgentMacmm">trunk/Source/WebCore/page/mac/UserAgentMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/ChangeLog        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-01-15  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        Move user agent code to WebCore and unify some code between OS X and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=127080
+
+        Reviewed by Sam Weinig.
+
+        Move the duplicated code from WebView and WebPageProxy to two files
+        in WebCore: UserAgentMac and UserAgentIOS.
+
+        * Configurations/WebCore.xcconfig:
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/ios/UserAgentIOS.mm: Added.
+        (WebCore::platformSystemRootDirectory):
+        (WebCore::osMarketingVersion):
+        (WebCore::standardUserAgentWithApplicationName):
+        * page/mac/UserAgent.h: Added.
+        * page/mac/UserAgentMac.mm: Added.
+        (WebCore::systemMarketingVersionForUserAgentString):
+        (WebCore::standardUserAgentWithApplicationName):
+        * platform/ios/WebCoreSystemInterfaceIOS.h:
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+
</ins><span class="cx"> 2014-01-15  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix windows build.
</span></span></pre></div>
<a id="trunkSourceWebCoreConfigurationsWebCorexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Configurations/WebCore.xcconfig        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -112,6 +112,6 @@
</span><span class="cx"> JAVASCRIPTCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/JavaScriptCore.framework/PrivateHeaders;
</span><span class="cx"> 
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME));
</span><del>-EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ClipboardMac.mm ColorMac.mm Cursor.cpp CursorMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KeyEventMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollingCoordinatorMac.mm ScrollingStateScrollingNodeMac.mm ScrollingTreeScrollingNodeMac.mm ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreURLResponse.mm WebCoreView.m WebFontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WheelEventMac.mm WidgetMac.mm mac/LayerPool.mm DisplayRefreshMonitorMac.cpp;
</del><ins>+EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ClipboardMac.mm ColorMac.mm Cursor.cpp CursorMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KeyEventMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollingCoordinatorMac.mm ScrollingStateScrollingNodeMac.mm ScrollingTreeScrollingNodeMac.mm ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm UserAgentMac.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreURLResponse.mm WebCoreView.m WebFontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WheelEventMac.mm WidgetMac.mm mac/LayerPool.mm DisplayRefreshMonitorMac.cpp;
</ins><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos);
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm JSTouch* JSGesture* DOMGesture* DOMTouch* KillRingNone.cpp WAKAppKitStubs.h WAKClipView.h WAKResponder.h WAKScrollView.h WAKView.h WAKViewPrivate.h WAKWindow.h WKContentObservation.h WKGraphics.h WKTypes.h WKUtilities.h WKView.h WKViewPrivate.h WebCoreThread.h WebCoreThreadMessage.h WebCoreThreadRun.h WebCoreThreadSystemInterface.h;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -2084,6 +2084,7 @@
</span><span class="cx"> __ZN7WebCore35contextMenuItemTagShowSpellingPanelEb
</span><span class="cx"> __ZN7WebCore35contextMenuItemTagShowSubstitutionsEb
</span><span class="cx"> __ZN7WebCore35contextMenuItemTagSubstitutionsMenuEv
</span><ins>+__ZN7WebCore36standardUserAgentWithApplicationNameERKN3WTF6StringES3_
</ins><span class="cx"> __ZN7WebCore37contextMenuItemTagTransformationsMenuEv
</span><span class="cx"> __ZN7WebCore38contextMenuItemTagWritingDirectionMenuEv
</span><span class="cx"> __ZN7WebCore42contextMenuItemTagCheckGrammarWithSpellingEv
</span><span class="lines">@@ -2530,7 +2531,6 @@
</span><span class="cx"> _wkGetDeviceClass
</span><span class="cx"> _wkGetPlatformNameForNavigator
</span><span class="cx"> _wkGetScreenScaleFactor
</span><del>-_wkGetUserAgent
</del><span class="cx"> _wkGetVendorNameForNavigator
</span><span class="cx"> _wkGetVerticalGlyphsForCharacters
</span><span class="cx"> _wkGetViewportScreenSize
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -968,6 +968,9 @@
</span><span class="cx">                 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */; settings = {ATTRIBUTES = (); }; };
</span><span class="cx">                 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */; };
</span><span class="cx">                 2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                26255F0018878DFF0006E1FD /* UserAgentIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26255EFF18878DFF0006E1FD /* UserAgentIOS.mm */; };
+                26255F0318878E110006E1FD /* UserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 26255F0118878E110006E1FD /* UserAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                26255F0418878E110006E1FD /* UserAgentMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26255F0218878E110006E1FD /* UserAgentMac.mm */; };
</ins><span class="cx">                 265541391489811C000DFC5D /* KeyEventCodesIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 265541371489811C000DFC5D /* KeyEventCodesIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2655413A1489811C000DFC5D /* KeyEventIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 265541381489811C000DFC5D /* KeyEventIOS.mm */; };
</span><span class="cx">                 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */; };
</span><span class="lines">@@ -7815,6 +7818,9 @@
</span><span class="cx">                 2527CC9516BF95DD009DDAC0 /* PlatformSpeechSynthesisUtterance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesisUtterance.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                26255EFF18878DFF0006E1FD /* UserAgentIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26255F0118878E110006E1FD /* UserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserAgent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                26255F0218878E110006E1FD /* UserAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 265541371489811C000DFC5D /* KeyEventCodesIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIOS.h; path = ios/KeyEventCodesIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 265541381489811C000DFC5D /* KeyEventIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventIOS.mm; path = ios/KeyEventIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CursorIOS.cpp; path = ios/CursorIOS.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14633,6 +14639,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */,
</span><span class="cx">                                 FED13D3B0CEA936A00D89466 /* FrameIOS.mm */,
</span><ins>+                                26255EFF18878DFF0006E1FD /* UserAgentIOS.mm */,
</ins><span class="cx">                                 225A16B30D5C11E900090295 /* WebEventRegion.h */,
</span><span class="cx">                                 225A16B40D5C11E900090295 /* WebEventRegion.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -17173,6 +17180,8 @@
</span><span class="cx">                                 93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */,
</span><span class="cx">                                 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */,
</span><span class="cx">                                 E1C2F2481533A2120083F974 /* SettingsMac.mm */,
</span><ins>+                                26255F0118878E110006E1FD /* UserAgent.h */,
+                                26255F0218878E110006E1FD /* UserAgentMac.mm */,
</ins><span class="cx">                                 F587854C02DE375901EA4122 /* WebCoreFrameView.h */,
</span><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="lines">@@ -25937,6 +25946,7 @@
</span><span class="cx">                                 D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
</span><span class="cx">                                 F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */,
</span><span class="cx">                                 A72763BF16689BFB002FCACB /* UserActionElementSet.h in Headers */,
</span><ins>+                                26255F0318878E110006E1FD /* UserAgent.h in Headers */,
</ins><span class="cx">                                 078E091717D14D1C00420AA1 /* MediaStreamRegistry.h in Headers */,
</span><span class="cx">                                 656581B209D14EE6000E61D7 /* UserAgentStyleSheets.h in Headers */,
</span><span class="cx">                                 003F1FEA11E6AB43008258D9 /* UserContentTypes.h in Headers */,
</span><span class="lines">@@ -29182,6 +29192,8 @@
</span><span class="cx">                                 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */,
</span><span class="cx">                                 BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */,
</span><span class="cx">                                 FFDBC048183D27B700407109 /* LineWidth.cpp in Sources */,
</span><ins>+                                26255F0018878DFF0006E1FD /* UserAgentIOS.mm in Sources */,
+                                26255F0418878E110006E1FD /* UserAgentMac.mm in Sources */,
</ins><span class="cx">                                 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */,
</span><span class="cx">                                 BCDF317B11F8D683003C5BF8 /* UserTypingGestureIndicator.cpp in Sources */,
</span><span class="cx">                                 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosUserAgentIOSmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/ios/UserAgentIOS.mm (0 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ios/UserAgentIOS.mm                                (rev 0)
+++ trunk/Source/WebCore/page/ios/UserAgentIOS.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;UserAgent.h&quot;
+
+#import &lt;WebCoreSystemInterface.h&gt;
+#import &lt;wtf/NeverDestroyed.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+namespace WebCore {
+
+static NSString *platformSystemRootDirectory()
+{
+#if PLATFORM(IOS_SIMULATOR)
+    const char *simulatorRoot = getenv(&quot;IPHONE_SIMULATOR_ROOT&quot;);
+    return [NSString stringWithUTF8String:(simulatorRoot ? simulatorRoot : &quot;/&quot;)];
+#else
+    return @&quot;/&quot;;
+#endif
+}
+
+static NSString *osMarketingVersion()
+{
+    RetainPtr&lt;NSDictionary&gt; systemInfo = [[NSDictionary alloc] initWithContentsOfFile:[platformSystemRootDirectory() stringByAppendingPathComponent:@&quot;System/Library/CoreServices/SystemVersion.plist&quot;]];
+    NSString *productVersion = [systemInfo objectForKey:@&quot;ProductVersion&quot;];
+    return !productVersion ? @&quot;&quot; : [productVersion stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;];
+}
+
+String standardUserAgentWithApplicationName(const String&amp; applicationName, const String&amp; webkitVersionString)
+{
+    if (CFStringRef overrideUserAgent = wkGetUserAgent())
+        return overrideUserAgent;
+
+    // Check to see if there is a user agent override for all WebKit clients.
+    CFPropertyListRef override = CFPreferencesCopyAppValue(CFSTR(&quot;UserAgent&quot;), CFSTR(&quot;com.apple.WebFoundation&quot;));
+    if (override) {
+        if (CFGetTypeID(override) == CFStringGetTypeID())
+            return static_cast&lt;NSString *&gt;(CFBridgingRelease(override));
+        CFRelease(override);
+    }
+
+    NSString *webKitVersion = webkitVersionString;
+    CFStringRef deviceName = wkGetDeviceName();
+    CFStringRef osNameForUserAgent = wkGetOSNameForUserAgent();
+    NSString *osMarketingVersionString = osMarketingVersion();
+    if (applicationName.isEmpty())
+        return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko)&quot;, deviceName, osNameForUserAgent, osMarketingVersionString, webKitVersion];
+    return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko) %@&quot;, deviceName, osNameForUserAgent, osMarketingVersionString, webKitVersion, static_cast&lt;NSString *&gt;(applicationName)];
+}
+
+} // namespace WebCore.
</ins></span></pre></div>
<a id="trunkSourceWebCorepagemacUserAgenth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/mac/UserAgent.h (0 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/UserAgent.h                                (rev 0)
+++ trunk/Source/WebCore/page/mac/UserAgent.h        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UserAgent_h
+#define UserAgent_h
+
+#include &lt;wtf/text/WTFString.h&gt;
+
+@class NSBundle;
+
+namespace WebCore {
+String standardUserAgentWithApplicationName(const String&amp; applicationName, const String&amp; webkitVersionString);
+}
+
+#endif // UserAgentMac_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepagemacUserAgentMacmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/mac/UserAgentMac.mm (0 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/UserAgentMac.mm                                (rev 0)
+++ trunk/Source/WebCore/page/mac/UserAgentMac.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;UserAgent.h&quot;
+
+#import &lt;WebCore/SystemVersionMac.h&gt;
+#import &lt;wtf/NeverDestroyed.h&gt;
+
+namespace WebCore {
+
+#if defined(__ppc__) || defined(__ppc64__)
+#define PROCESSOR &quot;PPC&quot;
+#elif defined(__i386__) || defined(__x86_64__)
+#define PROCESSOR &quot;Intel&quot;
+#else
+#error Unknown architecture
+#endif
+
+static NSString *systemMarketingVersionForUserAgentString()
+{
+    // Use underscores instead of dots because when we first added the Mac OS X version to the user agent string
+    // we were concerned about old DHTML libraries interpreting &quot;4.&quot; as Netscape 4. That's no longer a concern for us
+    // but we're sticking with the underscores for compatibility with the format used by older versions of Safari.
+    return [systemMarketingVersion() stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;];
+}
+
+String standardUserAgentWithApplicationName(const String&amp; applicationName, const String&amp; webKitVersionString)
+{
+    String osVersion = systemMarketingVersionForUserAgentString();
+
+    if (applicationName.isEmpty())
+        return makeString(&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X &quot;, osVersion, &quot;) AppleWebKit/&quot;, webKitVersionString, &quot; (KHTML, like Gecko)&quot;);
+    return makeString(&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X &quot;, osVersion, &quot;) AppleWebKit/&quot;, webKitVersionString, &quot; (KHTML, like Gecko) &quot;, applicationName);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.h (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.h        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.h        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -68,6 +68,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> extern CFStringRef (*wkGetUserAgent)(void);
</span><ins>+extern CFStringRef (*wkGetDeviceName)(void);
+extern CFStringRef (*wkGetOSNameForUserAgent)(void);
</ins><span class="cx"> extern CFStringRef (*wkGetPlatformNameForNavigator)(void);
</span><span class="cx"> extern CFStringRef (*wkGetVendorNameForNavigator)(void);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -139,5 +139,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> CFStringRef (*wkGetUserAgent)(void);
</span><ins>+CFStringRef (*wkGetDeviceName)(void);
+CFStringRef (*wkGetOSNameForUserAgent)(void);
</ins><span class="cx"> CFStringRef (*wkGetPlatformNameForNavigator)(void);
</span><span class="cx"> CFStringRef (*wkGetVendorNameForNavigator)(void);
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-01-15  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        Move user agent code to WebCore and unify some code between OS X and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=127080
+
+        Reviewed by Sam Weinig.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+        * WebView/WebView.mm:
+        (userVisibleWebKitVersionString):
+        (+[WebView _standardUserAgentWithApplicationName:]):
+        (-[WebView _setUIWebViewUserAgentWithBuildVersion:]):
+
</ins><span class="cx"> 2014-01-15  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Clean up REMOTE_INSPECTOR code in OpenSource after the iOS merge
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -237,6 +237,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     INIT(GetUserAgent);
</span><ins>+    INIT(GetDeviceName);
+    INIT(GetOSNameForUserAgent);
</ins><span class="cx">     INIT(GetPlatformNameForNavigator);
</span><span class="cx">     INIT(GetVendorNameForNavigator);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -168,9 +168,9 @@
</span><span class="cx"> #import &lt;WebCore/SecurityPolicy.h&gt;
</span><span class="cx"> #import &lt;WebCore/Settings.h&gt;
</span><span class="cx"> #import &lt;WebCore/StyleProperties.h&gt;
</span><del>-#import &lt;WebCore/SystemVersionMac.h&gt;
</del><span class="cx"> #import &lt;WebCore/TextResourceDecoder.h&gt;
</span><span class="cx"> #import &lt;WebCore/ThreadCheck.h&gt;
</span><ins>+#import &lt;WebCore/UserAgent.h&gt;
</ins><span class="cx"> #import &lt;WebCore/WebCoreObjCExtras.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreView.h&gt;
</span><span class="cx"> #import &lt;WebCore/Widget.h&gt;
</span><span class="lines">@@ -305,16 +305,6 @@
</span><span class="cx"> using namespace Inspector;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-#if defined(__ppc__) || defined(__ppc64__)
-#define PROCESSOR &quot;PPC&quot;
-#elif defined(__i386__) || defined(__x86_64__)
-#define PROCESSOR &quot;Intel&quot;
-#else
-#if !PLATFORM(IOS)
-#error Unknown architecture
-#endif
-#endif
-
</del><span class="cx"> #define FOR_EACH_RESPONDER_SELECTOR(macro) \
</span><span class="cx"> macro(alignCenter) \
</span><span class="cx"> macro(alignJustified) \
</span><span class="lines">@@ -683,81 +673,25 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation WebView (WebPrivate)
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
-static NSString *systemMarketingVersionForUserAgentString()
</del><ins>+static String userVisibleWebKitVersionString()
</ins><span class="cx"> {
</span><del>-    // Use underscores instead of dots because when we first added the Mac OS X version to the user agent string
-    // we were concerned about old DHTML libraries interpreting &quot;4.&quot; as Netscape 4. That's no longer a concern for us
-    // but we're sticking with the underscores for compatibility with the format used by older versions of Safari.
-    return [systemMarketingVersion() stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;];
-}
-#endif
-
-static NSString *createUserVisibleWebKitVersionString()
-{
</del><span class="cx">     // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent
</span><span class="cx">     // string should not include the leading digits, so strip them off and report the rest as the version. &lt;rdar://problem/4997547&gt;
</span><span class="cx">     NSString *fullVersion = [[NSBundle bundleForClass:[WebView class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
</span><span class="cx">     NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
</span><span class="cx">     if (nonDigitRange.location == NSNotFound &amp;&amp; fullVersion.length &gt; 3)
</span><del>-        return [[fullVersion substringFromIndex:fullVersion.length - 3] copy];
</del><ins>+        return [fullVersion substringFromIndex:fullVersion.length - 3];
</ins><span class="cx">     if (nonDigitRange.location != NSNotFound &amp;&amp; nonDigitRange.location &gt; 3)
</span><del>-        return [[fullVersion substringFromIndex:nonDigitRange.location - 3] copy];
-    return [fullVersion copy];
</del><ins>+        return [fullVersion substringFromIndex:nonDigitRange.location - 3];
+    return fullVersion;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName
</span><span class="cx"> {
</span><del>-    // Note: Do *not* move the initialization of osVersion nor webKitVersion into the declaration.
-    // Garbage collection won't correctly mark the global variable in that case &lt;rdar://problem/5733674&gt;.
-    static NSString *osVersion;
-    static NSString *webKitVersion;
-    if (!osVersion)
-        osVersion = [systemMarketingVersionForUserAgentString() retain];
-    if (!webKitVersion)
-        webKitVersion = createUserVisibleWebKitVersionString();
-    if ([applicationName length])
-        return [NSString stringWithFormat:@&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko) %@&quot;, osVersion, webKitVersion, applicationName];
-    return [NSString stringWithFormat:@&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X %@) AppleWebKit/%@ (KHTML, like Gecko)&quot;, osVersion, webKitVersion];
</del><ins>+    return standardUserAgentWithApplicationName(applicationName, userVisibleWebKitVersionString());
</ins><span class="cx"> }
</span><del>-#else
-+ (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName osMarketingVersion:(NSString *)osMarketingVersion
-{
-    // Check to see if there is a user agent override for all WebKit clients.
-    CFPropertyListRef override = CFPreferencesCopyAppValue(CFSTR(&quot;UserAgent&quot;), CFSTR(&quot;com.apple.WebFoundation&quot;));
-    if (override) {
-        if (CFGetTypeID(override) == CFStringGetTypeID())
-            return (NSString *)CFBridgingRelease(override);
-        CFRelease(override);
-    }
</del><span class="cx"> 
</span><del>-    static NSString *webKitVersion;
-    if (!webKitVersion)
-        webKitVersion = createUserVisibleWebKitVersionString();
-    if ([applicationName length])
-        return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko) %@&quot;, WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion, webKitVersion, applicationName];
-    return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ %@ like Mac OS X) AppleWebKit/%@ (KHTML, like Gecko)&quot;, WKGetDeviceName(), WKGetOSNameForUserAgent(), osMarketingVersion,  webKitVersion];
-}
-
-+ (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName
-{
-    static NSString *osMarketingVersion;
-    if (!osMarketingVersion) {
-#if !PLATFORM(IOS_SIMULATOR)
-        NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:@&quot;/System/Library/CoreServices/SystemVersion.plist&quot;];
-#else
-        NSString *rootDirectory = [NSString stringWithUTF8String:WebKitPlatformSystemRootDirectory()];
-        NSDictionary *systemInfo = [[NSDictionary alloc] initWithContentsOfFile:[rootDirectory stringByAppendingPathComponent:@&quot;System/Library/CoreServices/SystemVersion.plist&quot;]];
-#endif
-        NSString *productVersion = [systemInfo objectForKey:@&quot;ProductVersion&quot;];
-        // Due to &lt;rdar://problem/3787996&gt;, we must use something other than periods to delimit the marketing version.  Using underscores to match Leopard's new convention.
-        osMarketingVersion = !productVersion ? @&quot;&quot; : [[productVersion stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;] retain];
-        [systemInfo release];
-    }
-    return [self _standardUserAgentWithApplicationName:applicationName osMarketingVersion:osMarketingVersion];
-}
-
</del><ins>+#if PLATFORM(IOS)
</ins><span class="cx"> - (void)_setBrowserUserAgentProductVersion:(NSString *)productVersion buildVersion:(NSString *)buildVersion bundleVersion:(NSString *)bundleVersion
</span><span class="cx"> {
</span><span class="cx">     [self setApplicationNameForUserAgent:[NSString stringWithFormat:@&quot;Version/%@ Mobile/%@ Safari/%@&quot;, productVersion, buildVersion, bundleVersion]];
</span><span class="lines">@@ -767,7 +701,6 @@
</span><span class="cx"> {
</span><span class="cx">     [self setApplicationNameForUserAgent:[@&quot;Mobile/&quot; stringByAppendingString:buildVersion]];
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> + (void)_reportException:(JSValueRef)exception inContext:(JSContextRef)context
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-15  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        Move user agent code to WebCore and unify some code between OS X and iOS
+        https://bugs.webkit.org/show_bug.cgi?id=127080
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::userVisibleWebKitVersionString):
+        (WebKit::WebPageProxy::standardUserAgent):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::standardUserAgent):
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
</ins><span class="cx"> 2014-01-15  Eunmi Lee  &lt;eunmi15.lee@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Use timestamp when event occurs for touch events.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import &quot;WebPageMessages.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #import &lt;WebCore/NotImplemented.h&gt;
</span><ins>+#import &lt;WebCore/UserAgent.h&gt;
</ins><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -46,15 +47,22 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String WebPageProxy::standardUserAgent(const String&amp;)
</del><ins>+static String userVisibleWebKitVersionString()
</ins><span class="cx"> {
</span><del>-    if (CFStringRef overrideUserAgent = WKGetUserAgent())
-        return overrideUserAgent;
</del><ins>+    // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent
+    // string should not include the leading digits, so strip them off and report the rest as the version. &lt;rdar://problem/4997547&gt;
+    NSString *fullVersion = [[NSBundle bundleForClass:NSClassFromString(@&quot;WKView&quot;)] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
+    NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
+    if (nonDigitRange.location == NSNotFound &amp;&amp; fullVersion.length &gt; 3)
+        return [fullVersion substringFromIndex:fullVersion.length - 3];
+    if (nonDigitRange.location != NSNotFound &amp;&amp; nonDigitRange.location &gt; 3)
+        return [fullVersion substringFromIndex:nonDigitRange.location - 3];
+    return fullVersion;
+}
</ins><span class="cx"> 
</span><del>-    notImplemented();
-
-    // Just return the iOS 7 user agent for now.
-    return [NSString stringWithFormat:@&quot;Mozilla/5.0 (%@; CPU %@ 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B489 Safari/9537.53&quot;, WKGetDeviceName(), WKGetOSNameForUserAgent()];
</del><ins>+String WebPageProxy::standardUserAgent(const String&amp; applicationName)
+{
+    return standardUserAgentWithApplicationName(applicationName, userVisibleWebKitVersionString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::getIsSpeaking(bool&amp;)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -43,8 +43,8 @@
</span><span class="cx"> #import &lt;WebCore/DictationAlternative.h&gt;
</span><span class="cx"> #import &lt;WebCore/GraphicsLayer.h&gt;
</span><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><del>-#import &lt;WebCore/SystemVersionMac.h&gt;
</del><span class="cx"> #import &lt;WebCore/TextAlternativeWithRange.h&gt;
</span><ins>+#import &lt;WebCore/UserAgent.h&gt;
</ins><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> #import &lt;mach-o/dyld.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="lines">@@ -75,22 +75,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if defined(__ppc__) || defined(__ppc64__)
-#define PROCESSOR &quot;PPC&quot;
-#elif defined(__i386__) || defined(__x86_64__)
-#define PROCESSOR &quot;Intel&quot;
-#else
-#error Unknown architecture
-#endif
-
-static NSString *systemMarketingVersionForUserAgentString()
-{
-    // Use underscores instead of dots because when we first added the Mac OS X version to the user agent string
-    // we were concerned about old DHTML libraries interpreting &quot;4.&quot; as Netscape 4. That's no longer a concern for us
-    // but we're sticking with the underscores for compatibility with the format used by older versions of Safari.
-    return [systemMarketingVersion() stringByReplacingOccurrencesOfString:@&quot;.&quot; withString:@&quot;_&quot;];
-}
-
</del><span class="cx"> static String userVisibleWebKitVersionString()
</span><span class="cx"> {
</span><span class="cx">     // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent
</span><span class="lines">@@ -106,12 +90,7 @@
</span><span class="cx"> 
</span><span class="cx"> String WebPageProxy::standardUserAgent(const String&amp; applicationNameForUserAgent)
</span><span class="cx"> {
</span><del>-    static NeverDestroyed&lt;String&gt; osVersion(systemMarketingVersionForUserAgentString());
-    static NeverDestroyed&lt;String&gt; webKitVersion(userVisibleWebKitVersionString());
-
-    if (applicationNameForUserAgent.isEmpty())
-        return makeString(&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X &quot;, osVersion.get(), &quot;) AppleWebKit/&quot;, webKitVersion.get(), &quot; (KHTML, like Gecko)&quot;);
-    return makeString(&quot;Mozilla/5.0 (Macintosh; &quot; PROCESSOR &quot; Mac OS X &quot;, osVersion.get(), &quot;) AppleWebKit/&quot;, webKitVersion.get(), &quot; (KHTML, like Gecko) &quot;, applicationNameForUserAgent);
</del><ins>+    return standardUserAgentWithApplicationName(applicationNameForUserAgent, userVisibleWebKitVersionString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::getIsSpeaking(bool&amp; isSpeaking)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (162113 => 162114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-01-16 05:27:16 UTC (rev 162113)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-01-16 06:42:39 UTC (rev 162114)
</span><span class="lines">@@ -203,6 +203,14 @@
</span><span class="cx">         INIT(CGPathAddRoundedRect);
</span><span class="cx">         INIT(CFURLRequestAllowAllPostCaching);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+        INIT(GetUserAgent);
+        INIT(GetDeviceName);
+        INIT(GetOSNameForUserAgent);
+        INIT(GetPlatformNameForNavigator);
+        INIT(GetVendorNameForNavigator);
+#endif
+
</ins><span class="cx"> #if !PLATFORM(IOS) &amp;&amp; PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1080
</span><span class="cx">         INIT(NSElasticDeltaForTimeDelta);
</span><span class="cx">         INIT(NSElasticDeltaForReboundDelta);
</span></span></pre>
</div>
</div>

</body>
</html>