[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

beidson at apple.com beidson at apple.com
Wed Dec 22 11:32:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cf62a85511a91c3cbe564cec70b737d0cfdbe03a
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 29 00:41:12 2010 +0000

    2010-07-28  Brady Eidson  <beidson at apple.com>
    
            Reviewed by Darin Adler.
    
            First pass at visited link support for WK2
            https://bugs.webkit.org/show_bug.cgi?id=43157
    
            * MiniBrowser/mac/AppDelegate.m:
            (didNavigateWithNavigationData):
            (didPerformClientRedirect):
            (didPerformServerRedirect):
            (didUpdateHistoryTitle):
            (populateVisitedLinks): Added for the new version of the HistoryClient.
            (-[BrowserAppDelegate init]): Set the HistoryClient right after creating the context(s)
    
            * MiniBrowser/mac/BrowserWindowController.m:
            (-[BrowserWindowController awakeFromNib]):
    2010-07-28  Brady Eidson  <beidson at apple.com>
    
            Reviewed by Darin Adler.
    
            First pass at visited link support for WK2
            https://bugs.webkit.org/show_bug.cgi?id=43157
    
            * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
            (WebPageProxyMessage::):
            * Shared/CoreIPCSupport/WebProcessMessageKinds.h:
            (WebProcessMessage::):
            * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
            (WebProcessProxyMessage::):
    
            Move HistoryClient support from the page...:
            * UIProcess/API/C/WKPage.cpp:
            * UIProcess/API/C/WKPage.h:
    
            ...to the Context
            * UIProcess/API/C/WKContext.cpp:
            (WKContextSetHistoryClient):
            * UIProcess/API/C/WKContext.h:
    
            * UIProcess/WebContext.cpp:
            (WebKit::WebContext::initializeHistoryClient):
            (WebKit::WebContext::ensureWebProcess): When a new WebProcess is created, set its "should track visited links" mode.
            (WebKit::WebContext::didNavigateWithNavigationData):
            (WebKit::WebContext::didPerformClientRedirect):
            (WebKit::WebContext::didPerformServerRedirect):
            (WebKit::WebContext::didUpdateHistoryTitle):
            (WebKit::WebContext::populateVisitedLinks):
            * UIProcess/WebContext.h:
            (WebKit::WebContext::hasValidProcess):
    
            * UIProcess/WebHistoryClient.cpp:
            (WebKit::WebHistoryClient::initialize):
            (WebKit::WebHistoryClient::didNavigateWithNavigationData):
            (WebKit::WebHistoryClient::didPerformClientRedirect):
            (WebKit::WebHistoryClient::didPerformServerRedirect):
            (WebKit::WebHistoryClient::didUpdateHistoryTitle):
            (WebKit::WebHistoryClient::populateVisitedLinks):
            * UIProcess/WebHistoryClient.h:
            (WebKit::WebHistoryClient::shouldTrackVisitedLinks):
    
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::didReceiveMessage):
            * UIProcess/WebPageProxy.h:
    
            * UIProcess/WebProcessProxy.cpp:
            (WebKit::WebProcessProxy::didReceiveMessage):
            (WebKit::WebProcessProxy::didReceiveSyncMessage):
    
            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
            (WebKit::WebChromeClient::populateVisitedLinks):
    
            * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
            (WebKit::WebFrameLoaderClient::updateGlobalHistory):
            (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
            (WebKit::WebFrameLoaderClient::setTitle):
    
            * WebProcess/WebProcess.cpp:
            (WebKit::WebProcess::didReceiveMessage):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 91e9d24..fc36a1f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,66 @@
+2010-07-28  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        First pass at visited link support for WK2
+        https://bugs.webkit.org/show_bug.cgi?id=43157
+
+        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
+        (WebPageProxyMessage::):
+        * Shared/CoreIPCSupport/WebProcessMessageKinds.h:
+        (WebProcessMessage::):
+        * Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h:
+        (WebProcessProxyMessage::):
+
+        Move HistoryClient support from the page...:
+        * UIProcess/API/C/WKPage.cpp:
+        * UIProcess/API/C/WKPage.h:
+        
+        ...to the Context
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextSetHistoryClient):
+        * UIProcess/API/C/WKContext.h:
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::initializeHistoryClient):
+        (WebKit::WebContext::ensureWebProcess): When a new WebProcess is created, set its "should track visited links" mode.
+        (WebKit::WebContext::didNavigateWithNavigationData):
+        (WebKit::WebContext::didPerformClientRedirect):
+        (WebKit::WebContext::didPerformServerRedirect):
+        (WebKit::WebContext::didUpdateHistoryTitle):
+        (WebKit::WebContext::populateVisitedLinks):
+        * UIProcess/WebContext.h:
+        (WebKit::WebContext::hasValidProcess):
+
+        * UIProcess/WebHistoryClient.cpp:
+        (WebKit::WebHistoryClient::initialize):
+        (WebKit::WebHistoryClient::didNavigateWithNavigationData):
+        (WebKit::WebHistoryClient::didPerformClientRedirect):
+        (WebKit::WebHistoryClient::didPerformServerRedirect):
+        (WebKit::WebHistoryClient::didUpdateHistoryTitle):
+        (WebKit::WebHistoryClient::populateVisitedLinks):
+        * UIProcess/WebHistoryClient.h:
+        (WebKit::WebHistoryClient::shouldTrackVisitedLinks):
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        * UIProcess/WebPageProxy.h:
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didReceiveMessage):
+        (WebKit::WebProcessProxy::didReceiveSyncMessage):
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::populateVisitedLinks):
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::updateGlobalHistory):
+        (WebKit::WebFrameLoaderClient::updateGlobalHistoryRedirectLinks):
+        (WebKit::WebFrameLoaderClient::setTitle):
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveMessage):
+
 2010-07-28  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
