Changeset 207168 in webkit
- Timestamp:
- Oct 11, 2016 3:01:45 PM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r207159 r207168 1 2016-10-11 Anders Carlsson <andersca@apple.com> 2 3 Clean up WebPageGroup somewhat 4 https://bugs.webkit.org/show_bug.cgi?id=163299 5 6 Reviewed by Tim Horton. 7 8 * Shared/API/c/WKDeprecatedFunctions.cpp: 9 (WKPageGroupCopyIdentifier): 10 Move this here from WKPageGroup. 11 12 (WKPageGroupAddUserContentFilter): 13 (WKPageGroupRemoveUserContentFilter): 14 (WKPageGroupRemoveAllUserContentFilters): 15 Just call directly into the user content controller. 16 17 * UIProcess/API/C/WKPageGroup.cpp: 18 (WKPageGroupAddUserStyleSheet): 19 (WKPageGroupRemoveAllUserStyleSheets): 20 (WKPageGroupAddUserScript): 21 (WKPageGroupRemoveAllUserScripts): 22 Just call directly into the user content controller. 23 24 * UIProcess/API/C/WKPageGroup.h: 25 * UIProcess/WebPageGroup.cpp: 26 (WebKit::WebPageGroup::addUserStyleSheet): Deleted. 27 (WebKit::WebPageGroup::addUserScript): Deleted. 28 (WebKit::WebPageGroup::removeAllUserStyleSheets): Deleted. 29 (WebKit::WebPageGroup::removeAllUserScripts): Deleted. 30 (WebKit::WebPageGroup::removeAllUserContent): Deleted. 31 (WebKit::WebPageGroup::addUserContentExtension): Deleted. 32 (WebKit::WebPageGroup::removeUserContentExtension): Deleted. 33 (WebKit::WebPageGroup::removeAllUserContentExtensions): Deleted. 34 Get rid of these, all their callers just call into the user content controller now. 35 36 * UIProcess/WebPageGroup.h: 37 (WebKit::WebPageGroup::identifier): Deleted. 38 (WebKit::WebPageGroup::sendToAllProcessesInGroup): Deleted. 39 Remove unused code. 40 1 41 2016-10-11 Daniel Bates <dabates@apple.com> 2 42 -
trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp
r207149 r207168 34 34 #include "WKPreferencesRefPrivate.h" 35 35 #include "WebPageGroup.h" 36 #include "WebUserContentControllerProxy.h" 36 37 37 38 #if PLATFORM(MAC) … … 42 43 43 44 extern "C" { 45 WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup); 44 46 WK_EXPORT void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroup, WKUserContentFilterRef userContentFilter); 45 47 WK_EXPORT void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroup, WKStringRef userContentFilterName); … … 57 59 } 58 60 61 WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef) 62 { 63 return nullptr; 64 } 65 59 66 void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef userContentFilterRef) 60 67 { 61 68 #if ENABLE(CONTENT_EXTENSIONS) 62 toImpl(pageGroupRef)-> addUserContentExtension(*toImpl(userContentFilterRef));69 toImpl(pageGroupRef)->userContentController().addUserContentExtension(*toImpl(userContentFilterRef)); 63 70 #else 64 71 UNUSED_PARAM(pageGroupRef); … … 70 77 { 71 78 #if ENABLE(CONTENT_EXTENSIONS) 72 toImpl(pageGroupRef)-> removeUserContentExtension(toWTFString(userContentFilterNameRef));79 toImpl(pageGroupRef)->userContentController().removeUserContentExtension(toWTFString(userContentFilterNameRef)); 73 80 #else 74 81 UNUSED_PARAM(pageGroupRef); … … 77 84 } 78 85 79 80 86 void WKPageGroupRemoveAllUserContentFilters(WKPageGroupRef pageGroupRef) 81 87 { 82 88 #if ENABLE(CONTENT_EXTENSIONS) 83 toImpl(pageGroupRef)-> removeAllUserContentExtensions();89 toImpl(pageGroupRef)->userContentController().removeAllUserContentExtensions(); 84 90 #else 85 91 UNUSED_PARAM(pageGroupRef); -
trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp
r207149 r207168 28 28 29 29 #include "APIUserContentExtension.h" 30 #include "APIUserContentWorld.h" 31 #include "APIUserScript.h" 32 #include "APIUserStyleSheet.h" 30 33 #include "WKAPICast.h" 31 34 #include "WebPageGroup.h" … … 46 49 } 47 50 48 WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroupRef)49 {50 return toCopiedAPI(toImpl(pageGroupRef)->identifier());51 }52 53 51 void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef preferencesRef) 54 52 { … … 66 64 } 67 65 68 void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL , WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames)66 void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames) 69 67 { 70 toImpl(pageGroupRef)->addUserStyleSheet(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel); 68 auto source = toWTFString(sourceRef); 69 70 if (source.isEmpty()) 71 return; 72 73 auto baseURLString = toWTFString(baseURLRef); 74 auto whitelist = toImpl(whitelistedURLPatterns); 75 auto blacklist = toImpl(blacklistedURLPatterns); 76 77 Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURLString.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel }, API::UserContentWorld::normalWorld()); 78 79 toImpl(pageGroupRef)->userContentController().addUserStyleSheet(userStyleSheet.get()); 71 80 } 72 81 73 void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup Ref)82 void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup) 74 83 { 75 toImpl(pageGroup Ref)->removeAllUserStyleSheets();84 toImpl(pageGroup)->userContentController().removeAllUserStyleSheets(); 76 85 } 77 86 78 void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL , WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime)87 void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime) 79 88 { 80 toImpl(pageGroupRef)->addUserScript(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime)); 89 auto source = toWTFString(sourceRef); 90 91 if (source.isEmpty()) 92 return; 93 94 auto baseURLString = toWTFString(baseURLRef); 95 auto whitelist = toImpl(whitelistedURLPatterns); 96 auto blacklist = toImpl(blacklistedURLPatterns); 97 98 Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { source, (baseURLString.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserScriptInjectionTime(injectionTime), toUserContentInjectedFrames(injectedFrames) }, API::UserContentWorld::normalWorld()); 99 toImpl(pageGroupRef)->userContentController().addUserScript(userScript.get()); 81 100 } 82 101 83 102 void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroupRef) 84 103 { 85 toImpl(pageGroupRef)-> removeAllUserScripts();104 toImpl(pageGroupRef)->userContentController().removeAllUserScripts(); 86 105 } -
trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h
r207149 r207168 39 39 WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier); 40 40 41 WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup);42 43 41 WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences); 44 42 WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup); -
trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp
r197304 r207168 143 143 } 144 144 145 void WebPageGroup::addUserStyleSheet(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserStyleLevel level)146 {147 if (source.isEmpty())148 return;149 150 Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames, level }, API::UserContentWorld::normalWorld());151 m_userContentController->addUserStyleSheet(userStyleSheet.get());152 }153 154 void WebPageGroup::addUserScript(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)155 {156 if (source.isEmpty())157 return;158 159 Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames }, API::UserContentWorld::normalWorld());160 m_userContentController->addUserScript(userScript.get());161 }162 163 void WebPageGroup::removeAllUserStyleSheets()164 {165 m_userContentController->removeAllUserStyleSheets();166 }167 168 void WebPageGroup::removeAllUserScripts()169 {170 m_userContentController->removeAllUserScripts();171 }172 173 void WebPageGroup::removeAllUserContent()174 {175 m_userContentController->removeAllUserStyleSheets();176 m_userContentController->removeAllUserScripts();177 }178 179 #if ENABLE(CONTENT_EXTENSIONS)180 void WebPageGroup::addUserContentExtension(API::UserContentExtension& userContentExtension)181 {182 m_userContentController->addUserContentExtension(userContentExtension);183 }184 185 void WebPageGroup::removeUserContentExtension(const String& contentExtensionName)186 {187 m_userContentController->removeUserContentExtension(contentExtensionName);188 }189 190 void WebPageGroup::removeAllUserContentExtensions()191 {192 m_userContentController->removeAllUserContentExtensions();193 }194 #endif195 196 145 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebPageGroup.h
r197304 r207168 54 54 void removePage(WebPageProxy*); 55 55 56 const String& identifier() const { return m_data.identifier; }57 56 uint64_t pageGroupID() const { return m_data.pageGroupID; } 58 57 … … 65 64 WebUserContentControllerProxy& userContentController(); 66 65 67 void addUserStyleSheet(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserStyleLevel);68 void addUserScript(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);69 void removeAllUserStyleSheets();70 void removeAllUserScripts();71 void removeAllUserContent();72 73 #if ENABLE(CONTENT_EXTENSIONS)74 void addUserContentExtension(API::UserContentExtension&);75 void removeUserContentExtension(const String&);76 void removeAllUserContentExtensions();77 #endif78 79 66 private: 80 template<typename T> void sendToAllProcessesInGroup(const T&, uint64_t destinationID);81 82 67 WebPageGroupData m_data; 83 68 RefPtr<WebPreferences> m_preferences; … … 86 71 }; 87 72 88 template<typename T>89 void WebPageGroup::sendToAllProcessesInGroup(const T& message, uint64_t destinationID)90 {91 HashSet<WebProcessProxy*> processesSeen;92 93 for (WebPageProxy* webPageProxy : m_pages) {94 WebProcessProxy& webProcessProxy = webPageProxy->process();95 if (!processesSeen.add(&webProcessProxy).isNewEntry)96 continue;97 98 if (webProcessProxy.canSendMessage())99 webProcessProxy.send(T(message), destinationID);100 }101 }102 103 73 } // namespace WebKit 104 74
Note: See TracChangeset
for help on using the changeset viewer.