Changeset 164230 in webkit
- Timestamp:
- Feb 17, 2014 11:08:49 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 1 deleted
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r164225 r164230 1 2014-02-17 Anders Carlsson <andersca@apple.com> 2 3 Turn the history client into a fancy API::HistoryClient abstract base class 4 https://bugs.webkit.org/show_bug.cgi?id=128917 5 6 Reviewed by Andreas Kling. 7 8 * UIProcess/API/APIHistoryClient.h: Renamed from Source/WebKit2/UIProcess/WebHistoryClient.h. 9 (API::HistoryClient::~HistoryClient): 10 (API::HistoryClient::didNavigateWithNavigationData): 11 (API::HistoryClient::didPerformClientRedirect): 12 (API::HistoryClient::didPerformServerRedirect): 13 (API::HistoryClient::didUpdateHistoryTitle): 14 (API::HistoryClient::populateVisitedLinks): 15 (API::HistoryClient::shouldTrackVisitedLinks): 16 * UIProcess/API/C/WKContext.cpp: 17 (WKContextSetHistoryClient): 18 * UIProcess/WebContext.cpp: 19 (WebKit::WebContext::WebContext): 20 (WebKit::WebContext::setHistoryClient): 21 (WebKit::WebContext::createNewWebProcess): 22 (WebKit::WebContext::populateVisitedLinks): 23 * UIProcess/WebContext.h: 24 (WebKit::WebContext::historyClient): 25 * UIProcess/WebHistoryClient.cpp: Removed. 26 * UIProcess/WebPageProxy.h: 27 * UIProcess/WebProcessProxy.cpp: 28 * WebKit2.xcodeproj/project.pbxproj: 29 1 30 2014-02-17 Dan Bernstein <mitz@apple.com> 2 31 -
trunk/Source/WebKit2/UIProcess/API/APIHistoryClient.h
r164229 r164230 1 1 /* 2 * Copyright (C) 201 0Apple Inc. All rights reserved.2 * Copyright (C) 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef WebHistoryClient_h27 #define WebHistoryClient_h26 #ifndef APIHistoryClient_h 27 #define APIHistoryClient_h 28 28 29 #include "APIClient.h"30 #include "WKContext.h"31 29 #include <wtf/Forward.h> 32 30 33 namespace API {34 template<> struct ClientTraits<WKContextHistoryClientBase> {35 typedef std::tuple<WKContextHistoryClientV0> Versions;36 };37 }38 39 31 namespace WebKit { 40 41 32 class WebContext; 42 33 class WebFrameProxy; 43 34 class WebPageProxy; 44 35 struct WebNavigationDataStore; 36 } 45 37 46 class WebHistoryClient : public API::Client<WKContextHistoryClientBase> { 38 namespace API { 39 40 class HistoryClient { 47 41 public: 48 void didNavigateWithNavigationData(WebContext*, WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*); 49 void didPerformClientRedirect(WebContext*, WebPageProxy*, const String& sourceURL, const String& destinationURL, WebFrameProxy*); 50 void didPerformServerRedirect(WebContext*, WebPageProxy*, const String& sourceURL, const String& destinationURL, WebFrameProxy*); 51 void didUpdateHistoryTitle(WebContext*, WebPageProxy*, const String& title, const String& url, WebFrameProxy*); 52 void populateVisitedLinks(WebContext*); 42 virtual ~HistoryClient() { } 53 43 54 bool shouldTrackVisitedLinks() const { return m_client.populateVisitedLinks; } 44 virtual void didNavigateWithNavigationData(WebKit::WebContext*, WebKit::WebPageProxy*, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy*) { } 45 virtual void didPerformClientRedirect(WebKit::WebContext*, WebKit::WebPageProxy*, const WTF::String& sourceURL, const WTF::String& destinationURL, WebKit::WebFrameProxy*) { } 46 virtual void didPerformServerRedirect(WebKit::WebContext*, WebKit::WebPageProxy*, const WTF::String& sourceURL, const WTF::String& destinationURL, WebKit::WebFrameProxy*) { } 47 virtual void didUpdateHistoryTitle(WebKit::WebContext*, WebKit::WebPageProxy*, const WTF::String& title, const WTF::String& url, WebKit::WebFrameProxy*) { } 48 virtual void populateVisitedLinks(WebKit::WebContext*) { } 49 virtual bool shouldTrackVisitedLinks() const { return false; } 55 50 }; 56 51 57 } // namespace WebKit52 } // namespace API 58 53 59 #endif // WebHistoryClient_h54 #endif // APIHistoryClient_h -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp
r163121 r164230 25 25 26 26 #include "config.h" 27 #include "WKContext.h"28 27 #include "WKContextPrivate.h" 29 28 29 #include "APIClient.h" 30 #include "APIHistoryClient.h" 31 #include "APINavigationData.h" 30 32 #include "APIURLRequest.h" 31 33 #include "WKAPICast.h" … … 54 56 #endif 55 57 58 namespace API { 59 template<> struct ClientTraits<WKContextHistoryClientBase> { 60 typedef std::tuple<WKContextHistoryClientV0> Versions; 61 }; 62 } 63 56 64 using namespace WebKit; 57 65 … … 85 93 void WKContextSetHistoryClient(WKContextRef contextRef, const WKContextHistoryClientBase* wkClient) 86 94 { 87 toImpl(contextRef)->initializeHistoryClient(wkClient); 95 class HistoryClient final : public API::Client<WKContextHistoryClientBase>, public API::HistoryClient { 96 public: 97 explicit HistoryClient(const WKContextHistoryClientBase* client) 98 { 99 initialize(client); 100 } 101 102 private: 103 virtual void didNavigateWithNavigationData(WebContext* context, WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame) override 104 { 105 if (!m_client.didNavigateWithNavigationData) 106 return; 107 108 RefPtr<API::NavigationData> navigationData = API::NavigationData::create(navigationDataStore); 109 m_client.didNavigateWithNavigationData(toAPI(context), toAPI(page), toAPI(navigationData.get()), toAPI(frame), m_client.base.clientInfo); 110 } 111 112 virtual void didPerformClientRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) override 113 { 114 if (!m_client.didPerformClientRedirect) 115 return; 116 117 m_client.didPerformClientRedirect(toAPI(context), toAPI(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(frame), m_client.base.clientInfo); 118 } 119 120 virtual void didPerformServerRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) override 121 { 122 if (!m_client.didPerformServerRedirect) 123 return; 124 125 m_client.didPerformServerRedirect(toAPI(context), toAPI(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(frame), m_client.base.clientInfo); 126 } 127 128 virtual void didUpdateHistoryTitle(WebContext* context, WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame) override 129 { 130 if (!m_client.didUpdateHistoryTitle) 131 return; 132 133 m_client.didUpdateHistoryTitle(toAPI(context), toAPI(page), toAPI(title.impl()), toURLRef(url.impl()), toAPI(frame), m_client.base.clientInfo); 134 } 135 136 virtual void populateVisitedLinks(WebContext* context) override 137 { 138 if (!m_client.populateVisitedLinks) 139 return; 140 141 m_client.populateVisitedLinks(toAPI(context), m_client.base.clientInfo); 142 } 143 144 virtual bool shouldTrackVisitedLinks() const 145 { 146 return m_client.populateVisitedLinks; 147 } 148 }; 149 150 toImpl(contextRef)->setHistoryClient(std::make_unique<HistoryClient>(wkClient)); 88 151 } 89 152 -
trunk/Source/WebKit2/UIProcess/WebContext.cpp
r164172 r164230 28 28 29 29 #include "APIArray.h" 30 #include "APIHistoryClient.h" 30 31 #include "DownloadProxy.h" 31 32 #include "DownloadProxyMessages.h" … … 136 137 , m_defaultPageGroup(WebPageGroup::createNonNull()) 137 138 , m_injectedBundlePath(injectedBundlePath) 139 , m_historyClient(std::make_unique<API::HistoryClient>()) 138 140 , m_visitedLinkProvider(this) 139 141 , m_plugInAutoStartProvider(this) … … 270 272 } 271 273 272 void WebContext::initializeHistoryClient(const WKContextHistoryClientBase* client) 273 { 274 m_historyClient.initialize(client); 275 276 sendToAllProcesses(Messages::WebProcess::SetShouldTrackVisitedLinks(m_historyClient.shouldTrackVisitedLinks())); 274 void WebContext::setHistoryClient(std::unique_ptr<API::HistoryClient> historyClient) 275 { 276 if (!historyClient) 277 m_historyClient = std::make_unique<API::HistoryClient>(); 278 else 279 m_historyClient = std::move(historyClient); 280 281 sendToAllProcesses(Messages::WebProcess::SetShouldTrackVisitedLinks(m_historyClient->shouldTrackVisitedLinks())); 277 282 } 278 283 … … 566 571 parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession; 567 572 568 parameters.shouldTrackVisitedLinks = m_historyClient .shouldTrackVisitedLinks();573 parameters.shouldTrackVisitedLinks = m_historyClient->shouldTrackVisitedLinks(); 569 574 parameters.cacheModel = m_cacheModel; 570 575 parameters.languages = userPreferredLanguages(); … … 839 844 void WebContext::populateVisitedLinks() 840 845 { 841 m_historyClient .populateVisitedLinks(this);846 m_historyClient->populateVisitedLinks(this); 842 847 } 843 848 -
trunk/Source/WebKit2/UIProcess/WebContext.h
r164172 r164230 43 43 #include "WebContextInjectedBundleClient.h" 44 44 #include "WebDownloadClient.h" 45 #include "WebHistoryClient.h"46 45 #include "WebProcessProxy.h" 47 46 #include <WebCore/LinkHash.h> … … 66 65 OBJC_CLASS NSString; 67 66 #endif 67 68 namespace API { 69 class HistoryClient; 70 } 68 71 69 72 namespace WebKit { … … 129 132 void initializeInjectedBundleClient(const WKContextInjectedBundleClientBase*); 130 133 void initializeConnectionClient(const WKContextConnectionClientBase*); 131 void initializeHistoryClient(const WKContextHistoryClientBase*);134 void setHistoryClient(std::unique_ptr<API::HistoryClient>); 132 135 void initializeDownloadClient(const WKContextDownloadClientBase*); 133 136 … … 218 221 WebDownloadClient& downloadClient() { return m_downloadClient; } 219 222 220 WebHistoryClient& historyClient() { returnm_historyClient; }223 API::HistoryClient& historyClient() { return *m_historyClient; } 221 224 WebContextClient& client() { return m_client; } 222 225 … … 441 444 WebContextConnectionClient m_connectionClient; 442 445 WebDownloadClient m_downloadClient; 443 WebHistoryClientm_historyClient;446 std::unique_ptr<API::HistoryClient> m_historyClient; 444 447 445 448 #if ENABLE(NETSCAPE_PLUGIN_API) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r164172 r164230 51 51 #include "WebFormClient.h" 52 52 #include "WebFrameProxy.h" 53 #include "WebHistoryClient.h"54 53 #include "WebHitTestResult.h" 55 54 #include "WebPageContextMenuClient.h" -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r164172 r164230 28 28 29 29 #include "APIFrameHandle.h" 30 #include "APIHistoryClient.h" 30 31 #include "CustomProtocolManagerProxyMessages.h" 31 32 #include "DataReference.h" -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r164172 r164230 200 200 1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */; }; 201 201 1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */; }; 202 1A6637D718B2831F00C0BCF3 /* APIHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6637D618B2831F00C0BCF3 /* APIHistoryClient.h */; }; 202 203 1A66BF8F18A052ED002071B4 /* WKWebViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */; }; 203 204 1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; }; … … 1324 1325 BCF4DE25168FA44800C94AFC /* WebContextSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF4DE24168FA44800C94AFC /* WebContextSupplement.h */; }; 1325 1326 BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF50726124329AA005955AE /* WebCertificateInfo.h */; }; 1326 BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */; };1327 BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F851176CD6F00471A52 /* WebHistoryClient.h */; };1328 1327 BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69F981176CED600471A52 /* WebNavigationDataStore.h */; }; 1329 1328 BCF69FA21176D01400471A52 /* APINavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA01176D01400471A52 /* APINavigationData.h */; }; … … 1871 1870 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateInfo.h; sourceTree = "<group>"; }; 1872 1871 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateInfo.cpp; sourceTree = "<group>"; }; 1872 1A6637D618B2831F00C0BCF3 /* APIHistoryClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIHistoryClient.h; sourceTree = "<group>"; }; 1873 1873 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewInternal.h; sourceTree = "<group>"; }; 1874 1874 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandLine.h; sourceTree = "<group>"; }; … … 3106 3106 BCF5068412431861005955AE /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; }; 3107 3107 BCF50726124329AA005955AE /* WebCertificateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCertificateInfo.h; sourceTree = "<group>"; }; 3108 BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebHistoryClient.cpp; sourceTree = "<group>"; };3109 BCF69F851176CD6F00471A52 /* WebHistoryClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryClient.h; sourceTree = "<group>"; };3110 3108 BCF69F981176CED600471A52 /* WebNavigationDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNavigationDataStore.h; sourceTree = "<group>"; }; 3111 3109 BCF69FA01176D01400471A52 /* APINavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APINavigationData.h; sourceTree = "<group>"; }; … … 5126 5124 BC1BE1F112D54DBD0004A228 /* WebGeolocationProvider.cpp */, 5127 5125 BC1BE1F012D54DBD0004A228 /* WebGeolocationProvider.h */, 5128 BCF69F841176CD6F00471A52 /* WebHistoryClient.cpp */,5129 BCF69F851176CD6F00471A52 /* WebHistoryClient.h */,5130 5126 511B24A8132E097200065A0C /* WebIconDatabase.cpp */, 5131 5127 511B24A9132E097200065A0C /* WebIconDatabase.h */, … … 5173 5169 isa = PBXGroup; 5174 5170 children = ( 5175 2DA944771884E3AB00ED86DB /* ios */,5176 5171 BC0C376610F807660076D7CB /* C */, 5177 5172 37C4C08318149C2A003688B9 /* Cocoa */, 5178 5173 BC8A501311765F4500757573 /* cpp */, 5174 2DA944771884E3AB00ED86DB /* ios */, 5179 5175 BC111B47112F616900337BAB /* mac */, 5176 1A6637D618B2831F00C0BCF3 /* APIHistoryClient.h */, 5180 5177 1A2464F21891E45100234C5B /* APILoaderClient.h */, 5181 5178 1AFDD3141891B54000153970 /* APIPolicyClient.h */, … … 6364 6361 935EEBA2127761D0003322B8 /* InjectedBundleBackForwardList.h in Headers */, 6365 6362 935EEBA4127761D6003322B8 /* InjectedBundleBackForwardListItem.h in Headers */, 6363 1A6637D718B2831F00C0BCF3 /* APIHistoryClient.h in Headers */, 6366 6364 BCEE7DC5128B645D009827DA /* InjectedBundleClient.h in Headers */, 6367 6365 BC498618124D10E200D834E1 /* InjectedBundleHitTestResult.h in Headers */, … … 6640 6638 BC1BE1F212D54DBD0004A228 /* WebGeolocationProvider.h in Headers */, 6641 6639 0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */, 6642 BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */,6643 6640 1A4D664818A2D91A00D82E21 /* APIUIClient.h in Headers */, 6644 6641 7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */, … … 8050 8047 BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */, 8051 8048 BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */, 8052 BCF69F861176CD6F00471A52 /* WebHistoryClient.cpp in Sources */,8053 8049 7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */, 8054 8050 511B24AA132E097200065A0C /* WebIconDatabase.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.