[Cocoa] Add properties related to the user agent string
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2013 17:40:07 +0000 (17:40 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2013 17:40:07 +0000 (17:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125856

Reviewed by Anders Carlsson.

* UIProcess/API/Cocoa/WKBrowsingContextController.h: Declared new properties.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController applicationNameForUserAgent]): Added accessor.
(-[WKBrowsingContextController setApplicationNameForUserAgent:]): Ditto.
(-[WKBrowsingContextController customUserAgent]): Ditto.
(-[WKBrowsingContextController setCustomUserAgent:]): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160710 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.h
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm

index f99aa16..b108894 100644 (file)
@@ -1,3 +1,17 @@
+2013-12-17  Dan Bernstein  <mitz@apple.com>
+
+        [Cocoa] Add properties related to the user agent string
+        https://bugs.webkit.org/show_bug.cgi?id=125856
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/Cocoa/WKBrowsingContextController.h: Declared new properties.
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController applicationNameForUserAgent]): Added accessor.
+        (-[WKBrowsingContextController setApplicationNameForUserAgent:]): Ditto.
+        (-[WKBrowsingContextController customUserAgent]): Ditto.
+        (-[WKBrowsingContextController setCustomUserAgent:]): Ditto.
+
 2013-12-16  Gavin Barraclough  <barraclough@apple.com>
 
         Add layer hosting mode to ViewState
index 171081e..9f1687e 100644 (file)
@@ -90,6 +90,8 @@ WK_API_CLASS
 /* Reload the currently active URL, bypassing caches. */
 - (void)reloadFromOrigin;
 
+@property (copy) NSString *applicationNameForUserAgent;
+@property (copy) NSString *customUserAgent;
 
 #pragma mark Back/Forward
 
index d953036..dc70e09 100644 (file)
@@ -280,6 +280,28 @@ static void releaseNSData(unsigned char*, const void* data)
     _page->reload(true);
 }
 
+- (NSString *)applicationNameForUserAgent
+{
+    const String& applicationName = _page->applicationNameForUserAgent();
+    return !applicationName ? nil : (NSString *)applicationName;
+}
+
+- (void)setApplicationNameForUserAgent:(NSString *)applicationNameForUserAgent
+{
+    _page->setApplicationNameForUserAgent(applicationNameForUserAgent);
+}
+
+- (NSString *)customUserAgent
+{
+    const String& customUserAgent = _page->customUserAgent();
+    return !customUserAgent ? nil : (NSString *)customUserAgent;
+}
+
+- (void)setCustomUserAgent:(NSString *)customUserAgent
+{
+    _page->setCustomUserAgent(customUserAgent);
+}
+
 #pragma mark Back/Forward
 
 - (void)goForward