[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:32:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 961ccb3bff6c1c7e13d72a9e2160191f997b32f2
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 17 03:30:44 2002 +0000

    WebCore:
    
            * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::userAgent):
    	Call bridge's userAgentForURL: method.
            * kwq/WebCoreBridge.h: Added userAgentForURL: to the protocol
    
    WebKit:
    
    	Step 3 in adding user agent API to WebKit and WebFoundation.
    	Add the calls to WebKit to configure the user-agent string.
    	Change WebCore to get the user-agent from WebKit via the bridge.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge userAgentForURL:]): Added. Calls [WebController userAgentForURL:].
    
            * WebView.subproj/WebController.h: Add three new methods.
            * WebView.subproj/WebController.m:
            (-[WebController setApplicationNameForUserAgent:]): Store an application name that
    	will be used to build up the user-agent string.
            (-[WebController setUserAgent:]): Set an override user agent; mainly useful for
    	testing user-agent strings different from the one WebKit supplies.
            (-[WebController userAgentForURL:]): Public API for getting the user agent string
    	that the WebController will use for a particular URL.
    
            * WebView.subproj/WebControllerPrivate.h: Add fields for the user-agent parameters.
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebControllerPrivate dealloc]): Release both strings when the controller goes away.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1858 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 3c2db37..c0d574c 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,11 @@
 2002-08-16  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::userAgent):
+	Call bridge's userAgentForURL: method.
+        * kwq/WebCoreBridge.h: Added userAgentForURL: to the protocol
+
+2002-08-16  Darin Adler  <darin at apple.com>
+
 	Step 2 in adding user agent API to WebKit and WebFoundation.
 	In this step, I change WebCore so that it the KWQKHTMLPartImpl
 	is responsible for fetching the user agent. Later it will
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 3c2db37..c0d574c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,11 @@
 2002-08-16  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::userAgent):
+	Call bridge's userAgentForURL: method.
+        * kwq/WebCoreBridge.h: Added userAgentForURL: to the protocol
+
+2002-08-16  Darin Adler  <darin at apple.com>
+
 	Step 2 in adding user agent API to WebKit and WebFoundation.
 	In this step, I change WebCore so that it the KWQKHTMLPartImpl
 	is responsible for fetching the user agent. Later it will
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3c2db37..c0d574c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,11 @@
 2002-08-16  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::userAgent):
+	Call bridge's userAgentForURL: method.
+        * kwq/WebCoreBridge.h: Added userAgentForURL: to the protocol
+
+2002-08-16  Darin Adler  <darin at apple.com>
+
 	Step 2 in adding user agent API to WebKit and WebFoundation.
 	In this step, I change WebCore so that it the KWQKHTMLPartImpl
 	is responsible for fetching the user agent. Later it will
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index f4d9a8e..ceb5631 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -539,7 +539,5 @@ RenderObject *KWQKHTMLPartImpl::getRenderer()
 
 QString KWQKHTMLPartImpl::userAgent() const
 {
-    // FIXME: Should get this from WebFoundation so that we don't have two copies of the
-    // user agent string that we need to keep in sync.
-    return "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
+    return QString::fromNSString([bridge userAgentForURL:part->m_url.getNSURL()]);
 }
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index f4d9a8e..ceb5631 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -539,7 +539,5 @@ RenderObject *KWQKHTMLPartImpl::getRenderer()
 
 QString KWQKHTMLPartImpl::userAgent() const
 {
-    // FIXME: Should get this from WebFoundation so that we don't have two copies of the
-    // user agent string that we need to keep in sync.
-    return "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
+    return QString::fromNSString([bridge userAgentForURL:part->m_url.getNSURL()]);
 }
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 957dfe4..ebe278e 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -139,6 +139,8 @@ typedef khtml::RenderPart KHTMLRenderPart;
 - (void)postWithURL:(NSURL *)URL data:(NSData *)data;
 - (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL;
 
+- (NSString *)userAgentForURL:(NSURL *)URL;
+
 - (void)setTitle:(NSString *)title;
 - (void)setStatusText:(NSString *)status;
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index fe4f503..c3c6677 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,27 @@
 2002-08-16  Darin Adler  <darin at apple.com>
 
+	Step 3 in adding user agent API to WebKit and WebFoundation.
+	Add the calls to WebKit to configure the user-agent string.
+	Change WebCore to get the user-agent from WebKit via the bridge.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge userAgentForURL:]): Added. Calls [WebController userAgentForURL:].
+
+        * WebView.subproj/WebController.h: Add three new methods.
+        * WebView.subproj/WebController.m:
+        (-[WebController setApplicationNameForUserAgent:]): Store an application name that
+	will be used to build up the user-agent string.
+        (-[WebController setUserAgent:]): Set an override user agent; mainly useful for
+	testing user-agent strings different from the one WebKit supplies.
+        (-[WebController userAgentForURL:]): Public API for getting the user agent string
+	that the WebController will use for a particular URL.
+
+        * WebView.subproj/WebControllerPrivate.h: Add fields for the user-agent parameters.
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate dealloc]): Release both strings when the controller goes away.
+
+2002-08-16  Darin Adler  <darin at apple.com>
+
 	Missed one call to [WebResourceHandle initWithURL:].
         * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge objectLoadedFromCache:size:]):
         Change to call [WebResourceHandle initWithClient:URL:] with nil for the client.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index fe4f503..c3c6677 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,27 @@
 2002-08-16  Darin Adler  <darin at apple.com>
 
