Changeset 64247 in webkit
- Timestamp:
- Jul 28, 2010 5:41:12 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r64246 r64247 1 2010-07-28 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin Adler. 4 5 First pass at visited link support for WK2 6 https://bugs.webkit.org/show_bug.cgi?id=43157 7 8 * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: 9 (WebPageProxyMessage::): 10 * Shared/CoreIPCSupport/WebProcessMessageKinds.h: 11 (WebProcessMessage::): 12 * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h: 13 (WebProcessProxyMessage::): 14 15 Move HistoryClient support from the page...: 16 * UIProcess/API/C/WKPage.cpp: 17 * UIProcess/API/C/WKPage.h: 18 19 ...to the Context 20 * UIProcess/API/C/WKContext.cpp: 21 (WKContextSetHistoryClient): 22 * UIProcess/API/C/WKContext.h: 23 24 * UIProcess/WebContext.cpp: 25 (WebKit::WebContext::initializeHistoryClient): 26 (WebKit::WebContext::ensureWebProcess): When a new WebProcess is created, set its "should track visited links" mode. 27 (WebKit::WebContext::didNavigateWithNavigationData): 28 (WebKit::WebContext::didPerformClientRedirect): 29 (WebKit::WebContext::didPerformServerRedirect): 30 (WebKit::WebContext::didUpdateHistoryTitle): 31 (WebKit::WebContext::populateVisitedLinks): 32 * UIProcess/WebContext.h: 33 (WebKit::WebContext::hasValidProcess): 34 35 * UIProcess/WebHistoryClient.cpp: 36 (WebKit::WebHistoryClient::initialize): 37 (WebKit::WebHistoryClient::didNavigateWithNavigationData): 38 (WebKit::WebHistoryClient::didPerformClientRedirect): 39 (WebKit::WebHistoryClient::didPerformServerRedirect): 40 (WebKit::WebHistoryClient::didUpdateHistoryTitle): 41 (WebKit::WebHistoryClient::populateVisitedLinks): 42 * UIProcess/WebHistoryClient.h: 43 (WebKit::WebHistoryClient::shouldTrackVisitedLinks): 44 45 * UIProcess/WebPageProxy.cpp: 46 (WebKit::WebPageProxy::didReceiveMessage): 47 * UIProcess/WebPageProxy.h: 48 49 * UIProcess/WebProcessProxy.cpp: 50 (WebKit::WebProcessProxy::didReceiveMessage): 51 (WebKit::WebProcessProxy::didReceiveSyncMessage): 52 53 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 54 (WebKit::WebChromeClient::populateVisitedLinks): 55 56 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 57 (WebKit::WebFrameLoaderClient::updateGlobalHistory): 58 (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): 59 (WebKit::WebFrameLoaderClient::setTitle): 60 61 * WebProcess/WebProcess.cpp: 62 (WebKit::WebProcess::didReceiveMessage): 63 1 64 2010-07-28 Anders Carlsson <andersca@apple.com> 2 65 -
trunk/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
r64065 r64247 55 55 DidFirstVisuallyNonEmptyLayoutForFrame, 56 56 DidGetRenderTreeExternalRepresentation, 57 DidNavigateWithNavigationData,58 DidPerformClientRedirect,59 DidPerformServerRedirect,60 57 DidReceiveEvent, 61 58 DidReceiveServerRedirectForProvisionalLoadForFrame, … … 65 62 DidStartProgress, 66 63 DidStartProvisionalLoadForFrame, 67 DidUpdateHistoryTitle,68 64 SetCursor, 69 65 SetToolTip, -
trunk/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
r64070 r64247 36 36 LoadInjectedBundle, 37 37 SetApplicationCacheDirectory, 38 SetShouldTrackVisitedLinks, 38 39 Create, 39 40 PostMessage, -
trunk/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
r63362 r64247 35 35 enum Kind { 36 36 AddBackForwardItem, 37 DidNavigateWithNavigationData, 38 DidPerformClientRedirect, 39 DidPerformServerRedirect, 40 DidUpdateHistoryTitle, 37 41 GetPluginHostConnection, 38 42 GetPlugins, 43 PopulateVisitedLinks, 39 44 PostMessage, 40 45 }; -
trunk/WebKit2/UIProcess/API/C/WKContext.cpp
r64232 r64247 74 74 } 75 75 76 void WKContextSetHistoryClient(WKContextRef contextRef, WKContextHistoryClient * wkClient) 77 { 78 if (wkClient && !wkClient->version) 79 toWK(contextRef)->initializeHistoryClient(wkClient); 80 } 81 76 82 void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef messageRef) 77 83 { -
trunk/WebKit2/UIProcess/API/C/WKContext.h
r64029 r64247 43 43 typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient; 44 44 45 // History Client 46 typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo); 47 typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); 48 typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); 49 typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo); 50 typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo); 51 52 struct WKContextHistoryClient { 53 int version; 54 const void * clientInfo; 55 WKContextDidNavigateWithNavigationDataCallback didNavigateWithNavigationData; 56 WKContextDidPerformClientRedirectCallback didPerformClientRedirect; 57 WKContextDidPerformServerRedirectCallback didPerformServerRedirect; 58 WKContextDidUpdateHistoryTitleCallback didUpdateHistoryTitle; 59 WKContextPopulateVisitedLinksCallback populateVisitedLinks; 60 }; 61 typedef struct WKContextHistoryClient WKContextHistoryClient; 62 45 63 WK_EXPORT WKContextRef WKContextCreate(); 46 64 WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path); … … 50 68 WK_EXPORT WKPreferencesRef WKContextGetPreferences(WKContextRef context); 51 69 70 WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, WKContextHistoryClient * client); 52 71 WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, WKContextInjectedBundleClient * client); 53 72 -
trunk/WebKit2/UIProcess/API/C/WKPage.cpp
r64232 r64247 145 145 } 146 146 147 void WKPageSetPageHistoryClient(WKPageRef pageRef, WKPageHistoryClient * wkClient)148 {149 if (wkClient && !wkClient->version)150 toWK(pageRef)->initializeHistoryClient(wkClient);151 }152 153 147 void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback, WKPageRunJavaScriptDisposeFunction disposeFunction) 154 148 { -
trunk/WebKit2/UIProcess/API/C/WKPage.h
r64172 r64247 134 134 typedef struct WKPageUIClient WKPageUIClient; 135 135 136 // History Client137 typedef void (*WKPageDidNavigateWithNavigationDataCallback)(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);138 typedef void (*WKPageDidPerformClientRedirectCallback)(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);139 typedef void (*WKPageDidPerformServerRedirectCallback)(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);140 typedef void (*WKPageDidUpdateHistoryTitleCallback)(WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo);141 142 struct WKPageHistoryClient {143 int version;144 const void * clientInfo;145 WKPageDidNavigateWithNavigationDataCallback didNavigateWithNavigationData;146 WKPageDidPerformClientRedirectCallback didPerformClientRedirect;147 WKPageDidPerformServerRedirectCallback didPerformServerRedirect;148 WKPageDidUpdateHistoryTitleCallback didUpdateHistoryTitle;149 };150 typedef struct WKPageHistoryClient WKPageHistoryClient;151 152 153 136 WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page); 154 137 … … 179 162 WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, WKPagePolicyClient * client); 180 163 WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, WKPageUIClient * client); 181 WK_EXPORT void WKPageSetPageHistoryClient(WKPageRef page, WKPageHistoryClient * client);182 164 183 165 typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, void*); -
trunk/WebKit2/UIProcess/WebContext.cpp
r64232 r64247 89 89 } 90 90 91 void WebContext::initializeHistoryClient(WKContextHistoryClient* client) 92 { 93 m_historyClient.initialize(client); 94 95 if (!hasValidProcess()) 96 return; 97 98 m_process->send(WebProcessMessage::SetShouldTrackVisitedLinks, 0, CoreIPC::In(m_historyClient.shouldTrackVisitedLinks())); 99 } 100 91 101 void WebContext::ensureWebProcess() 92 102 { 93 if ( m_process && m_process->isValid())103 if (hasValidProcess()) 94 104 return; 95 105 96 106 m_process = WebProcessManager::shared().getWebProcess(this); 107 108 m_process->send(WebProcessMessage::SetShouldTrackVisitedLinks, 0, CoreIPC::In(m_historyClient.shouldTrackVisitedLinks())); 97 109 } 98 110 … … 166 178 } 167 179 180 // HistoryClient 181 182 void WebContext::didNavigateWithNavigationData(WebFrameProxy* frame, const WebNavigationDataStore& store) 183 { 184 ASSERT(frame->page()); 185 m_historyClient.didNavigateWithNavigationData(this, frame->page(), store, frame); 186 } 187 188 void WebContext::didPerformClientRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString) 189 { 190 ASSERT(frame->page()); 191 m_historyClient.didPerformClientRedirect(this, frame->page(), sourceURLString, destinationURLString, frame); 192 } 193 194 void WebContext::didPerformServerRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString) 195 { 196 ASSERT(frame->page()); 197 m_historyClient.didPerformServerRedirect(this, frame->page(), sourceURLString, destinationURLString, frame); 198 } 199 200 void WebContext::didUpdateHistoryTitle(WebFrameProxy* frame, const String& title, const String& url) 201 { 202 ASSERT(frame->page()); 203 m_historyClient.didUpdateHistoryTitle(this, frame->page(), title, url, frame); 204 } 205 206 void WebContext::populateVisitedLinks() 207 { 208 m_historyClient.populateVisitedLinks(this); 209 } 210 168 211 void WebContext::getStatistics(WKContextStatistics* statistics) 169 212 { -
trunk/WebKit2/UIProcess/WebContext.h
r64232 r64247 31 31 #include "ProcessModel.h" 32 32 #include "WebContextInjectedBundleClient.h" 33 #include "WebHistoryClient.h" 34 #include "WebProcessProxy.h" 33 35 #include <WebCore/PlatformString.h> 34 36 #include <wtf/Forward.h> … … 44 46 class WebPageProxy; 45 47 class WebPreferences; 46 class WebProcessProxy;47 48 48 49 class WebContext : public APIObject { … … 59 60 60 61 void initializeInjectedBundleClient(WKContextInjectedBundleClient*); 62 void initializeHistoryClient(WKContextHistoryClient*); 61 63 62 64 ProcessModel processModel() const { return m_processModel; } … … 78 80 // InjectedBundle client 79 81 void didReceiveMessageFromInjectedBundle(const WebCore::String&); 80 81 82 void postMessageToInjectedBundle(const WebCore::String&); 82 83 84 // History client 85 void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&); 86 void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString); 87 void didPerformServerRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString); 88 void didUpdateHistoryTitle(WebFrameProxy*, const WebCore::String& title, const WebCore::String& url); 89 void populateVisitedLinks(); 90 83 91 void getStatistics(WKContextStatistics* statistics); 84 92 void setAdditionalPluginPath(const WebCore::String&); … … 93 101 94 102 void ensureWebProcess(); 103 bool hasValidProcess() const { return m_process && m_process->isValid(); } 95 104 96 105 ProcessModel m_processModel; … … 105 114 WebContextInjectedBundleClient m_injectedBundleClient; 106 115 116 WebHistoryClient m_historyClient; 117 107 118 PluginInfoStore m_pluginInfoStore; 108 119 }; -
trunk/WebKit2/UIProcess/WebHistoryClient.cpp
r57676 r64247 39 39 } 40 40 41 void WebHistoryClient::initialize(WK PageHistoryClient* client)41 void WebHistoryClient::initialize(WKContextHistoryClient* client) 42 42 { 43 43 if (client && !client->version) 44 m_ pageHistoryClient = *client;44 m_contextHistoryClient = *client; 45 45 else 46 memset(&m_ pageHistoryClient, 0, sizeof(m_pageHistoryClient));46 memset(&m_contextHistoryClient, 0, sizeof(m_contextHistoryClient)); 47 47 } 48 48 49 void WebHistoryClient::didNavigateWithNavigationData(Web PageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame)49 void WebHistoryClient::didNavigateWithNavigationData(WebContext* context, WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame) 50 50 { 51 if (!m_ pageHistoryClient.didNavigateWithNavigationData)51 if (!m_contextHistoryClient.didNavigateWithNavigationData) 52 52 return; 53 53 54 54 RefPtr<WebNavigationData> navigationData = WebNavigationData::create(navigationDataStore); 55 m_ pageHistoryClient.didNavigateWithNavigationData(toRef(page), toRef(navigationData.get()), toRef(frame), m_pageHistoryClient.clientInfo);55 m_contextHistoryClient.didNavigateWithNavigationData(toRef(context), toRef(page), toRef(navigationData.get()), toRef(frame), m_contextHistoryClient.clientInfo); 56 56 } 57 57 58 void WebHistoryClient::didPerformClientRedirect(Web PageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)58 void WebHistoryClient::didPerformClientRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) 59 59 { 60 if (!m_ pageHistoryClient.didPerformClientRedirect)60 if (!m_contextHistoryClient.didPerformClientRedirect) 61 61 return; 62 62 63 m_ pageHistoryClient.didPerformClientRedirect(toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_pageHistoryClient.clientInfo);63 m_contextHistoryClient.didPerformClientRedirect(toRef(context), toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_contextHistoryClient.clientInfo); 64 64 } 65 65 66 void WebHistoryClient::didPerformServerRedirect(Web PageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)66 void WebHistoryClient::didPerformServerRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame) 67 67 { 68 if (!m_ pageHistoryClient.didPerformServerRedirect)68 if (!m_contextHistoryClient.didPerformServerRedirect) 69 69 return; 70 70 71 m_ pageHistoryClient.didPerformServerRedirect(toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_pageHistoryClient.clientInfo);71 m_contextHistoryClient.didPerformServerRedirect(toRef(context), toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_contextHistoryClient.clientInfo); 72 72 } 73 73 74 void WebHistoryClient::didUpdateHistoryTitle(Web PageProxy* page, const String& title, const String& url, WebFrameProxy* frame)74 void WebHistoryClient::didUpdateHistoryTitle(WebContext* context, WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame) 75 75 { 76 if (!m_ pageHistoryClient.didUpdateHistoryTitle)76 if (!m_contextHistoryClient.didUpdateHistoryTitle) 77 77 return; 78 78 79 m_pageHistoryClient.didUpdateHistoryTitle(toRef(page), toRef(title.impl()), toURLRef(url.impl()), toRef(frame), m_pageHistoryClient.clientInfo); 79 m_contextHistoryClient.didUpdateHistoryTitle(toRef(context), toRef(page), toRef(title.impl()), toURLRef(url.impl()), toRef(frame), m_contextHistoryClient.clientInfo); 80 } 81 82 void WebHistoryClient::populateVisitedLinks(WebContext* context) 83 { 84 if (!m_contextHistoryClient.populateVisitedLinks) 85 return; 86 87 m_contextHistoryClient.populateVisitedLinks(toRef(context), m_contextHistoryClient.clientInfo); 80 88 } 81 89 -
trunk/WebKit2/UIProcess/WebHistoryClient.h
r61563 r64247 27 27 #define WebHistoryClient_h 28 28 29 #include "WK Page.h"29 #include "WKContext.h" 30 30 31 31 namespace WebCore { … … 35 35 namespace WebKit { 36 36 37 class WebContext; 37 38 class WebFrameProxy; 38 39 struct WebNavigationDataStore; … … 42 43 public: 43 44 WebHistoryClient(); 44 void initialize(WK PageHistoryClient*);45 void initialize(WKContextHistoryClient*); 45 46 46 void didNavigateWithNavigationData(WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*); 47 void didPerformClientRedirect(WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*); 48 void didPerformServerRedirect(WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*); 49 void didUpdateHistoryTitle(WebPageProxy*, const WebCore::String& title, const WebCore::String& url, WebFrameProxy*); 47 void didNavigateWithNavigationData(WebContext*, WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*); 48 void didPerformClientRedirect(WebContext*, WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*); 49 void didPerformServerRedirect(WebContext*, WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*); 50 void didUpdateHistoryTitle(WebContext*, WebPageProxy*, const WebCore::String& title, const WebCore::String& url, WebFrameProxy*); 51 void populateVisitedLinks(WebContext*); 50 52 53 bool shouldTrackVisitedLinks() const { return m_contextHistoryClient.populateVisitedLinks; } 54 51 55 private: 52 WK PageHistoryClient m_pageHistoryClient;56 WKContextHistoryClient m_contextHistoryClient; 53 57 }; 54 58 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r64155 r64247 34 34 #include "WebCoreArgumentCoders.h" 35 35 #include "WebEvent.h" 36 #include "WebNavigationDataStore.h"37 36 #include "WebPageMessageKinds.h" 38 37 #include "WebPageNamespace.h" … … 124 123 } 125 124 126 void WebPageProxy::initializeHistoryClient(WKPageHistoryClient* client)127 {128 m_historyClient.initialize(client);129 }130 131 125 void WebPageProxy::revive() 132 126 { … … 566 560 case WebPageProxyMessage::ClosePage: { 567 561 closePage(); 568 break;569 }570 case WebPageProxyMessage::DidNavigateWithNavigationData: {571 WebNavigationDataStore store;572 uint64_t frameID;573 if (!arguments.decode(CoreIPC::Out(store, frameID)))574 return;575 didNavigateWithNavigationData(webFrame(frameID), store);576 break;577 }578 case WebPageProxyMessage::DidPerformClientRedirect: {579 String sourceURLString;580 String destinationURLString;581 uint64_t frameID;582 if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))583 return;584 didPerformClientRedirect(webFrame(frameID), sourceURLString, destinationURLString);585 break;586 }587 case WebPageProxyMessage::DidPerformServerRedirect: {588 String sourceURLString;589 String destinationURLString;590 uint64_t frameID;591 if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))592 return;593 didPerformServerRedirect(webFrame(frameID), sourceURLString, destinationURLString);594 break;595 }596 case WebPageProxyMessage::DidUpdateHistoryTitle: {597 String title;598 String url;599 uint64_t frameID;600 if (!arguments.decode(CoreIPC::Out(title, url, frameID)))601 return;602 didUpdateHistoryTitle(webFrame(frameID), title, url);603 562 break; 604 563 } … … 866 825 } 867 826 868 // HistoryClient869 870 void WebPageProxy::didNavigateWithNavigationData(WebFrameProxy* frame, const WebNavigationDataStore& store)871 {872 m_historyClient.didNavigateWithNavigationData(this, store, frame);873 }874 875 void WebPageProxy::didPerformClientRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)876 {877 m_historyClient.didPerformClientRedirect(this, sourceURLString, destinationURLString, frame);878 }879 880 void WebPageProxy::didPerformServerRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)881 {882 m_historyClient.didPerformServerRedirect(this, sourceURLString, destinationURLString, frame);883 }884 885 void WebPageProxy::didUpdateHistoryTitle(WebFrameProxy* frame, const String& title, const String& url)886 {887 m_historyClient.didUpdateHistoryTitle(this, title, url, frame);888 }889 890 827 // BackForwardList 891 828 -
trunk/WebKit2/UIProcess/WebPageProxy.h
r64232 r64247 93 93 void initializePolicyClient(WKPagePolicyClient*); 94 94 void initializeUIClient(WKPageUIClient*); 95 void initializeHistoryClient(WKPageHistoryClient*);96 95 97 96 void revive(); … … 191 190 WebCore::String runJavaScriptPrompt(WebFrameProxy* frame, const WebCore::String&, const WebCore::String&); 192 191 193 void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&);194 void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);195 void didPerformServerRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);196 void didUpdateHistoryTitle(WebFrameProxy*, const WebCore::String& title, const WebCore::String& url);197 198 192 void addItemToBackForwardList(WebBackForwardListItem*); 199 193 void goToItemInBackForwardList(WebBackForwardListItem*); … … 215 209 WebPolicyClient m_policyClient; 216 210 WebUIClient m_uiClient; 217 WebHistoryClient m_historyClient;218 211 219 212 OwnPtr<DrawingAreaProxy> m_drawingArea; -
trunk/WebKit2/UIProcess/WebProcessProxy.cpp
r64029 r64247 30 30 #include "WebBackForwardListItem.h" 31 31 #include "WebContext.h" 32 #include "WebNavigationDataStore.h" 32 33 #include "WebPageNamespace.h" 33 34 #include "WebPageProxy.h" … … 244 245 } 245 246 247 case WebProcessProxyMessage::DidNavigateWithNavigationData: { 248 uint64_t pageID; 249 WebNavigationDataStore store; 250 uint64_t frameID; 251 if (!arguments->decode(CoreIPC::Out(pageID, store, frameID))) 252 return; 253 254 WebPageProxy* page = webPage(pageID); 255 if (!page) 256 return; 257 258 m_context->didNavigateWithNavigationData(page->webFrame(frameID), store); 259 break; 260 } 261 case WebProcessProxyMessage::DidPerformClientRedirect: { 262 uint64_t pageID; 263 String sourceURLString; 264 String destinationURLString; 265 uint64_t frameID; 266 if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID))) 267 return; 268 269 WebPageProxy* page = webPage(pageID); 270 if (!page) 271 return; 272 273 m_context->didPerformClientRedirect(page->webFrame(frameID), sourceURLString, destinationURLString); 274 break; 275 } 276 case WebProcessProxyMessage::DidPerformServerRedirect: { 277 uint64_t pageID; 278 String sourceURLString; 279 String destinationURLString; 280 uint64_t frameID; 281 if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID))) 282 return; 283 284 WebPageProxy* page = webPage(pageID); 285 if (!page) 286 return; 287 288 m_context->didPerformServerRedirect(page->webFrame(frameID), sourceURLString, destinationURLString); 289 break; 290 } 291 case WebProcessProxyMessage::DidUpdateHistoryTitle: { 292 uint64_t pageID; 293 String title; 294 String url; 295 uint64_t frameID; 296 if (!arguments->decode(CoreIPC::Out(pageID, title, url, frameID))) 297 return; 298 299 WebPageProxy* page = webPage(pageID); 300 if (!page) 301 return; 302 303 m_context->didUpdateHistoryTitle(page->webFrame(frameID), title, url); 304 break; 305 } 306 case WebProcessProxyMessage::PopulateVisitedLinks: { 307 m_context->populateVisitedLinks(); 308 break; 309 } 310 246 311 // These are synchronous messages and should never be handled here. 247 312 case WebProcessProxyMessage::GetPlugins: … … 296 361 297 362 // These are asynchronous messages and should never be handled here. 363 case WebProcessProxyMessage::DidNavigateWithNavigationData: 364 case WebProcessProxyMessage::DidPerformClientRedirect: 365 case WebProcessProxyMessage::DidPerformServerRedirect: 366 case WebProcessProxyMessage::DidUpdateHistoryTitle: 367 case WebProcessProxyMessage::PopulateVisitedLinks: 298 368 case WebProcessProxyMessage::PostMessage: 299 369 case WebProcessProxyMessage::AddBackForwardItem: -
trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r64065 r64247 37 37 #include "WebPreferencesStore.h" 38 38 #include "WebProcess.h" 39 #include "WebProcessProxyMessageKinds.h" 39 40 #include <WebCore/FileChooser.h> 40 41 #include <WebCore/Frame.h> … … 386 387 void WebChromeClient::populateVisitedLinks() 387 388 { 388 notImplemented();389 WebProcess::shared().connection()->send(WebProcessProxyMessage::PopulateVisitedLinks, 0, CoreIPC::In()); 389 390 } 390 391 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r63866 r64247 547 547 data.title = loader->title(); 548 548 549 WebProcess::shared().connection()->send(WebP ageProxyMessage::DidNavigateWithNavigationData,550 webPage->pageID(),551 CoreIPC::In( data, m_frame->frameID()));549 WebProcess::shared().connection()->send(WebProcessProxyMessage::DidNavigateWithNavigationData, 550 0, 551 CoreIPC::In(webPage->pageID(), data, m_frame->frameID())); 552 552 } 553 553 … … 563 563 // Client redirect 564 564 if (!loader->clientRedirectSourceForHistory().isNull()) { 565 WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformClientRedirect, 566 webPage->pageID(), 567 CoreIPC::In(loader->clientRedirectSourceForHistory(), 565 WebProcess::shared().connection()->send(WebProcessProxyMessage::DidPerformClientRedirect, 566 0, 567 CoreIPC::In(webPage->pageID(), 568 loader->clientRedirectSourceForHistory(), 568 569 loader->clientRedirectDestinationForHistory(), 569 570 m_frame->frameID())); … … 572 573 // Server redirect 573 574 if (!loader->serverRedirectSourceForHistory().isNull()) { 574 WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformServerRedirect, 575 webPage->pageID(), 576 CoreIPC::In(loader->serverRedirectSourceForHistory(), 575 WebProcess::shared().connection()->send(WebProcessProxyMessage::DidPerformServerRedirect, 576 0, 577 CoreIPC::In(webPage->pageID(), 578 loader->serverRedirectSourceForHistory(), 577 579 loader->serverRedirectDestinationForHistory(), 578 580 m_frame->frameID())); … … 720 722 return; 721 723 722 WebProcess::shared().connection()->send(WebP ageProxyMessage::DidUpdateHistoryTitle, webPage->pageID(), CoreIPC::In(title, url.string(), m_frame->frameID()));724 WebProcess::shared().connection()->send(WebProcessProxyMessage::DidUpdateHistoryTitle, 0, CoreIPC::In(webPage->pageID(), title, url.string(), m_frame->frameID())); 723 725 } 724 726 -
trunk/WebKit2/WebProcess/WebProcess.cpp
r64070 r64247 38 38 #include "WebProcessMessageKinds.h" 39 39 #include <WebCore/ApplicationCacheStorage.h> 40 #include <WebCore/PageGroup.h> 40 41 #include <WebCore/SchemeRegistry.h> 41 42 #include <wtf/PassRefPtr.h> … … 198 199 return; 199 200 } 201 case WebProcessMessage::SetShouldTrackVisitedLinks: { 202 bool shouldTrackVisitedLinks; 203 if (!arguments->decode(CoreIPC::Out(shouldTrackVisitedLinks))) 204 return; 205 206 PageGroup::setShouldTrackVisitedLinks(shouldTrackVisitedLinks); 207 return; 208 } 209 200 210 case WebProcessMessage::Create: { 201 211 uint64_t pageID = arguments->destinationID(); -
trunk/WebKitTools/ChangeLog
r64229 r64247 1 2010-07-28 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin Adler. 4 5 First pass at visited link support for WK2 6 https://bugs.webkit.org/show_bug.cgi?id=43157 7 8 * MiniBrowser/mac/AppDelegate.m: 9 (didNavigateWithNavigationData): 10 (didPerformClientRedirect): 11 (didPerformServerRedirect): 12 (didUpdateHistoryTitle): 13 (populateVisitedLinks): Added for the new version of the HistoryClient. 14 (-[BrowserAppDelegate init]): Set the HistoryClient right after creating the context(s) 15 16 * MiniBrowser/mac/BrowserWindowController.m: 17 (-[BrowserWindowController awakeFromNib]): 18 1 19 2010-07-28 Robin Dunn <robin@alldunn.com> 2 20 -
trunk/WebKitTools/MiniBrowser/mac/AppDelegate.m
r62210 r64247 29 29 #import "BrowserStatisticsWindowController.h" 30 30 31 #import <WebKit2/WKContextPrivate.h> 31 32 #import <WebKit2/WKStringCF.h> 32 #import <WebKit2/WK ContextPrivate.h>33 #import <WebKit2/WKURLCF.h> 33 34 34 35 static NSString *defaultURL = @"http://www.webkit.org/"; … … 45 46 WKContextPostMessageToInjectedBundle(context, newMessage); 46 47 WKStringRelease(newMessage); 48 } 49 50 #pragma mark History Client Callbacks 51 52 static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo) 53 { 54 WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData); 55 CFStringRef title = WKStringCopyCFString(0, wkTitle); 56 WKStringRelease(wkTitle); 57 58 WKURLRef wkURL = WKNavigationDataCopyURL(navigationData); 59 CFURLRef url = WKURLCopyCFURL(0, wkURL); 60 WKURLRelease(wkURL); 61 62 LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url); 63 CFRelease(title); 64 CFRelease(url); 65 } 66 67 static void didPerformClientRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) 68 { 69 CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); 70 CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); 71 LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); 72 CFRelease(cfSourceURL); 73 CFRelease(cfDestinationURL); 74 } 75 76 static void didPerformServerRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) 77 { 78 CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); 79 CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); 80 LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); 81 CFRelease(cfSourceURL); 82 CFRelease(cfDestinationURL); 83 } 84 85 static void didUpdateHistoryTitle(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo) 86 { 87 CFStringRef cfTitle = WKStringCopyCFString(0, title); 88 CFURLRef cfURL = WKURLCopyCFURL(0, URL); 89 LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL); 90 CFRelease(cfTitle); 91 CFRelease(cfURL); 92 } 93 94 static void populateVisitedLinks(WKContextRef context, const void *clientInfo) 95 { 96 LOG(@"HistoryClient - populateVisitedLinks"); 47 97 } 48 98 … … 57 107 58 108 WKContextRef threadContext = WKContextGetSharedThreadContext(); 109 WKContextHistoryClient historyClient = { 110 0, 111 self, 112 didNavigateWithNavigationData, 113 didPerformClientRedirect, 114 didPerformServerRedirect, 115 didUpdateHistoryTitle, 116 populateVisitedLinks 117 }; 118 WKContextSetHistoryClient(threadContext, &historyClient); 119 59 120 threadPageNamespace = WKPageNamespaceCreate(threadContext); 60 121 WKContextRelease(threadContext); … … 71 132 }; 72 133 WKContextSetInjectedBundleClient(processContext, &bundleClient); 134 WKContextSetHistoryClient(processContext, &historyClient); 73 135 74 136 processPageNamespace = WKPageNamespaceCreate(processContext); -
trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
r64172 r64247 364 364 } 365 365 366 #pragma mark History Client Callbacks367 368 static void didNavigateWithNavigationData(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo)369 {370 WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData);371 CFStringRef title = WKStringCopyCFString(0, wkTitle);372 WKStringRelease(wkTitle);373 374 WKURLRef wkURL = WKNavigationDataCopyURL(navigationData);375 CFURLRef url = WKURLCopyCFURL(0, wkURL);376 WKURLRelease(wkURL);377 378 LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url);379 CFRelease(title);380 CFRelease(url);381 }382 383 static void didPerformClientRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)384 {385 CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);386 CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);387 LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);388 CFRelease(cfSourceURL);389 CFRelease(cfDestinationURL);390 }391 392 static void didPerformServerRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)393 {394 CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);395 CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);396 LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);397 CFRelease(cfSourceURL);398 CFRelease(cfDestinationURL);399 }400 401 static void didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo)402 {403 CFStringRef cfTitle = WKStringCopyCFString(0, title);404 CFURLRef cfURL = WKURLCopyCFURL(0, URL);405 LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL);406 CFRelease(cfTitle);407 CFRelease(cfURL);408 }409 410 366 - (void)awakeFromNib 411 367 { … … 459 415 }; 460 416 WKPageSetPageUIClient(_webView.pageRef, &uiClient); 461 462 WKPageHistoryClient historyClient = {463 0,464 self,465 didNavigateWithNavigationData,466 didPerformClientRedirect,467 didPerformServerRedirect,468 didUpdateHistoryTitle,469 };470 471 WKPageSetPageHistoryClient(_webView.pageRef, &historyClient);472 417 } 473 418
Note: See TracChangeset
for help on using the changeset viewer.