index 02cf099..64b47a4 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
@@ -54,9 +54,6 @@ enum Kind {
     DidFirstLayoutForFrame,
     DidFirstVisuallyNonEmptyLayoutForFrame,
     DidGetRenderTreeExternalRepresentation,
-    DidNavigateWithNavigationData,
-    DidPerformClientRedirect,
-    DidPerformServerRedirect,
     DidReceiveEvent,
     DidReceiveServerRedirectForProvisionalLoadForFrame,
     DidReceiveTitleForFrame,
@@ -64,7 +61,6 @@ enum Kind {
     DidSetFrame,
     DidStartProgress,
     DidStartProvisionalLoadForFrame,
-    DidUpdateHistoryTitle,
     SetCursor,
     SetToolTip,
     TakeFocus,
diff --git a/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
index 77fa5a7..e3f1e4d 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
@@ -35,6 +35,7 @@ namespace WebProcessMessage {
 enum Kind {
     LoadInjectedBundle,
     SetApplicationCacheDirectory,
+    SetShouldTrackVisitedLinks,
     Create,
     PostMessage,
     RegisterURLSchemeAsEmptyDocument,
diff --git a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
index 8d7a187..fbc9522 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h
@@ -34,8 +34,13 @@ namespace WebProcessProxyMessage {
 
 enum Kind {
     AddBackForwardItem,
+    DidNavigateWithNavigationData,
+    DidPerformClientRedirect,
+    DidPerformServerRedirect,
+    DidUpdateHistoryTitle,
     GetPluginHostConnection,
     GetPlugins,
+    PopulateVisitedLinks,
     PostMessage,
 };
 
diff --git a/WebKit2/UIProcess/API/C/WKContext.cpp b/WebKit2/UIProcess/API/C/WKContext.cpp
index d9b358f..9f1a3bb 100644
--- a/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -73,6 +73,12 @@ void WKContextSetInjectedBundleClient(WKContextRef contextRef, WKContextInjected
         toWK(contextRef)->initializeInjectedBundleClient(wkClient);
 }
 
+void WKContextSetHistoryClient(WKContextRef contextRef, WKContextHistoryClient * wkClient)
+{
+    if (wkClient && !wkClient->version)
+        toWK(contextRef)->initializeHistoryClient(wkClient);
+}
+
 void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef messageRef)
 {
     toWK(contextRef)->postMessageToInjectedBundle(toWK(messageRef)->string());
diff --git a/WebKit2/UIProcess/API/C/WKContext.h b/WebKit2/UIProcess/API/C/WKContext.h
index 89f2812..ff90d20 100644
--- a/WebKit2/UIProcess/API/C/WKContext.h
+++ b/WebKit2/UIProcess/API/C/WKContext.h
@@ -42,6 +42,24 @@ struct WKContextInjectedBundleClient {
 };
 typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient;
 
+// History Client
+typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo);
+
+struct WKContextHistoryClient {
+    int                                                                 version;
+    const void *                                                        clientInfo;
+    WKContextDidNavigateWithNavigationDataCallback                      didNavigateWithNavigationData;
+    WKContextDidPerformClientRedirectCallback                           didPerformClientRedirect;
+    WKContextDidPerformServerRedirectCallback                           didPerformServerRedirect;
+    WKContextDidUpdateHistoryTitleCallback                              didUpdateHistoryTitle;
+    WKContextPopulateVisitedLinksCallback                               populateVisitedLinks;
+};
+typedef struct WKContextHistoryClient WKContextHistoryClient;
+
 WK_EXPORT WKContextRef WKContextCreate();
 WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path);
 WK_EXPORT WKContextRef WKContextGetSharedProcessContext();
@@ -49,6 +67,7 @@ WK_EXPORT WKContextRef WKContextGetSharedProcessContext();
 WK_EXPORT void WKContextSetPreferences(WKContextRef context, WKPreferencesRef preferences);
 WK_EXPORT WKPreferencesRef WKContextGetPreferences(WKContextRef context);
 
+WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, WKContextHistoryClient * client);
 WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, WKContextInjectedBundleClient * client);
 
 WK_EXPORT void WKContextPostMessageToInjectedBundle(WKContextRef context, WKStringRef message);
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index a338d26..82ec002 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -144,12 +144,6 @@ void WKPageSetPageUIClient(WKPageRef pageRef, WKPageUIClient * wkClient)
         toWK(pageRef)->initializeUIClient(wkClient);
 }
 