+	Step 3 in adding user agent API to WebKit and WebFoundation.
+	Add the calls to WebKit to configure the user-agent string.
+	Change WebCore to get the user-agent from WebKit via the bridge.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge userAgentForURL:]): Added. Calls [WebController userAgentForURL:].
+
+        * WebView.subproj/WebController.h: Add three new methods.
+        * WebView.subproj/WebController.m:
+        (-[WebController setApplicationNameForUserAgent:]): Store an application name that
+	will be used to build up the user-agent string.
+        (-[WebController setUserAgent:]): Set an override user agent; mainly useful for
+	testing user-agent strings different from the one WebKit supplies.
+        (-[WebController userAgentForURL:]): Public API for getting the user agent string
+	that the WebController will use for a particular URL.
+
+        * WebView.subproj/WebControllerPrivate.h: Add fields for the user-agent parameters.
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate dealloc]): Release both strings when the controller goes away.
+
+2002-08-16  Darin Adler  <darin at apple.com>
+
 	Missed one call to [WebResourceHandle initWithURL:].
         * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge objectLoadedFromCache:size:]):
         Change to call [WebResourceHandle initWithClient:URL:] with nil for the client.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 635574a..7de4611 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -308,4 +308,9 @@
     [backForwardItem release];
 }
 
+- (NSString *)userAgentForURL:(NSURL *)URL
+{
+    return [[frame controller] userAgentForURL:URL];
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index f59234f..2514f96 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -200,4 +200,18 @@
 - (void)setTextSizeMultiplier:(float)multiplier; // 1.0 is normal size
 - (float)textSizeMultiplier;
 
+// Set the application name. This name will be used in user-agent strings
+// that are chosen for best results in rendering web pages.
+- (void)setApplicationNameForUserAgent:(NSString *)applicationName;
+
+// Set the user agent explicitly. Setting the user-agent string to nil means
+// that WebKit should construct the best possible user-agent string for each URL
+// for best results rendering web pages. Setting it to any string means
+// that WebKit should use that user-agent string for all purposes until it is set
+// back to nil.
+- (void)setUserAgent:(NSString *)userAgentString;
+
+// Get the appropriate user-agent string for a particular URL.
+- (NSString *)userAgentForURL:(NSURL *)URL;
+
 @end
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 3b47f38..ccd3a47 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -369,5 +369,40 @@
     return _private->textSizeMultiplier;
 }
 
- at end
+- (void)setApplicationNameForUserAgent:(NSString *)applicationName
+{
+    NSString *name = [applicationName copy];
+    [_private->applicationNameForUserAgent release];
+    _private->applicationNameForUserAgent = name;
+}
 
