Changeset 68898 in webkit
- Timestamp:
- Oct 1, 2010 10:46:27 AM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r68891 r68898 1 2010-10-01 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Implement NPN_GetValueForURL/NPN_SetValueForURL and stub out PluginController functions 6 https://bugs.webkit.org/show_bug.cgi?id=46992 7 8 * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: 9 (WebKit::copyCString): 10 Helper function for allocating a string using NPN_MemAlloc. 11 12 (WebKit::NPN_GetValueForURL): 13 Ask the plug-in for either the proxy or the cookies given an URL. 14 15 (WebKit::NPN_SetValueForURL): 16 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 17 Tell the plug-in to set the cookies for the given URL. 18 19 (WebKit::NetscapePlugin::proxiesForURL): 20 (WebKit::NetscapePlugin::cookiesForURL): 21 (WebKit::NetscapePlugin::setCookiesForURL): 22 Call the corresponding PluginController functions. 23 24 * WebProcess/Plugins/PluginController.h: 25 Add new pure virtual member functions. 26 27 * WebProcess/Plugins/PluginView.cpp: 28 (WebKit::PluginView::proxiesForURL): 29 (WebKit::PluginView::cookiesForURL): 30 (WebKit::PluginView::setCookiesForURL): 31 Add stubbed out implementations of the new PluginController functions. 32 33 * WebProcess/Plugins/PluginView.h: 34 1 35 2010-10-01 Adam Roben <aroben@apple.com> 2 36 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
r68891 r68898 676 676 } 677 677 678 static NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len) 679 { 680 notImplemented(); 681 return NPERR_GENERIC_ERROR; 682 } 683 684 static NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len) 685 { 686 notImplemented(); 687 return NPERR_GENERIC_ERROR; 678 static NPError copyCString(const CString& string, char** value, uint32_t* len) 679 { 680 ASSERT(!string.isNull()); 681 ASSERT(value); 682 ASSERT(len); 683 684 *value = static_cast<char*>(NPN_MemAlloc(string.length())); 685 if (!*value) 686 return NPERR_GENERIC_ERROR; 687 688 memcpy(*value, string.data(), string.length()); 689 return NPERR_NO_ERROR; 690 } 691 692 static NPError NPN_GetValueForURL(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32_t* len) 693 { 694 if (!value || !len) 695 return NPERR_GENERIC_ERROR; 696 697 switch (variable) { 698 case NPNURLVCookie: { 699 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 700 701 String cookies = plugin->cookiesForURL(makeURLString(url)); 702 if (cookies.isNull()) 703 return NPERR_GENERIC_ERROR; 704 705 return copyCString(cookies.utf8(), value, len); 706 } 707 708 case NPNURLVProxy: { 709 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 710 711 String proxies = plugin->proxiesForURL(makeURLString(url)); 712 if (proxies.isNull()) 713 return NPERR_GENERIC_ERROR; 714 715 return copyCString(proxies.utf8(), value, len); 716 } 717 default: 718 notImplemented(); 719 return NPERR_GENERIC_ERROR; 720 } 721 } 722 723 static NPError NPN_SetValueForURL(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32_t len) 724 { 725 switch (variable) { 726 case NPNURLVCookie: { 727 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 728 729 plugin->setCookiesForURL(makeURLString(url), String(value, len)); 730 return NPERR_NO_ERROR; 731 } 732 733 case NPNURLVProxy: 734 // Can't set the proxy for a URL. 735 return NPERR_GENERIC_ERROR; 736 737 default: 738 notImplemented(); 739 return NPERR_GENERIC_ERROR; 740 } 688 741 } 689 742 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r68662 r68898 207 207 } 208 208 209 String NetscapePlugin::proxiesForURL(const String& urlString) 210 { 211 return m_pluginController->proxiesForURL(urlString); 212 } 213 214 String NetscapePlugin::cookiesForURL(const String& urlString) 215 { 216 return m_pluginController->cookiesForURL(urlString); 217 } 218 219 void NetscapePlugin::setCookiesForURL(const String& urlString, const String& cookieString) 220 { 221 m_pluginController->setCookiesForURL(urlString, cookieString); 222 } 223 209 224 NPError NetscapePlugin::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* savedData) 210 225 { -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r68891 r68898 78 78 79 79 bool isAcceleratedCompositingEnabled(); 80 81 String proxiesForURL(const String& urlString); 82 String cookiesForURL(const String& urlString); 83 void setCookiesForURL(const String& urlString, const String& cookieString); 80 84 81 85 // Member functions for calling into the plug-in. -
trunk/WebKit2/WebProcess/Plugins/PluginController.h
r68662 r68898 71 71 72 72 // Evaluates the given script string in the context of the given NPObject. 73 virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups) = 0;73 virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups) = 0; 74 74 75 75 // Set the statusbar text. … … 89 89 #endif 90 90 91 // Returns the proxies for the given URL or null on failure. 92 virtual String proxiesForURL(const String&) = 0; 93 94 // Returns the cookies for the given URL or null on failure. 95 virtual String cookiesForURL(const String&) = 0; 96 97 // Sets the cookies for the given URL. 98 virtual void setCookiesForURL(const String& urlString, const String& cookieString) = 0; 99 91 100 protected: 92 101 virtual ~PluginController() { } -
trunk/WebKit2/WebProcess/Plugins/PluginView.cpp
r68662 r68898 825 825 #endif 826 826 827 String PluginView::proxiesForURL(const String& urlString) 828 { 829 // FIXME: Implement. 830 return String(); 831 } 832 833 String PluginView::cookiesForURL(const String& urlString) 834 { 835 // FIXME: Implement. 836 return String(); 837 } 838 839 void PluginView::setCookiesForURL(const String& urlString, const String& cookieString) 840 { 841 // FIXME: Implement. 842 } 843 827 844 void PluginView::didFinishLoad(WebFrame* webFrame) 828 845 { -
trunk/WebKit2/WebProcess/Plugins/PluginView.h
r68662 r68898 128 128 virtual HWND nativeParentWindow(); 129 129 #endif 130 130 virtual String proxiesForURL(const String&); 131 virtual String cookiesForURL(const String&); 132 virtual void setCookiesForURL(const String& urlString, const String& cookieString); 133 131 134 // WebFrame::LoadListener 132 135 virtual void didFinishLoad(WebFrame*);
Note: See TracChangeset
for help on using the changeset viewer.