-void WKPageSetPageHistoryClient(WKPageRef pageRef, WKPageHistoryClient * wkClient)
-{
-    if (wkClient && !wkClient->version)
-        toWK(pageRef)->initializeHistoryClient(wkClient);
-}
-
 void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback, WKPageRunJavaScriptDisposeFunction disposeFunction)
 {
     toWK(pageRef)->runJavaScriptInMainFrame(toWK(scriptRef)->string(), ScriptReturnValueCallback::create(context, callback, disposeFunction));
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index c8d8d34..4e047c6 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -133,23 +133,6 @@ struct WKPageUIClient {
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
-// History Client
-typedef void (*WKPageDidNavigateWithNavigationDataCallback)(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);
-typedef void (*WKPageDidPerformClientRedirectCallback)(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
-typedef void (*WKPageDidPerformServerRedirectCallback)(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
-typedef void (*WKPageDidUpdateHistoryTitleCallback)(WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo);
-
-struct WKPageHistoryClient {
-    int                                                                 version;
-    const void *                                                        clientInfo;
-    WKPageDidNavigateWithNavigationDataCallback                         didNavigateWithNavigationData;
-    WKPageDidPerformClientRedirectCallback                              didPerformClientRedirect;
-    WKPageDidPerformServerRedirectCallback                              didPerformServerRedirect;
-    WKPageDidUpdateHistoryTitleCallback                                 didUpdateHistoryTitle;
-};
-typedef struct WKPageHistoryClient WKPageHistoryClient;
-
-
 WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
 
 WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
@@ -178,7 +161,6 @@ WK_EXPORT void WKPageTerminate(WKPageRef page);
 WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, WKPageLoaderClient * client);
 WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, WKPagePolicyClient * client);
 WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, WKPageUIClient * client);
-WK_EXPORT void WKPageSetPageHistoryClient(WKPageRef page, WKPageHistoryClient * client);
 
 typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, void*);
 typedef void (*WKPageRunJavaScriptDisposeFunction)(void*);
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index 4d4a1d6..ed36f5b 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -88,12 +88,24 @@ void WebContext::initializeInjectedBundleClient(WKContextInjectedBundleClient* c
     m_injectedBundleClient.initialize(client);
 }
 
+void WebContext::initializeHistoryClient(WKContextHistoryClient* client)
+{
+    m_historyClient.initialize(client);
+    
+    if (!hasValidProcess())
+        return;
+        
+    m_process->send(WebProcessMessage::SetShouldTrackVisitedLinks, 0, CoreIPC::In(m_historyClient.shouldTrackVisitedLinks()));
+}
+
 void WebContext::ensureWebProcess()
 {
-    if (m_process && m_process->isValid())
+    if (hasValidProcess())
         return;
 
     m_process = WebProcessManager::shared().getWebProcess(this);
+
+    m_process->send(WebProcessMessage::SetShouldTrackVisitedLinks, 0, CoreIPC::In(m_historyClient.shouldTrackVisitedLinks()));
 }
 
 WebPageProxy* WebContext::createWebPage(WebPageNamespace* pageNamespace)
@@ -165,6 +177,37 @@ void WebContext::postMessageToInjectedBundle(const String& message)
     m_process->send(WebProcessMessage::PostMessage, 0, CoreIPC::In(message));
 }
 
