Changeset 68962 in webkit
- Timestamp:
- Oct 1, 2010 5:45:10 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r68960 r68962 1 2010-10-01 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Plug-ins should have access to the private browsing state. 6 https://bugs.webkit.org/show_bug.cgi?id=47031 7 <rdar://problem/8505405> 8 9 * page/Page.cpp: 10 (WebCore::Page::privateBrowsingStateChanged): 11 When iterating over all widgets, also look for PluginViewBase classes and invoke their 12 privateBrowsingStateChange member function. 13 14 * plugins/PluginViewBase.h: 15 (WebCore::PluginViewBase::privateBrowsingStateChanged): 16 Add function. 17 1 18 2010-10-01 Brian Weinstein <bweinstein@apple.com> 2 19 -
trunk/WebCore/page/Page.cpp
r67122 r68962 56 56 #include "PluginHalter.h" 57 57 #include "PluginView.h" 58 #include "PluginViewBase.h" 58 59 #include "ProgressTracker.h" 59 60 #include "RenderTheme.h" … … 844 845 // Collect the PluginViews in to a vector to ensure that action the plug-in takes 845 846 // from below privateBrowsingStateChanged does not affect their lifetime. 846 847 // FIXME: When PluginViewBase and PluginView are merged we don't need this extra Vector. 847 848 Vector<RefPtr<PluginView>, 32> pluginViews; 849 Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; 848 850 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) { 849 851 FrameView* view = frame->view(); … … 857 859 for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) { 858 860 Widget* widget = (*it).get(); 859 if (!widget->isPluginView()) 860 continue; 861 pluginViews.append(static_cast<PluginView*>(widget)); 861 if (widget->isPluginView()) 862 pluginViews.append(static_cast<PluginView*>(widget)); 863 if (widget->isPluginViewBase()) 864 pluginViewBases.append(static_cast<PluginViewBase*>(widget)); 862 865 } 863 866 } 864 867 865 for (size_t i = 0; i < pluginViews.size(); i++)868 for (size_t i = 0; i < pluginViews.size(); ++i) 866 869 pluginViews[i]->privateBrowsingStateChanged(privateBrowsingEnabled); 870 for (size_t i = 0; i < pluginViewBases.size(); ++i) 871 pluginViewBases[i]->privateBrowsingStateChanged(privateBrowsingEnabled); 867 872 } 868 873 -
trunk/WebCore/plugins/PluginViewBase.h
r64365 r68962 46 46 47 47 virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; } 48 virtual void privateBrowsingStateChanged(bool) { } 48 49 49 50 protected: -
trunk/WebKit2/ChangeLog
r68961 r68962 1 2010-10-01 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Plug-ins should have access to the private browsing state. 6 https://bugs.webkit.org/show_bug.cgi?id=47031 7 <rdar://problem/8505405> 8 9 * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: 10 (WebKit::NPN_GetValue): 11 Handle NPNVprivateModeBool. 12 13 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 14 (WebKit::NetscapePlugin::isPrivateBrowsingEnabled): 15 Call PluginController::isPrivateBrowsingEnabled. 16 17 (WebKit::NetscapePlugin::NPP_SetValue): 18 Add NPP_SetValue wrapper. 19 20 (WebKit::NetscapePlugin::privateBrowsingStateChanged): 21 Call NPP_SetValue with the updated state. 22 23 * WebProcess/Plugins/Plugin.h: 24 Add privateBrowsingStateChanged pure virtual member function. 25 26 * WebProcess/Plugins/PluginController.h: 27 Add isPrivateBrowsingEnabled pure virtual member function. 28 29 * WebProcess/Plugins/PluginView.cpp: 30 (WebKit::PluginView::privateBrowsingStateChanged): 31 Call Plugin::privateBrowsingStateChanged. 32 1 33 2010-10-01 Sam Weinig <sam@webkit.org> 2 34 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
r68898 r68962 415 415 NPObject* pluginElementNPObject = plugin->pluginElementNPObject(); 416 416 *(NPObject**)value = pluginElementNPObject; 417 break; 418 } 419 case NPNVprivateModeBool: { 420 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 421 422 *(NPBool*)value = plugin->isPrivateBrowsingEnabled(); 417 423 break; 418 424 } -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r68898 r68962 166 166 } 167 167 168 bool NetscapePlugin::isPrivateBrowsingEnabled() 169 { 170 return m_pluginController->isPrivateBrowsingEnabled(); 171 } 172 168 173 NPObject* NetscapePlugin::windowScriptNPObject() 169 174 { … … 275 280 { 276 281 return m_pluginModule->pluginFuncs().getvalue(&m_npp, variable, value); 282 } 283 284 NPError NetscapePlugin::NPP_SetValue(NPNVariable variable, void *value) 285 { 286 return m_pluginModule->pluginFuncs().setvalue(&m_npp, variable, value); 277 287 } 278 288 … … 543 553 } 544 554 555 void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled) 556 { 557 // From https://wiki.mozilla.org/Plugins:PrivateMode 558 // When the browser turns private mode on or off it will call NPP_SetValue for "NPNVprivateModeBool" 559 // (assigned enum value 18) with a pointer to an NPBool value on all applicable instances. 560 // Plugins should check the boolean value pointed to, not the pointer itself. 561 // The value will be true when private mode is on. 562 NPBool value = privateBrowsingEnabled; 563 NPP_SetValue(NPNVprivateModeBool, &value); 564 } 565 545 566 PluginController* NetscapePlugin::controller() 546 567 { -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r68898 r68962 69 69 static void setException(const String&); 70 70 bool evaluate(NPObject*, const String&scriptString, NPVariant* result); 71 bool isPrivateBrowsingEnabled(); 71 72 72 73 // These return retained objects. … … 95 96 void NPP_URLNotify(const char* url, NPReason, void* notifyData); 96 97 NPError NPP_GetValue(NPPVariable, void *value); 98 NPError NPP_SetValue(NPNVariable, void *value); 97 99 98 100 private: … … 143 145 virtual bool handleMouseLeaveEvent(const WebMouseEvent&); 144 146 virtual void setFocus(bool); 147 virtual NPObject* pluginScriptableNPObject(); 145 148 146 149 #if PLATFORM(MAC) … … 150 153 #endif 151 154 152 virtual NPObject* pluginScriptableNPObject();155 virtual void privateBrowsingStateChanged(bool); 153 156 154 157 virtual PluginController* controller(); -
trunk/WebKit2/WebProcess/Plugins/Plugin.h
r68058 r68962 149 149 #endif 150 150 151 // Called when the private browsing state for this plug-in changes. 152 virtual void privateBrowsingStateChanged(bool) = 0; 153 151 154 // Returns the plug-in controller for this plug-in. 152 155 // FIXME: We could just have the controller be a member variable of Plugin. -
trunk/WebKit2/WebProcess/Plugins/PluginController.h
r68898 r68962 97 97 // Sets the cookies for the given URL. 98 98 virtual void setCookiesForURL(const String& urlString, const String& cookieString) = 0; 99 99 100 // Returns whether private browsing is enabled. 101 virtual bool isPrivateBrowsingEnabled() = 0; 102 100 103 protected: 101 104 virtual ~PluginController() { } -
trunk/WebKit2/WebProcess/Plugins/PluginView.cpp
r68952 r68962 418 418 } 419 419 420 void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) 421 { 422 // The plug-in can be null here if it failed to initialize. 423 if (!m_plugin) 424 return; 425 426 m_plugin->privateBrowsingStateChanged(privateBrowsingEnabled); 427 } 428 420 429 void PluginView::setFrameRect(const WebCore::IntRect& rect) 421 430 { … … 842 851 setCookies(m_pluginElement->document(), KURL(KURL(), urlString), cookieString); 843 852 } 844 853 854 bool PluginView::isPrivateBrowsingEnabled() 855 { 856 // If we can't get the real setting, we'll assume that private browsing is enabled. 857 if (!frame()) 858 return true; 859 860 Settings* settings = frame()->settings(); 861 if (!settings) 862 return true; 863 864 return settings->privateBrowsingEnabled(); 865 } 866 845 867 void PluginView::didFinishLoad(WebFrame* webFrame) 846 868 { -
trunk/WebKit2/WebProcess/Plugins/PluginView.h
r68898 r68962 99 99 #endif 100 100 virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*); 101 virtual void privateBrowsingStateChanged(bool); 101 102 102 103 // WebCore::Widget … … 131 132 virtual String cookiesForURL(const String&); 132 133 virtual void setCookiesForURL(const String& urlString, const String& cookieString); 133 134 virtual bool isPrivateBrowsingEnabled(); 135 134 136 // WebFrame::LoadListener 135 137 virtual void didFinishLoad(WebFrame*);
Note: See TracChangeset
for help on using the changeset viewer.