[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 14:03:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 32e4c9e33fcecba272b6f48d5721c0d171acf048
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 2 00:45:10 2010 +0000

    WebCore: Plug-ins should have access to the private browsing state.
    https://bugs.webkit.org/show_bug.cgi?id=47031
    <rdar://problem/8505405>
    
    Reviewed by Sam Weinig.
    
    * page/Page.cpp:
    (WebCore::Page::privateBrowsingStateChanged):
    When iterating over all widgets, also look for PluginViewBase classes and invoke their
    privateBrowsingStateChange member function.
    
    * plugins/PluginViewBase.h:
    (WebCore::PluginViewBase::privateBrowsingStateChanged):
    Add function.
    
    WebKit2: Plug-ins should have access to the private browsing state.
    https://bugs.webkit.org/show_bug.cgi?id=47031
    <rdar://problem/8505405>
    
    Reviewed by Sam Weinig.
    
    * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
    (WebKit::NPN_GetValue):
    Handle NPNVprivateModeBool.
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
    (WebKit::NetscapePlugin::isPrivateBrowsingEnabled):
    Call PluginController::isPrivateBrowsingEnabled.
    
    (WebKit::NetscapePlugin::NPP_SetValue):
    Add NPP_SetValue wrapper.
    
    (WebKit::NetscapePlugin::privateBrowsingStateChanged):
    Call NPP_SetValue with the updated state.
    
    * WebProcess/Plugins/Plugin.h:
    Add privateBrowsingStateChanged pure virtual member function.
    
    * WebProcess/Plugins/PluginController.h:
    Add isPrivateBrowsingEnabled pure virtual member function.
    
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::PluginView::privateBrowsingStateChanged):
    Call Plugin::privateBrowsingStateChanged.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68962 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0438909..8f32336 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-01  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Plug-ins should have access to the private browsing state.
+        https://bugs.webkit.org/show_bug.cgi?id=47031
+        <rdar://problem/8505405>
+
+        * page/Page.cpp:
+        (WebCore::Page::privateBrowsingStateChanged):
+        When iterating over all widgets, also look for PluginViewBase classes and invoke their 
+        privateBrowsingStateChange member function.
+
+        * plugins/PluginViewBase.h:
+        (WebCore::PluginViewBase::privateBrowsingStateChanged):
+        Add function.
+
 2010-10-01  Brian Weinstein  <bweinstein at apple.com>
 
         Build Fix for Windows.
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 92955cc..bbe05f1 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -55,6 +55,7 @@
 #include "PluginData.h"
 #include "PluginHalter.h"
 #include "PluginView.h"
+#include "PluginViewBase.h"
 #include "ProgressTracker.h"
 #include "RenderTheme.h"
 #include "RenderWidget.h"
@@ -843,8 +844,9 @@ void Page::privateBrowsingStateChanged()
 
     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
     // from below privateBrowsingStateChanged does not affect their lifetime.
-
+    // FIXME: When PluginViewBase and PluginView are merged we don't need this extra Vector.
     Vector<RefPtr<PluginView>, 32> pluginViews;
+    Vector<RefPtr<PluginViewBase>, 32> pluginViewBases;
     for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
         FrameView* view = frame->view();
         if (!view)
@@ -856,14 +858,17 @@ void Page::privateBrowsingStateChanged()
         HashSet<RefPtr<Widget> >::const_iterator end = children->end();
         for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
             Widget* widget = (*it).get();
-            if (!widget->isPluginView())
-                continue;
-            pluginViews.append(static_cast<PluginView*>(widget));
+            if (widget->isPluginView())
+                pluginViews.append(static_cast<PluginView*>(widget));
+            if (widget->isPluginViewBase())
+                pluginViewBases.append(static_cast<PluginViewBase*>(widget));
         }
     }
 
-    for (size_t i = 0; i < pluginViews.size(); i++)
+    for (size_t i = 0; i < pluginViews.size(); ++i)
         pluginViews[i]->privateBrowsingStateChanged(privateBrowsingEnabled);
+    for (size_t i = 0; i < pluginViewBases.size(); ++i)
+        pluginViewBases[i]->privateBrowsingStateChanged(privateBrowsingEnabled);
 }
 
 void Page::pluginAllowedRunTimeChanged()