+// HistoryClient
+
+void WebContext::didNavigateWithNavigationData(WebFrameProxy* frame, const WebNavigationDataStore& store) 
+{
+    ASSERT(frame->page());
+    m_historyClient.didNavigateWithNavigationData(this, frame->page(), store, frame);
+}
+
+void WebContext::didPerformClientRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)
+{
+    ASSERT(frame->page());
+    m_historyClient.didPerformClientRedirect(this, frame->page(), sourceURLString, destinationURLString, frame);
+}
+
+void WebContext::didPerformServerRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)
+{
+    ASSERT(frame->page());
+    m_historyClient.didPerformServerRedirect(this, frame->page(), sourceURLString, destinationURLString, frame);
+}
+
+void WebContext::didUpdateHistoryTitle(WebFrameProxy* frame, const String& title, const String& url)
+{
+    ASSERT(frame->page());
+    m_historyClient.didUpdateHistoryTitle(this, frame->page(), title, url, frame);
+}
+
+void WebContext::populateVisitedLinks()
+{
+    m_historyClient.populateVisitedLinks(this);
+}
+
 void WebContext::getStatistics(WKContextStatistics* statistics)
 {
     memset(statistics, 0, sizeof(WKContextStatistics));
diff --git a/WebKit2/UIProcess/WebContext.h b/WebKit2/UIProcess/WebContext.h
index 2951bde..72a5595 100644
--- a/WebKit2/UIProcess/WebContext.h
+++ b/WebKit2/UIProcess/WebContext.h
@@ -30,6 +30,8 @@
 #include "PluginInfoStore.h"
 #include "ProcessModel.h"
 #include "WebContextInjectedBundleClient.h"
+#include "WebHistoryClient.h"
+#include "WebProcessProxy.h"
 #include <WebCore/PlatformString.h>
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
@@ -43,7 +45,6 @@ namespace WebKit {
 class WebPageNamespace;
 class WebPageProxy;
 class WebPreferences;
-class WebProcessProxy;
 
 class WebContext : public APIObject {
 public:
@@ -58,6 +59,7 @@ public:
     ~WebContext();
 
     void initializeInjectedBundleClient(WKContextInjectedBundleClient*);
+    void initializeHistoryClient(WKContextHistoryClient*);
 
     ProcessModel processModel() const { return m_processModel; }
     WebProcessProxy* process() const { return m_process.get(); }
@@ -77,9 +79,15 @@ public:
 
     // InjectedBundle client
     void didReceiveMessageFromInjectedBundle(const WebCore::String&);
-
     void postMessageToInjectedBundle(const WebCore::String&);
 
+    // History client
+    void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&); 
+    void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
+    void didPerformServerRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
+    void didUpdateHistoryTitle(WebFrameProxy*, const WebCore::String& title, const WebCore::String& url);
+    void populateVisitedLinks();
+    
     void getStatistics(WKContextStatistics* statistics);
     void setAdditionalPluginPath(const WebCore::String&);
 
@@ -92,6 +100,7 @@ private:
     WebContext(ProcessModel, const WebCore::String& injectedBundlePath);
 
     void ensureWebProcess();
+    bool hasValidProcess() const { return m_process && m_process->isValid(); }
 
     ProcessModel m_processModel;
     
@@ -104,6 +113,8 @@ private:
     WebCore::String m_injectedBundlePath;
     WebContextInjectedBundleClient m_injectedBundleClient;
 
+    WebHistoryClient m_historyClient;
+
     PluginInfoStore m_pluginInfoStore;
 };
 
diff --git a/WebKit2/UIProcess/WebHistoryClient.cpp b/WebKit2/UIProcess/WebHistoryClient.cpp
index 989c7b1..fe4a6dc 100644
--- a/WebKit2/UIProcess/WebHistoryClient.cpp
+++ b/WebKit2/UIProcess/WebHistoryClient.cpp
@@ -38,45 +38,53 @@ WebHistoryClient::WebHistoryClient()
     initialize(0);
 }
 
-void WebHistoryClient::initialize(WKPageHistoryClient* client)
+void WebHistoryClient::initialize(WKContextHistoryClient* client)
 {
     if (client && !client->version)
-        m_pageHistoryClient = *client;
+        m_contextHistoryClient = *client;
     else 
-        memset(&m_pageHistoryClient, 0, sizeof(m_pageHistoryClient));
+        memset(&m_contextHistoryClient, 0, sizeof(m_contextHistoryClient));
 }
 
-void WebHistoryClient::didNavigateWithNavigationData(WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame)
+void WebHistoryClient::didNavigateWithNavigationData(WebContext* context, WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame)
 {
-    if (!m_pageHistoryClient.didNavigateWithNavigationData)
+    if (!m_contextHistoryClient.didNavigateWithNavigationData)
         return;
 
     RefPtr<WebNavigationData> navigationData = WebNavigationData::create(navigationDataStore); 
-    m_pageHistoryClient.didNavigateWithNavigationData(toRef(page), toRef(navigationData.get()), toRef(frame), m_pageHistoryClient.clientInfo);
+    m_contextHistoryClient.didNavigateWithNavigationData(toRef(context), toRef(page), toRef(navigationData.get()), toRef(frame), m_contextHistoryClient.clientInfo);
 }
 