+// Set the user agent explicitly. Setting the user-agent string to nil means
+// that WebKit should construct the best possible user-agent string for each URL
+// for best results rendering web pages. Setting it to any string means
+// that WebKit should use that user-agent string for all purposes until it is set
+// back to nil.
+- (void)setUserAgent:(NSString *)userAgentString
+{
+    NSString *override = [userAgentString copy];
+    [_private->userAgentOverride release];
+    _private->userAgentOverride = override;
+}
+
+// Get the appropriate user-agent string for a particular URL.
+- (NSString *)userAgentForURL:(NSURL *)URL
+{
+    if (_private->userAgentOverride) {
+        return _private->userAgentOverride;
+    }
+
+    // Note that we currently don't look at the URL.
+    // If we find that we need different user agent strings for different web pages
+    // for best results, then that logic will go here.
+
+    // FIXME: Incorporate applicationNameForUserAgent in this string so that people
+    // can tell that they are talking to Alexander. Maybe also incorporate something
+    // that identifies WebKit's involvement.
+    return @"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 139e6a2..69d9cb6 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -23,6 +23,8 @@
     WebBackForwardList *backForwardList;
     float textSizeMultiplier;
     BOOL useBackForwardList;
+    NSString *applicationNameForUserAgent;
+    NSString *userAgentOverride;
 }
 @end
 
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index dd0acb5..127647c 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -25,7 +25,6 @@
 
 - init 
 {
-    mainFrame = nil;
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuHandler = [[WebDefaultContextMenuHandler alloc] init];
     textSizeMultiplier = 1;
@@ -62,6 +61,8 @@
     [policyHandler release];
     [backForwardList release];
     [defaultContextMenuHandler release];
+    [applicationNameForUserAgent release];
+    [userAgentOverride release];
     
     [super dealloc];
 }
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index f59234f..2514f96 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -200,4 +200,18 @@
 - (void)setTextSizeMultiplier:(float)multiplier; // 1.0 is normal size
 - (float)textSizeMultiplier;
 
+// Set the application name. This name will be used in user-agent strings
+// that are chosen for best results in rendering web pages.
+- (void)setApplicationNameForUserAgent:(NSString *)applicationName;
+
+// Set the user agent explicitly. Setting the user-agent string to nil means
+// that WebKit should construct the best possible user-agent string for each URL
+// for best results rendering web pages. Setting it to any string means
+// that WebKit should use that user-agent string for all purposes until it is set
+// back to nil.
+- (void)setUserAgent:(NSString *)userAgentString;
+
+// Get the appropriate user-agent string for a particular URL.
+- (NSString *)userAgentForURL:(NSURL *)URL;
+
 @end
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 3b47f38..ccd3a47 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -369,5 +369,40 @@
     return _private->textSizeMultiplier;
 }
 
- at end
+- (void)setApplicationNameForUserAgent:(NSString *)applicationName
+{
+    NSString *name = [applicationName copy];
+    [_private->applicationNameForUserAgent release];
+    _private->applicationNameForUserAgent = name;
+}
 
+// Set the user agent explicitly. Setting the user-agent string to nil means
+// that WebKit should construct the best possible user-agent string for each URL
+// for best results rendering web pages. Setting it to any string means
+// that WebKit should use that user-agent string for all purposes until it is set
+// back to nil.
+- (void)setUserAgent:(NSString *)userAgentString
+{
+    NSString *override = [userAgentString copy];
+    [_private->userAgentOverride release];
+    _private->userAgentOverride = override;
+}
+
+// Get the appropriate user-agent string for a particular URL.
+- (NSString *)userAgentForURL:(NSURL *)URL
+{
+    if (_private->userAgentOverride) {
+        return _private->userAgentOverride;
+    }
+
+    // Note that we currently don't look at the URL.
+    // If we find that we need different user agent strings for different web pages
+    // for best results, then that logic will go here.
+
+    // FIXME: Incorporate applicationNameForUserAgent in this string so that people
+    // can tell that they are talking to Alexander. Maybe also incorporate something
+    // that identifies WebKit's involvement.
+    return @"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 139e6a2..69d9cb6 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -23,6 +23,8 @@
     WebBackForwardList *backForwardList;
     float textSizeMultiplier;
     BOOL useBackForwardList;
+    NSString *applicationNameForUserAgent;
+    NSString *userAgentOverride;
 }
 @end
 
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index dd0acb5..127647c 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -25,7 +25,6 @@
 
 - init 
 {
-    mainFrame = nil;
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuHandler = [[WebDefaultContextMenuHandler alloc] init];
     textSizeMultiplier = 1;
@@ -62,6 +61,8 @@
     [policyHandler release];
     [backForwardList release];
     [defaultContextMenuHandler release];
+    [applicationNameForUserAgent release];
+    [userAgentOverride release];
     
     [super dealloc];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list