diff --git a/WebCore/plugins/PluginViewBase.h b/WebCore/plugins/PluginViewBase.h
index 4e5fe1a..58ceffa 100644
--- a/WebCore/plugins/PluginViewBase.h
+++ b/WebCore/plugins/PluginViewBase.h
@@ -45,6 +45,7 @@ public:
 #endif
 
     virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; }
+    virtual void privateBrowsingStateChanged(bool) { }
 
 protected:
     PluginViewBase(PlatformWidget widget) : Widget(widget) { }
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9d785c4..d6ca1bd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,35 @@
+2010-10-01  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Plug-ins should have access to the private browsing state.
+        https://bugs.webkit.org/show_bug.cgi?id=47031
+        <rdar://problem/8505405>
+    
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_GetValue):
+        Handle NPNVprivateModeBool.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::isPrivateBrowsingEnabled):
+        Call PluginController::isPrivateBrowsingEnabled.
+
+        (WebKit::NetscapePlugin::NPP_SetValue):
+        Add NPP_SetValue wrapper.
+
+        (WebKit::NetscapePlugin::privateBrowsingStateChanged):
+        Call NPP_SetValue with the updated state.
+
+        * WebProcess/Plugins/Plugin.h:
+        Add privateBrowsingStateChanged pure virtual member function.
+
+        * WebProcess/Plugins/PluginController.h:
+        Add isPrivateBrowsingEnabled pure virtual member function.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::privateBrowsingStateChanged):
+        Call Plugin::privateBrowsingStateChanged.
+
 2010-10-01  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index e317eee..c5c705b 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -416,6 +416,12 @@ static NPError NPN_GetValue(NPP npp, NPNVariable variable, void *value)
             *(NPObject**)value = pluginElementNPObject;
             break;
         }
+        case NPNVprivateModeBool: {
+            RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+
+            *(NPBool*)value = plugin->isPrivateBrowsingEnabled();
+            break;
+        }
 #if PLATFORM(MAC)
         case NPNVsupportsCoreGraphicsBool:
             // Always claim to support the Core Graphics drawing model.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 01afeca..2220069 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -165,6 +165,11 @@ bool NetscapePlugin::evaluate(NPObject* npObject, const String& scriptString, NP
     return m_pluginController->evaluate(npObject, scriptString, result, allowPopups());
 }
 
+bool NetscapePlugin::isPrivateBrowsingEnabled()
+{
+    return m_pluginController->isPrivateBrowsingEnabled();
+}
+
 NPObject* NetscapePlugin::windowScriptNPObject()
 {
     return m_pluginController->windowScriptNPObject();
@@ -276,6 +281,11 @@ NPError NetscapePlugin::NPP_GetValue(NPPVariable variable, void *value)
     return m_pluginModule->pluginFuncs().getvalue(&m_npp, variable, value);
 }
 
+NPError NetscapePlugin::NPP_SetValue(NPNVariable variable, void *value)
+{
+    return m_pluginModule->pluginFuncs().setvalue(&m_npp, variable, value);
+}
+
 void NetscapePlugin::callSetWindow()
 {
     m_npWindow.x = m_frameRect.x();
@@ -542,6 +552,17 @@ NPObject* NetscapePlugin::pluginScriptableNPObject()
     return scriptableNPObject;
 }
 
+void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled)
+{
+    // From https://wiki.mozilla.org/Plugins:PrivateMode
+    //   When the browser turns private mode on or off it will call NPP_SetValue for "NPNVprivateModeBool" 
+    //   (assigned enum value 18) with a pointer to an NPBool value on all applicable instances.
+    //   Plugins should check the boolean value pointed to, not the pointer itself. 
+    //   The value will be true when private mode is on.
+    NPBool value = privateBrowsingEnabled;
+    NPP_SetValue(NPNVprivateModeBool, &value);
+}
+
 PluginController* NetscapePlugin::controller()
 {
     return m_pluginController;
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 7c5521d..cfec376 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -68,6 +68,7 @@ public:
     void setStatusbarText(const String&);
     static void setException(const String&);
     bool evaluate(NPObject*, const String&scriptString, NPVariant* result);
+    bool isPrivateBrowsingEnabled();
 
     // These return retained objects.
     NPObject* windowScriptNPObject();
@@ -94,6 +95,7 @@ public:
     int16_t NPP_HandleEvent(void* event);
     void NPP_URLNotify(const char* url, NPReason, void* notifyData);
     NPError NPP_GetValue(NPPVariable, void *value);
+    NPError NPP_SetValue(NPNVariable, void *value);
 
 private:
     NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule);