-void WebHistoryClient::didPerformClientRedirect(WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
+void WebHistoryClient::didPerformClientRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
 {
-    if (!m_pageHistoryClient.didPerformClientRedirect)
+    if (!m_contextHistoryClient.didPerformClientRedirect)
         return;
 
-    m_pageHistoryClient.didPerformClientRedirect(toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_pageHistoryClient.clientInfo);
+    m_contextHistoryClient.didPerformClientRedirect(toRef(context), toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_contextHistoryClient.clientInfo);
 }
 
-void WebHistoryClient::didPerformServerRedirect(WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
+void WebHistoryClient::didPerformServerRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
 {
-    if (!m_pageHistoryClient.didPerformServerRedirect)
+    if (!m_contextHistoryClient.didPerformServerRedirect)
         return;
 
-    m_pageHistoryClient.didPerformServerRedirect(toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_pageHistoryClient.clientInfo);
+    m_contextHistoryClient.didPerformServerRedirect(toRef(context), toRef(page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toRef(frame), m_contextHistoryClient.clientInfo);
 }
 
-void WebHistoryClient::didUpdateHistoryTitle(WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame)
+void WebHistoryClient::didUpdateHistoryTitle(WebContext* context, WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame)
 {
-    if (!m_pageHistoryClient.didUpdateHistoryTitle)
+    if (!m_contextHistoryClient.didUpdateHistoryTitle)
         return;
 
-    m_pageHistoryClient.didUpdateHistoryTitle(toRef(page), toRef(title.impl()), toURLRef(url.impl()), toRef(frame), m_pageHistoryClient.clientInfo);
+    m_contextHistoryClient.didUpdateHistoryTitle(toRef(context), toRef(page), toRef(title.impl()), toURLRef(url.impl()), toRef(frame), m_contextHistoryClient.clientInfo);
+}
+
+void WebHistoryClient::populateVisitedLinks(WebContext* context)
+{
+    if (!m_contextHistoryClient.populateVisitedLinks)
+        return;
+
+    m_contextHistoryClient.populateVisitedLinks(toRef(context), m_contextHistoryClient.clientInfo);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebHistoryClient.h b/WebKit2/UIProcess/WebHistoryClient.h
index dd6c6f0..c81ea2f 100644
--- a/WebKit2/UIProcess/WebHistoryClient.h
+++ b/WebKit2/UIProcess/WebHistoryClient.h
@@ -26,7 +26,7 @@
 #ifndef WebHistoryClient_h
 #define WebHistoryClient_h
 
-#include "WKPage.h"
+#include "WKContext.h"
 
 namespace WebCore {
     class String;
@@ -34,6 +34,7 @@ namespace WebCore {
 
 namespace WebKit {
 
+class WebContext;
 class WebFrameProxy;
 struct WebNavigationDataStore;
 class WebPageProxy;
@@ -41,15 +42,18 @@ class WebPageProxy;
 class WebHistoryClient {
 public:
     WebHistoryClient();
-    void initialize(WKPageHistoryClient*);
+    void initialize(WKContextHistoryClient*);
 
-    void didNavigateWithNavigationData(WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*);
-    void didPerformClientRedirect(WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*);
-    void didPerformServerRedirect(WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*);
-    void didUpdateHistoryTitle(WebPageProxy*, const WebCore::String& title, const WebCore::String& url, WebFrameProxy*);
+    void didNavigateWithNavigationData(WebContext*, WebPageProxy*, const WebNavigationDataStore&, WebFrameProxy*);
+    void didPerformClientRedirect(WebContext*, WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*);
+    void didPerformServerRedirect(WebContext*, WebPageProxy*, const WebCore::String& sourceURL, const WebCore::String& destinationURL, WebFrameProxy*);
+    void didUpdateHistoryTitle(WebContext*, WebPageProxy*, const WebCore::String& title, const WebCore::String& url, WebFrameProxy*);
+    void populateVisitedLinks(WebContext*);
 
+    bool shouldTrackVisitedLinks() const { return m_contextHistoryClient.populateVisitedLinks; }
+    
 private:
-    WKPageHistoryClient m_pageHistoryClient;
+    WKContextHistoryClient m_contextHistoryClient;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 6192d86..e7625e3 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -33,7 +33,6 @@
 #include "WebContext.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebEvent.h"
-#include "WebNavigationDataStore.h"
 #include "WebPageMessageKinds.h"
 #include "WebPageNamespace.h"
 #include "WebPageProxyMessageKinds.h"
@@ -123,11 +122,6 @@ void WebPageProxy::initializeUIClient(WKPageUIClient* client)
     m_uiClient.initialize(client);
 }
 
-void WebPageProxy::initializeHistoryClient(WKPageHistoryClient* client)
-{
-    m_historyClient.initialize(client);
-}
-
 void WebPageProxy::revive()
 {
     m_valid = true;
@@ -567,41 +561,6 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             closePage();
             break;
         }
-        case WebPageProxyMessage::DidNavigateWithNavigationData: {
-            WebNavigationDataStore store;
-            uint64_t frameID;
-            if (!arguments.decode(CoreIPC::Out(store, frameID)))
-                return;
-            didNavigateWithNavigationData(webFrame(frameID), store);
-            break;
-        }
-        case WebPageProxyMessage::DidPerformClientRedirect: {
-            String sourceURLString;
-            String destinationURLString;
-            uint64_t frameID;
-            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
-                return;
-            didPerformClientRedirect(webFrame(frameID), sourceURLString, destinationURLString);
-            break;
-        }
-        case WebPageProxyMessage::DidPerformServerRedirect: {
-            String sourceURLString;
-            String destinationURLString;
-            uint64_t frameID;
-            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
-                return;
-            didPerformServerRedirect(webFrame(frameID), sourceURLString, destinationURLString);
-            break;
-        }
-        case WebPageProxyMessage::DidUpdateHistoryTitle: {
-            String title;
-            String url;
-            uint64_t frameID;
-            if (!arguments.decode(CoreIPC::Out(title, url, frameID)))
-                return;
-            didUpdateHistoryTitle(webFrame(frameID), title, url);
-            break;
-        }
         case WebPageProxyMessage::BackForwardAddItem: {
             uint64_t itemID;
             if (!arguments.decode(CoreIPC::Out(itemID)))
@@ -865,28 +824,6 @@ String WebPageProxy::runJavaScriptPrompt(WebFrameProxy* frame, const String& mes
     return m_uiClient.runJavaScriptPrompt(this, message, defaultValue, frame);
 }
 
-// HistoryClient
-
-void WebPageProxy::didNavigateWithNavigationData(WebFrameProxy* frame, const WebNavigationDataStore& store) 
-{
-    m_historyClient.didNavigateWithNavigationData(this, store, frame);
-}
-
-void WebPageProxy::didPerformClientRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)
-{
-    m_historyClient.didPerformClientRedirect(this, sourceURLString, destinationURLString, frame);
-}
-
-void WebPageProxy::didPerformServerRedirect(WebFrameProxy* frame, const String& sourceURLString, const String& destinationURLString)
-{
-    m_historyClient.didPerformServerRedirect(this, sourceURLString, destinationURLString, frame);
-}
-
-void WebPageProxy::didUpdateHistoryTitle(WebFrameProxy* frame, const String& title, const String& url)
-{
-    m_historyClient.didUpdateHistoryTitle(this, title, url, frame);
-}
-
 // BackForwardList
 
 void WebPageProxy::addItemToBackForwardList(WebBackForwardListItem* item)
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 731e710..a428d12 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -92,7 +92,6 @@ public:
     void initializeLoaderClient(WKPageLoaderClient*);
     void initializePolicyClient(WKPagePolicyClient*);
     void initializeUIClient(WKPageUIClient*);
-    void initializeHistoryClient(WKPageHistoryClient*);
 
     void revive();
 
@@ -190,11 +189,6 @@ private:
     bool runJavaScriptConfirm(WebFrameProxy* frame, const WebCore::String&);
     WebCore::String runJavaScriptPrompt(WebFrameProxy* frame, const WebCore::String&, const WebCore::String&);
 
-    void didNavigateWithNavigationData(WebFrameProxy*, const WebNavigationDataStore&); 
-    void didPerformClientRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
-    void didPerformServerRedirect(WebFrameProxy*, const WebCore::String& sourceURLString, const WebCore::String& destinationURLString);
-    void didUpdateHistoryTitle(WebFrameProxy*, const WebCore::String& title, const WebCore::String& url);
-
     void addItemToBackForwardList(WebBackForwardListItem*);
     void goToItemInBackForwardList(WebBackForwardListItem*);
 
@@ -214,7 +208,6 @@ private:
     WebLoaderClient m_loaderClient;
     WebPolicyClient m_policyClient;
     WebUIClient m_uiClient;
-    WebHistoryClient m_historyClient;
 
     OwnPtr<DrawingAreaProxy> m_drawingArea;
     RefPtr<WebPageNamespace> m_pageNamespace;
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 12a8404..56f07e3 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -29,6 +29,7 @@
 #include "ProcessLauncher.h"
 #include "WebBackForwardListItem.h"
 #include "WebContext.h"
+#include "WebNavigationDataStore.h"
 #include "WebPageNamespace.h"
 #include "WebPageProxy.h"
 #include "WebProcessManager.h"
@@ -243,6 +244,70 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
                 return;
             }
 
+            case WebProcessProxyMessage::DidNavigateWithNavigationData: {
+                uint64_t pageID;
+                WebNavigationDataStore store;
+                uint64_t frameID;
+                if (!arguments->decode(CoreIPC::Out(pageID, store, frameID)))
+                    return;
+
+                WebPageProxy* page = webPage(pageID);
+                if (!page)
+                    return;
+                
+                m_context->didNavigateWithNavigationData(page->webFrame(frameID), store);
+                break;
+            }
+            case WebProcessProxyMessage::DidPerformClientRedirect: {
+                uint64_t pageID;
+                String sourceURLString;
+                String destinationURLString;
+                uint64_t frameID;
+                if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID)))
+                    return;
+
+                WebPageProxy* page = webPage(pageID);
+                if (!page)
+                    return;
+
+                m_context->didPerformClientRedirect(page->webFrame(frameID), sourceURLString, destinationURLString);
+                break;
+            }
+            case WebProcessProxyMessage::DidPerformServerRedirect: {
+                uint64_t pageID;
+                String sourceURLString;
+                String destinationURLString;
+                uint64_t frameID;
+                if (!arguments->decode(CoreIPC::Out(pageID, sourceURLString, destinationURLString, frameID)))
+                    return;
+
+                WebPageProxy* page = webPage(pageID);
+                if (!page)
+                    return;
+
+                m_context->didPerformServerRedirect(page->webFrame(frameID), sourceURLString, destinationURLString);
+                break;
+            }
+            case WebProcessProxyMessage::DidUpdateHistoryTitle: {
+                uint64_t pageID;
+                String title;
+                String url;
+                uint64_t frameID;
+                if (!arguments->decode(CoreIPC::Out(pageID, title, url, frameID)))
+                    return;
+
+                WebPageProxy* page = webPage(pageID);
+                if (!page)
+                    return;
+
+                m_context->didUpdateHistoryTitle(page->webFrame(frameID), title, url);
+                break;
+            }
+            case WebProcessProxyMessage::PopulateVisitedLinks: {
+                m_context->populateVisitedLinks();
+                break;
+            }
+
             // These are synchronous messages and should never be handled here.
             case WebProcessProxyMessage::GetPlugins:
             case WebProcessProxyMessage::GetPluginHostConnection:
@@ -295,6 +360,11 @@ void WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, Cor
             }
 
             // These are asynchronous messages and should never be handled here.
+            case WebProcessProxyMessage::DidNavigateWithNavigationData:
+            case WebProcessProxyMessage::DidPerformClientRedirect:
+            case WebProcessProxyMessage::DidPerformServerRedirect:
+            case WebProcessProxyMessage::DidUpdateHistoryTitle:
+            case WebProcessProxyMessage::PopulateVisitedLinks:
             case WebProcessProxyMessage::PostMessage:
             case WebProcessProxyMessage::AddBackForwardItem:
                 ASSERT_NOT_REACHED();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 2325809..fecc3b5 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -36,6 +36,7 @@
 #include "WebPageProxyMessageKinds.h"
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
+#include "WebProcessProxyMessageKinds.h"
 #include <WebCore/FileChooser.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
@@ -385,7 +386,7 @@ void WebChromeClient::dashboardRegionsChanged()
 
 void WebChromeClient::populateVisitedLinks()
 {
-    notImplemented();
+    WebProcess::shared().connection()->send(WebProcessProxyMessage::PopulateVisitedLinks, 0, CoreIPC::In());
 }
 
 FloatRect WebChromeClient::customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect)
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 60ea7ab..62b3078 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -546,9 +546,9 @@ void WebFrameLoaderClient::updateGlobalHistory()
     data.url = loader->urlForHistory().string();
     data.title = loader->title();
 
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidNavigateWithNavigationData,
-                                            webPage->pageID(),
-                                            CoreIPC::In(data, m_frame->frameID()));
+    WebProcess::shared().connection()->send(WebProcessProxyMessage::DidNavigateWithNavigationData,
+                                            0,
+                                            CoreIPC::In(webPage->pageID(), data, m_frame->frameID()));
 }
 
 void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
