Changeset 64247 in webkit


Ignore:
Timestamp:
Jul 28, 2010 5:41:12 PM (14 years ago)
Author:
beidson@apple.com
Message:

2010-07-28 Brady Eidson <beidson@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@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):
Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64246 r64247  
     12010-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
    1642010-07-28  Anders Carlsson  <andersca@apple.com>
    265
  • trunk/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h

    r64065 r64247  
    5555    DidFirstVisuallyNonEmptyLayoutForFrame,
    5656    DidGetRenderTreeExternalRepresentation,
    57     DidNavigateWithNavigationData,
    58     DidPerformClientRedirect,
    59     DidPerformServerRedirect,
    6057    DidReceiveEvent,
    6158    DidReceiveServerRedirectForProvisionalLoadForFrame,
     
    6562    DidStartProgress,
    6663    DidStartProvisionalLoadForFrame,
    67     DidUpdateHistoryTitle,
    6864    SetCursor,
    6965    SetToolTip,
  • trunk/WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h

    r64070 r64247  
    3636    LoadInjectedBundle,
    3737    SetApplicationCacheDirectory,
     38    SetShouldTrackVisitedLinks,
    3839    Create,
    3940    PostMessage,
  • trunk/WebKit2/Shared/CoreIPCSupport/WebProcessProxyMessageKinds.h

    r63362 r64247  
    3535enum Kind {
    3636    AddBackForwardItem,
     37    DidNavigateWithNavigationData,
     38    DidPerformClientRedirect,
     39    DidPerformServerRedirect,
     40    DidUpdateHistoryTitle,
    3741    GetPluginHostConnection,
    3842    GetPlugins,
     43    PopulateVisitedLinks,
    3944    PostMessage,
    4045};
  • trunk/WebKit2/UIProcess/API/C/WKContext.cpp

    r64232 r64247  
    7474}
    7575
     76void WKContextSetHistoryClient(WKContextRef contextRef, WKContextHistoryClient * wkClient)
     77{
     78    if (wkClient && !wkClient->version)
     79        toWK(contextRef)->initializeHistoryClient(wkClient);
     80}
     81
    7682void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef messageRef)
    7783{
  • trunk/WebKit2/UIProcess/API/C/WKContext.h

    r64029 r64247  
    4343typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient;
    4444
     45// History Client
     46typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);
     47typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
     48typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo);
     49typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo);
     50typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo);
     51
     52struct WKContextHistoryClient {
     53    int                                                                 version;
     54    const void *                                                        clientInfo;
     55    WKContextDidNavigateWithNavigationDataCallback                      didNavigateWithNavigationData;
     56    WKContextDidPerformClientRedirectCallback                           didPerformClientRedirect;
     57    WKContextDidPerformServerRedirectCallback                           didPerformServerRedirect;
     58    WKContextDidUpdateHistoryTitleCallback                              didUpdateHistoryTitle;
     59    WKContextPopulateVisitedLinksCallback                               populateVisitedLinks;
     60};
     61typedef struct WKContextHistoryClient WKContextHistoryClient;
     62
    4563WK_EXPORT WKContextRef WKContextCreate();
    4664WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path);
     
    5068WK_EXPORT WKPreferencesRef WKContextGetPreferences(WKContextRef context);
    5169
     70WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, WKContextHistoryClient * client);
    5271WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, WKContextInjectedBundleClient * client);
    5372
  • trunk/WebKit2/UIProcess/API/C/WKPage.cpp

    r64232 r64247  
    145145}
    146146
    147 void WKPageSetPageHistoryClient(WKPageRef pageRef, WKPageHistoryClient * wkClient)
    148 {
    149     if (wkClient && !wkClient->version)
    150         toWK(pageRef)->initializeHistoryClient(wkClient);
    151 }
    152 
    153147void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback, WKPageRunJavaScriptDisposeFunction disposeFunction)
    154148{
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r64172 r64247  
    134134typedef struct WKPageUIClient WKPageUIClient;
    135135
    136 // History Client
    137 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 
    153136WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
    154137
     
    179162WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, WKPagePolicyClient * client);
    180163WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, WKPageUIClient * client);
    181 WK_EXPORT void WKPageSetPageHistoryClient(WKPageRef page, WKPageHistoryClient * client);
    182164
    183165typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, void*);
  • trunk/WebKit2/UIProcess/WebContext.cpp

    r64232 r64247  
    8989}
    9090
     91void 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
    91101void WebContext::ensureWebProcess()
    92102{
    93     if (m_process && m_process->isValid())
     103    if (hasValidProcess())
    94104        return;
    95105
    96106    m_process = WebProcessManager::shared().getWebProcess(this);
     107
     108    m_process->send(WebProcessMessage::SetShouldTrackVisitedLinks, 0, CoreIPC::In(m_historyClient.shouldTrackVisitedLinks()));
    97109}
    98110
     
    166178}
    167179
     180// HistoryClient
     181
     182void WebContext::didNavigateWithNavigationData(WebFrameProxy* frame, const WebNavigationDataStore& store)
     183{
     184    ASSERT(frame->page());
     185    m_historyClient.didNavigateWithNavigationData(this, frame->page(), store, frame);
     186}
     187
     188void 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
     194void 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
     200void 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
     206void WebContext::populateVisitedLinks()
     207{
     208    m_historyClient.populateVisitedLinks(this);
     209}
     210
    168211void WebContext::getStatistics(WKContextStatistics* statistics)
    169212{
  • trunk/WebKit2/UIProcess/WebContext.h

    r64232 r64247  
    3131#include "ProcessModel.h"
    3232#include "WebContextInjectedBundleClient.h"
     33#include "WebHistoryClient.h"
     34#include "WebProcessProxy.h"
    3335#include <WebCore/PlatformString.h>
    3436#include <wtf/Forward.h>
     
    4446class WebPageProxy;
    4547class WebPreferences;
    46 class WebProcessProxy;
    4748
    4849class WebContext : public APIObject {
     
    5960
    6061    void initializeInjectedBundleClient(WKContextInjectedBundleClient*);
     62    void initializeHistoryClient(WKContextHistoryClient*);
    6163
    6264    ProcessModel processModel() const { return m_processModel; }
     
    7880    // InjectedBundle client
    7981    void didReceiveMessageFromInjectedBundle(const WebCore::String&);
    80 
    8182    void postMessageToInjectedBundle(const WebCore::String&);
    8283
     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   
    8391    void getStatistics(WKContextStatistics* statistics);
    8492    void setAdditionalPluginPath(const WebCore::String&);
     
    93101
    94102    void ensureWebProcess();
     103    bool hasValidProcess() const { return m_process && m_process->isValid(); }
    95104
    96105    ProcessModel m_processModel;
     
    105114    WebContextInjectedBundleClient m_injectedBundleClient;
    106115
     116    WebHistoryClient m_historyClient;
     117
    107118    PluginInfoStore m_pluginInfoStore;
    108119};
  • trunk/WebKit2/UIProcess/WebHistoryClient.cpp

    r57676 r64247  
    3939}
    4040
    41 void WebHistoryClient::initialize(WKPageHistoryClient* client)
     41void WebHistoryClient::initialize(WKContextHistoryClient* client)
    4242{
    4343    if (client && !client->version)
    44         m_pageHistoryClient = *client;
     44        m_contextHistoryClient = *client;
    4545    else
    46         memset(&m_pageHistoryClient, 0, sizeof(m_pageHistoryClient));
     46        memset(&m_contextHistoryClient, 0, sizeof(m_contextHistoryClient));
    4747}
    4848
    49 void WebHistoryClient::didNavigateWithNavigationData(WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame)
     49void WebHistoryClient::didNavigateWithNavigationData(WebContext* context, WebPageProxy* page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy* frame)
    5050{
    51     if (!m_pageHistoryClient.didNavigateWithNavigationData)
     51    if (!m_contextHistoryClient.didNavigateWithNavigationData)
    5252        return;
    5353
    5454    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);
    5656}
    5757
    58 void WebHistoryClient::didPerformClientRedirect(WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
     58void WebHistoryClient::didPerformClientRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
    5959{
    60     if (!m_pageHistoryClient.didPerformClientRedirect)
     60    if (!m_contextHistoryClient.didPerformClientRedirect)
    6161        return;
    6262
    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);
    6464}
    6565
    66 void WebHistoryClient::didPerformServerRedirect(WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
     66void WebHistoryClient::didPerformServerRedirect(WebContext* context, WebPageProxy* page, const String& sourceURL, const String& destinationURL, WebFrameProxy* frame)
    6767{
    68     if (!m_pageHistoryClient.didPerformServerRedirect)
     68    if (!m_contextHistoryClient.didPerformServerRedirect)
    6969        return;
    7070
    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);
    7272}
    7373
    74 void WebHistoryClient::didUpdateHistoryTitle(WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame)
     74void WebHistoryClient::didUpdateHistoryTitle(WebContext* context, WebPageProxy* page, const String& title, const String& url, WebFrameProxy* frame)
    7575{
    76     if (!m_pageHistoryClient.didUpdateHistoryTitle)
     76    if (!m_contextHistoryClient.didUpdateHistoryTitle)
    7777        return;
    7878
    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
     82void WebHistoryClient::populateVisitedLinks(WebContext* context)
     83{
     84    if (!m_contextHistoryClient.populateVisitedLinks)
     85        return;
     86
     87    m_contextHistoryClient.populateVisitedLinks(toRef(context), m_contextHistoryClient.clientInfo);
    8088}
    8189
  • trunk/WebKit2/UIProcess/WebHistoryClient.h

    r61563 r64247  
    2727#define WebHistoryClient_h
    2828
    29 #include "WKPage.h"
     29#include "WKContext.h"
    3030
    3131namespace WebCore {
     
    3535namespace WebKit {
    3636
     37class WebContext;
    3738class WebFrameProxy;
    3839struct WebNavigationDataStore;
     
    4243public:
    4344    WebHistoryClient();
    44     void initialize(WKPageHistoryClient*);
     45    void initialize(WKContextHistoryClient*);
    4546
    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*);
    5052
     53    bool shouldTrackVisitedLinks() const { return m_contextHistoryClient.populateVisitedLinks; }
     54   
    5155private:
    52     WKPageHistoryClient m_pageHistoryClient;
     56    WKContextHistoryClient m_contextHistoryClient;
    5357};
    5458
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r64155 r64247  
    3434#include "WebCoreArgumentCoders.h"
    3535#include "WebEvent.h"
    36 #include "WebNavigationDataStore.h"
    3736#include "WebPageMessageKinds.h"
    3837#include "WebPageNamespace.h"
     
    124123}
    125124
    126 void WebPageProxy::initializeHistoryClient(WKPageHistoryClient* client)
    127 {
    128     m_historyClient.initialize(client);
    129 }
    130 
    131125void WebPageProxy::revive()
    132126{
     
    566560        case WebPageProxyMessage::ClosePage: {
    567561            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);
    603562            break;
    604563        }
     
    866825}
    867826
    868 // HistoryClient
    869 
    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 
    890827// BackForwardList
    891828
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r64232 r64247  
    9393    void initializePolicyClient(WKPagePolicyClient*);
    9494    void initializeUIClient(WKPageUIClient*);
    95     void initializeHistoryClient(WKPageHistoryClient*);
    9695
    9796    void revive();
     
    191190    WebCore::String runJavaScriptPrompt(WebFrameProxy* frame, const WebCore::String&, const WebCore::String&);
    192191
    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 
    198192    void addItemToBackForwardList(WebBackForwardListItem*);
    199193    void goToItemInBackForwardList(WebBackForwardListItem*);
     
    215209    WebPolicyClient m_policyClient;
    216210    WebUIClient m_uiClient;
    217     WebHistoryClient m_historyClient;
    218211
    219212    OwnPtr<DrawingAreaProxy> m_drawingArea;
  • trunk/WebKit2/UIProcess/WebProcessProxy.cpp

    r64029 r64247  
    3030#include "WebBackForwardListItem.h"
    3131#include "WebContext.h"
     32#include "WebNavigationDataStore.h"
    3233#include "WebPageNamespace.h"
    3334#include "WebPageProxy.h"
     
    244245            }
    245246
     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
    246311            // These are synchronous messages and should never be handled here.
    247312            case WebProcessProxyMessage::GetPlugins:
     
    296361
    297362            // 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:
    298368            case WebProcessProxyMessage::PostMessage:
    299369            case WebProcessProxyMessage::AddBackForwardItem:
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r64065 r64247  
    3737#include "WebPreferencesStore.h"
    3838#include "WebProcess.h"
     39#include "WebProcessProxyMessageKinds.h"
    3940#include <WebCore/FileChooser.h>
    4041#include <WebCore/Frame.h>
     
    386387void WebChromeClient::populateVisitedLinks()
    387388{
    388     notImplemented();
     389    WebProcess::shared().connection()->send(WebProcessProxyMessage::PopulateVisitedLinks, 0, CoreIPC::In());
    389390}
    390391
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r63866 r64247  
    547547    data.title = loader->title();
    548548
    549     WebProcess::shared().connection()->send(WebPageProxyMessage::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()));
    552552}
    553553
     
    563563    // Client redirect
    564564    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(),
    568569                                                            loader->clientRedirectDestinationForHistory(),
    569570                                                            m_frame->frameID()));
     
    572573    // Server redirect
    573574    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(),
    577579                                                            loader->serverRedirectDestinationForHistory(),
    578580                                                            m_frame->frameID()));
     
    720722        return;
    721723
    722     WebProcess::shared().connection()->send(WebPageProxyMessage::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()));
    723725}
    724726
  • trunk/WebKit2/WebProcess/WebProcess.cpp

    r64070 r64247  
    3838#include "WebProcessMessageKinds.h"
    3939#include <WebCore/ApplicationCacheStorage.h>
     40#include <WebCore/PageGroup.h>
    4041#include <WebCore/SchemeRegistry.h>
    4142#include <wtf/PassRefPtr.h>
     
    198199                return;
    199200            }
     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           
    200210            case WebProcessMessage::Create: {
    201211                uint64_t pageID = arguments->destinationID();
  • trunk/WebKitTools/ChangeLog

    r64229 r64247  
     12010-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
    1192010-07-28  Robin Dunn  <robin@alldunn.com>
    220
  • trunk/WebKitTools/MiniBrowser/mac/AppDelegate.m

    r62210 r64247  
    2929#import "BrowserStatisticsWindowController.h"
    3030
     31#import <WebKit2/WKContextPrivate.h>
    3132#import <WebKit2/WKStringCF.h>
    32 #import <WebKit2/WKContextPrivate.h>
     33#import <WebKit2/WKURLCF.h>
    3334
    3435static NSString *defaultURL = @"http://www.webkit.org/";
     
    4546    WKContextPostMessageToInjectedBundle(context, newMessage);
    4647    WKStringRelease(newMessage);
     48}
     49
     50#pragma mark History Client Callbacks
     51
     52static 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
     67static 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
     76static 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
     85static 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
     94static void populateVisitedLinks(WKContextRef context, const void *clientInfo)
     95{
     96    LOG(@"HistoryClient - populateVisitedLinks");
    4797}
    4898
     
    57107
    58108        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   
    59120        threadPageNamespace = WKPageNamespaceCreate(threadContext);
    60121        WKContextRelease(threadContext);
     
    71132        };
    72133        WKContextSetInjectedBundleClient(processContext, &bundleClient);
     134        WKContextSetHistoryClient(processContext, &historyClient);
    73135       
    74136        processPageNamespace = WKPageNamespaceCreate(processContext);
  • trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m

    r64172 r64247  
    364364}
    365365
    366 #pragma mark History Client Callbacks
    367 
    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 
    410366- (void)awakeFromNib
    411367{
     
    459415    };
    460416    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);
    472417}
    473418
Note: See TracChangeset for help on using the changeset viewer.