@@ -142,6 +144,7 @@ private:
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
     virtual void setFocus(bool);
+    virtual NPObject* pluginScriptableNPObject();
 
 #if PLATFORM(MAC)
     virtual void windowFocusChanged(bool);
@@ -149,7 +152,7 @@ private:
     virtual void windowVisibilityChanged(bool);
 #endif
 
-    virtual NPObject* pluginScriptableNPObject();
+    virtual void privateBrowsingStateChanged(bool);
 
     virtual PluginController* controller();
 
diff --git a/WebKit2/WebProcess/Plugins/Plugin.h b/WebKit2/WebProcess/Plugins/Plugin.h
index fc08be7..0a88c77 100644
--- a/WebKit2/WebProcess/Plugins/Plugin.h
+++ b/WebKit2/WebProcess/Plugins/Plugin.h
@@ -148,6 +148,9 @@ public:
     virtual void windowVisibilityChanged(bool) = 0;
 #endif
 
+    // Called when the private browsing state for this plug-in changes.
+    virtual void privateBrowsingStateChanged(bool) = 0;
+
     // Returns the plug-in controller for this plug-in.
     // FIXME: We could just have the controller be a member variable of Plugin.
     virtual PluginController* controller() = 0;
diff --git a/WebKit2/WebProcess/Plugins/PluginController.h b/WebKit2/WebProcess/Plugins/PluginController.h
index e274988..b87c400 100644
--- a/WebKit2/WebProcess/Plugins/PluginController.h
+++ b/WebKit2/WebProcess/Plugins/PluginController.h
@@ -96,7 +96,10 @@ public:
 
     // Sets the cookies for the given URL.
     virtual void setCookiesForURL(const String& urlString, const String& cookieString) = 0;
-    
+
+    // Returns whether private browsing is enabled.
+    virtual bool isPrivateBrowsingEnabled() = 0;
+
 protected:
     virtual ~PluginController() { }
 };
diff --git a/WebKit2/WebProcess/Plugins/PluginView.cpp b/WebKit2/WebProcess/Plugins/PluginView.cpp
index 06f1fd7..cfb66e1 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -417,6 +417,15 @@ JSObject* PluginView::scriptObject(JSGlobalObject* globalObject)
     return jsObject;
 }
 
+void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled)
+{
+    // The plug-in can be null here if it failed to initialize.
+    if (!m_plugin)
+        return;
+
+    m_plugin->privateBrowsingStateChanged(privateBrowsingEnabled);
+}
+
 void PluginView::setFrameRect(const WebCore::IntRect& rect)
 {
     Widget::setFrameRect(rect);
@@ -841,7 +850,20 @@ void PluginView::setCookiesForURL(const String& urlString, const String& cookieS
 {
     setCookies(m_pluginElement->document(), KURL(KURL(), urlString), cookieString);
 }
-    
+
+bool PluginView::isPrivateBrowsingEnabled()
+{
+    // If we can't get the real setting, we'll assume that private browsing is enabled.
+    if (!frame())
+        return true;
+
+    Settings* settings = frame()->settings();
+    if (!settings)
+        return true;
+
+    return settings->privateBrowsingEnabled();
+}
+
 void PluginView::didFinishLoad(WebFrame* webFrame)
 {
     RefPtr<URLRequest> request = m_pendingFrameLoads.take(webFrame);
diff --git a/WebKit2/WebProcess/Plugins/PluginView.h b/WebKit2/WebProcess/Plugins/PluginView.h
index bc44514..ec8dadf 100644
--- a/WebKit2/WebProcess/Plugins/PluginView.h
+++ b/WebKit2/WebProcess/Plugins/PluginView.h
@@ -98,6 +98,7 @@ private:
     virtual PlatformLayer* platformLayer() const;
 #endif
     virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*);
+    virtual void privateBrowsingStateChanged(bool);
     
     // WebCore::Widget
     virtual void setFrameRect(const WebCore::IntRect&);
@@ -130,7 +131,8 @@ private:
     virtual String proxiesForURL(const String&);
     virtual String cookiesForURL(const String&);
     virtual void setCookiesForURL(const String& urlString, const String& cookieString);
-    
+    virtual bool isPrivateBrowsingEnabled();
+
     // WebFrame::LoadListener
     virtual void didFinishLoad(WebFrame*);
     virtual void didFailLoad(WebFrame*, bool wasCancelled);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list