@@ -562,18 +562,20 @@ void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
 
     // Client redirect
     if (!loader->clientRedirectSourceForHistory().isNull()) {
-        WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformClientRedirect,
-                                                webPage->pageID(),
-                                                CoreIPC::In(loader->clientRedirectSourceForHistory(), 
+        WebProcess::shared().connection()->send(WebProcessProxyMessage::DidPerformClientRedirect,
+                                                0,
+                                                CoreIPC::In(webPage->pageID(),
+                                                            loader->clientRedirectSourceForHistory(), 
                                                             loader->clientRedirectDestinationForHistory(),
                                                             m_frame->frameID()));
     }
 
     // Server redirect
     if (!loader->serverRedirectSourceForHistory().isNull()) {
-        WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformServerRedirect,
-                                                webPage->pageID(),
-                                                CoreIPC::In(loader->serverRedirectSourceForHistory(),
+        WebProcess::shared().connection()->send(WebProcessProxyMessage::DidPerformServerRedirect,
+                                                0,
+                                                CoreIPC::In(webPage->pageID(),
+                                                            loader->serverRedirectSourceForHistory(),
                                                             loader->serverRedirectDestinationForHistory(),
                                                             m_frame->frameID()));
     }
@@ -719,7 +721,7 @@ void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
     if (!webPage)
         return;
 
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidUpdateHistoryTitle, webPage->pageID(), CoreIPC::In(title, url.string(), m_frame->frameID()));
+    WebProcess::shared().connection()->send(WebProcessProxyMessage::DidUpdateHistoryTitle, 0, CoreIPC::In(webPage->pageID(), title, url.string(), m_frame->frameID()));
 }
 
 String WebFrameLoaderClient::userAgent(const KURL&)
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 34b9911..1f8774a 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -37,6 +37,7 @@
 #include "WebPreferencesStore.h"
 #include "WebProcessMessageKinds.h"
 #include <WebCore/ApplicationCacheStorage.h>
+#include <WebCore/PageGroup.h>
 #include <WebCore/SchemeRegistry.h>
 #include <wtf/PassRefPtr.h>
 
@@ -197,6 +198,15 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
                 setApplicationCacheDirectory(directory);
                 return;
             }
+            case WebProcessMessage::SetShouldTrackVisitedLinks: {
+                bool shouldTrackVisitedLinks;
+                if (!arguments->decode(CoreIPC::Out(shouldTrackVisitedLinks)))
+                    return;
+                
+                PageGroup::setShouldTrackVisitedLinks(shouldTrackVisitedLinks);
+                return;
+            }
+            
             case WebProcessMessage::Create: {
                 uint64_t pageID = arguments->destinationID();
                 IntSize viewSize;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b73d12f..fc107ea 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2010-07-28  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Darin Adler.
+
+        First pass at visited link support for WK2
+        https://bugs.webkit.org/show_bug.cgi?id=43157
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (didNavigateWithNavigationData):
+        (didPerformClientRedirect):
+        (didPerformServerRedirect):
+        (didUpdateHistoryTitle):
+        (populateVisitedLinks): Added for the new version of the HistoryClient.
+        (-[BrowserAppDelegate init]): Set the HistoryClient right after creating the context(s)
+        
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+
 2010-07-28  Robin Dunn  <robin at alldunn.com>
 
         Reviewed by Kevin Ollivier.
diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m
index 2805157..ccbf176 100644
--- a/WebKitTools/MiniBrowser/mac/AppDelegate.m
+++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m
@@ -28,8 +28,9 @@
 #import "BrowserWindowController.h"
 #import "BrowserStatisticsWindowController.h"
 
-#import <WebKit2/WKStringCF.h>
 #import <WebKit2/WKContextPrivate.h>
+#import <WebKit2/WKStringCF.h>
+#import <WebKit2/WKURLCF.h>
 
 static NSString *defaultURL = @"http://www.webkit.org/";
 
@@ -46,6 +47,55 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess
     WKStringRelease(newMessage);
 }
 
+#pragma mark History Client Callbacks
+
+static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo)
+{
+    WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData);
+    CFStringRef title = WKStringCopyCFString(0, wkTitle);
+    WKStringRelease(wkTitle);
+
+    WKURLRef wkURL = WKNavigationDataCopyURL(navigationData);
+    CFURLRef url = WKURLCopyCFURL(0, wkURL);
+    WKURLRelease(wkURL);
+
+    LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url);
+    CFRelease(title);
+    CFRelease(url);
+}
+
+static void didPerformClientRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)
+{
+    CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);
+    CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);
+    LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);
+    CFRelease(cfSourceURL);
+    CFRelease(cfDestinationURL);
+}
+
+static void didPerformServerRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)
+{
+    CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);
+    CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);
+    LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);
+    CFRelease(cfSourceURL);
+    CFRelease(cfDestinationURL);
+}
+
+static void didUpdateHistoryTitle(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo)
+{
+    CFStringRef cfTitle = WKStringCopyCFString(0, title);
+    CFURLRef cfURL = WKURLCopyCFURL(0, URL);
+    LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL);
+    CFRelease(cfTitle);
+    CFRelease(cfURL);
+}
+
+static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
+{
+    LOG(@"HistoryClient - populateVisitedLinks");
+}
+
 - (id)init
 {
     self = [super init];
@@ -56,6 +106,17 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess
             currentProcessModel = kProcessModelSharedSecondaryProcess;
 
         WKContextRef threadContext = WKContextGetSharedThreadContext();
+        WKContextHistoryClient historyClient = {
+            0,
+            self,
+            didNavigateWithNavigationData,
+            didPerformClientRedirect,
+            didPerformServerRedirect,
+            didUpdateHistoryTitle,
+            populateVisitedLinks
+        };
+        WKContextSetHistoryClient(threadContext, &historyClient);
+    
         threadPageNamespace = WKPageNamespaceCreate(threadContext);
         WKContextRelease(threadContext);
 
@@ -70,6 +131,7 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess
             _didRecieveMessageFromInjectedBundle
         };
         WKContextSetInjectedBundleClient(processContext, &bundleClient);
+        WKContextSetHistoryClient(processContext, &historyClient);
         
         processPageNamespace = WKPageNamespaceCreate(processContext);
         WKContextRelease(processContext);
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index 321c849..9a987d2 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -363,50 +363,6 @@ static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKSt
     return WKStringCreateWithCFString((CFStringRef)result);
 }
 
-#pragma mark History Client Callbacks
-
-static void didNavigateWithNavigationData(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo)
-{
-    WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData);
-    CFStringRef title = WKStringCopyCFString(0, wkTitle);
-    WKStringRelease(wkTitle);
-
-    WKURLRef wkURL = WKNavigationDataCopyURL(navigationData);
-    CFURLRef url = WKURLCopyCFURL(0, wkURL);
-    WKURLRelease(wkURL);
-
-    LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url);
-    CFRelease(title);
-    CFRelease(url);
-}
-
-static void didPerformClientRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)
-{
-    CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);
-    CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);
-    LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);
-    CFRelease(cfSourceURL);
-    CFRelease(cfDestinationURL);
-}
-
-static void didPerformServerRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo)
-{
-    CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL);
-    CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL);
-    LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL);
-    CFRelease(cfSourceURL);
-    CFRelease(cfDestinationURL);
-}
-
-static void didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo)
-{
-    CFStringRef cfTitle = WKStringCopyCFString(0, title);
-    CFURLRef cfURL = WKURLCopyCFURL(0, URL);
-    LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL);
-    CFRelease(cfTitle);
-    CFRelease(cfURL);
-}
-
 - (void)awakeFromNib
 {
     _webView = [[WKView alloc] initWithFrame:[containerView frame] pageNamespaceRef:_pageNamespace];
@@ -458,17 +414,6 @@ static void didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef UR
         runJavaScriptPrompt
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
-
-    WKPageHistoryClient historyClient = {
-        0,
-        self,
-        didNavigateWithNavigationData,
-        didPerformClientRedirect,
-        didPerformServerRedirect,
-        didUpdateHistoryTitle,
-    };
-
-    WKPageSetPageHistoryClient(_webView.pageRef, &historyClient);
 }
 
 - (void)didStartProgress

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list