⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179786 in webkit


Ignore:
Timestamp:
Feb 7, 2015, 3:46:18 PM (12 years ago)
Author:
timothy_horton@apple.com
Message:

Add API::HistoryClient and split some things out of API::NavigationClient
https://bugs.webkit.org/show_bug.cgi?id=141264

Reviewed by Darin Adler.

  • UIProcess/API/APIHistoryClient.h: Added.

(API::HistoryClient::~HistoryClient):
(API::HistoryClient::didNavigateWithNavigationData):
(API::HistoryClient::didPerformClientRedirect):
(API::HistoryClient::didPerformServerRedirect):
(API::HistoryClient::didUpdateHistoryTitle):

  • UIProcess/API/APINavigationClient.h:

(API::NavigationClient::didNavigateWithNavigationData): Deleted.
(API::NavigationClient::didPerformClientRedirect): Deleted.
(API::NavigationClient::didPerformServerRedirect): Deleted.
(API::NavigationClient::didUpdateHistoryTitle): Deleted.

  • UIProcess/Cocoa/NavigationState.h:
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::NavigationState::createHistoryClient):
(WebKit::NavigationState::HistoryClient::HistoryClient):
(WebKit::NavigationState::HistoryClient::~HistoryClient):
(WebKit::NavigationState::HistoryClient::didNavigateWithNavigationData):
(WebKit::NavigationState::HistoryClient::didPerformClientRedirect):
(WebKit::NavigationState::HistoryClient::didPerformServerRedirect):
(WebKit::NavigationState::HistoryClient::didUpdateHistoryTitle):
(WebKit::NavigationState::NavigationClient::didNavigateWithNavigationData): Deleted.
(WebKit::NavigationState::NavigationClient::didPerformClientRedirect): Deleted.
(WebKit::NavigationState::NavigationClient::didPerformServerRedirect): Deleted.
(WebKit::NavigationState::NavigationClient::didUpdateHistoryTitle): Deleted.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setHistoryClient):
(WebKit::WebPageProxy::didNavigateWithNavigationData):
(WebKit::WebPageProxy::didPerformClientRedirect):
(WebKit::WebPageProxy::didPerformServerRedirect):
(WebKit::WebPageProxy::didUpdateHistoryTitle):

  • UIProcess/WebPageProxy.h:

Add a API::HistoryClient and move the few things that belong on it out of API::NavigationClient.
Adjust accordingly in WebPageProxy and NavigationState.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView setNavigationDelegate:]):
(-[WKWebView setUIDelegate:]):
(-[WKWebView _setHistoryDelegate:]):
Lazily push the NavigationState/UIDelegate clients down to WebPageProxy upon
installation of a delegate, so that alternative (C SPI) delegate setters can
be separately created.

  • WebKit2.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebKit2
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r179782 r179786  
     12015-02-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add API::HistoryClient and split some things out of API::NavigationClient
     4        https://bugs.webkit.org/show_bug.cgi?id=141264
     5
     6        Reviewed by Darin Adler.
     7
     8        * UIProcess/API/APIHistoryClient.h: Added.
     9        (API::HistoryClient::~HistoryClient):
     10        (API::HistoryClient::didNavigateWithNavigationData):
     11        (API::HistoryClient::didPerformClientRedirect):
     12        (API::HistoryClient::didPerformServerRedirect):
     13        (API::HistoryClient::didUpdateHistoryTitle):
     14        * UIProcess/API/APINavigationClient.h:
     15        (API::NavigationClient::didNavigateWithNavigationData): Deleted.
     16        (API::NavigationClient::didPerformClientRedirect): Deleted.
     17        (API::NavigationClient::didPerformServerRedirect): Deleted.
     18        (API::NavigationClient::didUpdateHistoryTitle): Deleted.
     19        * UIProcess/Cocoa/NavigationState.h:
     20        * UIProcess/Cocoa/NavigationState.mm:
     21        (WebKit::NavigationState::createHistoryClient):
     22        (WebKit::NavigationState::HistoryClient::HistoryClient):
     23        (WebKit::NavigationState::HistoryClient::~HistoryClient):
     24        (WebKit::NavigationState::HistoryClient::didNavigateWithNavigationData):
     25        (WebKit::NavigationState::HistoryClient::didPerformClientRedirect):
     26        (WebKit::NavigationState::HistoryClient::didPerformServerRedirect):
     27        (WebKit::NavigationState::HistoryClient::didUpdateHistoryTitle):
     28        (WebKit::NavigationState::NavigationClient::didNavigateWithNavigationData): Deleted.
     29        (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): Deleted.
     30        (WebKit::NavigationState::NavigationClient::didPerformServerRedirect): Deleted.
     31        (WebKit::NavigationState::NavigationClient::didUpdateHistoryTitle): Deleted.
     32        * UIProcess/WebPageProxy.cpp:
     33        (WebKit::WebPageProxy::setHistoryClient):
     34        (WebKit::WebPageProxy::didNavigateWithNavigationData):
     35        (WebKit::WebPageProxy::didPerformClientRedirect):
     36        (WebKit::WebPageProxy::didPerformServerRedirect):
     37        (WebKit::WebPageProxy::didUpdateHistoryTitle):
     38        * UIProcess/WebPageProxy.h:
     39        Add a API::HistoryClient and move the few things that belong on it out of API::NavigationClient.
     40        Adjust accordingly in WebPageProxy and NavigationState.
     41
     42        * UIProcess/API/Cocoa/WKWebView.mm:
     43        (-[WKWebView initWithFrame:configuration:]):
     44        (-[WKWebView setNavigationDelegate:]):
     45        (-[WKWebView setUIDelegate:]):
     46        (-[WKWebView _setHistoryDelegate:]):
     47        Lazily push the NavigationState/UIDelegate clients down to WebPageProxy upon
     48        installation of a delegate, so that alternative (C SPI) delegate setters can
     49        be separately created.
     50
     51        * WebKit2.xcodeproj/project.pbxproj:
     52
    1532015-02-07  Antti Koivisto  <antti@apple.com>
    254
  • trunk/Source/WebKit2/UIProcess/API/APINavigationClient.h

    r179588 r179786  
    8686    virtual PassRefPtr<Data> webCryptoMasterKey(WebKit::WebPageProxy&) { return nullptr; }
    8787
    88     virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&) { }
    89     virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&) { }
    90     virtual void didPerformServerRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&) { }
    91     virtual void didUpdateHistoryTitle(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&) { }
    92 
    9388#if USE(QUICK_LOOK)
    9489    virtual void didStartLoadForQuickLookDocumentInMainFrame(const WTF::String& fileName, const WTF::String& uti) { }
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r179752 r179786  
    358358
    359359    _navigationState = std::make_unique<WebKit::NavigationState>(self);
    360     _page->setNavigationClient(_navigationState->createNavigationClient());
    361 
    362360    _uiDelegate = std::make_unique<WebKit::UIDelegate>(self);
    363     _page->setUIClient(_uiDelegate->createUIClient());
    364 
    365361    _page->setFindClient(std::make_unique<WebKit::FindClient>(self));
    366362    _page->setDiagnosticLoggingClient(std::make_unique<WebKit::DiagnosticLoggingClient>(self));
     
    413409- (void)setNavigationDelegate:(id <WKNavigationDelegate>)navigationDelegate
    414410{
     411    _page->setNavigationClient(_navigationState->createNavigationClient());
    415412    _navigationState->setNavigationDelegate(navigationDelegate);
    416413}
     
    423420- (void)setUIDelegate:(id<WKUIDelegate>)UIDelegate
    424421{
     422    _page->setUIClient(_uiDelegate->createUIClient());
    425423    _uiDelegate->setDelegate(UIDelegate);
    426424}
     
    16681666- (void)_setHistoryDelegate:(id <WKHistoryDelegatePrivate>)historyDelegate
    16691667{
     1668    _page->setHistoryClient(_navigationState->createHistoryClient());
    16701669    _navigationState->setHistoryDelegate(historyDelegate);
    16711670}
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r179430 r179786  
    3131#if WK_API_ENABLED
    3232
     33#import "APIHistoryClient.h"
    3334#import "APINavigationClient.h"
    3435#import "PageLoadState.h"
     
    5859
    5960    std::unique_ptr<API::NavigationClient> createNavigationClient();
     61    std::unique_ptr<API::HistoryClient> createHistoryClient();
    6062
    6163    RetainPtr<id <WKNavigationDelegate> > navigationDelegate();
     
    9597        virtual PassRefPtr<API::Data> webCryptoMasterKey(WebPageProxy&) override;
    9698
    97         virtual void didNavigateWithNavigationData(WebPageProxy&, const WebNavigationDataStore&) override;
    98         virtual void didPerformClientRedirect(WebPageProxy&, const WTF::String&, const WTF::String&) override;
    99         virtual void didPerformServerRedirect(WebPageProxy&, const WTF::String&, const WTF::String&) override;
    100         virtual void didUpdateHistoryTitle(WebPageProxy&, const WTF::String&, const WTF::String&) override;
    101 
    10299#if USE(QUICK_LOOK)
    103100        virtual void didStartLoadForQuickLookDocumentInMainFrame(const WTF::String& fileName, const WTF::String& uti) override;
     
    108105        virtual void decidePolicyForNavigationResponse(WebPageProxy&, API::NavigationResponse&, Ref<WebFramePolicyListenerProxy>&&, API::Object* userData) override;
    109106
     107        NavigationState& m_navigationState;
     108    };
     109   
     110    class HistoryClient final : public API::HistoryClient {
     111    public:
     112        explicit HistoryClient(NavigationState&);
     113        ~HistoryClient();
     114       
     115    private:
     116        virtual void didNavigateWithNavigationData(WebPageProxy&, const WebNavigationDataStore&) override;
     117        virtual void didPerformClientRedirect(WebPageProxy&, const WTF::String&, const WTF::String&) override;
     118        virtual void didPerformServerRedirect(WebPageProxy&, const WTF::String&, const WTF::String&) override;
     119        virtual void didUpdateHistoryTitle(WebPageProxy&, const WTF::String&, const WTF::String&) override;
     120       
    110121        NavigationState& m_navigationState;
    111122    };
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r179430 r179786  
    109109    return std::make_unique<NavigationClient>(*this);
    110110}
     111   
     112std::unique_ptr<API::HistoryClient> NavigationState::createHistoryClient()
     113{
     114    return std::make_unique<HistoryClient>(*this);
     115}
    111116
    112117RetainPtr<id <WKNavigationDelegate> > NavigationState::navigationDelegate()
     
    635640
    636641// HistoryDelegatePrivate support
    637 
    638 void NavigationState::NavigationClient::didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore& navigationDataStore)
     642   
     643NavigationState::HistoryClient::HistoryClient(NavigationState& navigationState)
     644    : m_navigationState(navigationState)
     645{
     646}
     647
     648NavigationState::HistoryClient::~HistoryClient()
     649{
     650}
     651
     652void NavigationState::HistoryClient::didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore& navigationDataStore)
    639653{
    640654    if (!m_navigationState.m_historyDelegateMethods.webViewDidNavigateWithNavigationData)
     
    648662}
    649663
    650 void NavigationState::NavigationClient::didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL)
     664void NavigationState::HistoryClient::didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL)
    651665{
    652666    if (!m_navigationState.m_historyDelegateMethods.webViewDidPerformClientRedirectFromURLToURL)
     
    660674}
    661675
    662 void NavigationState::NavigationClient::didPerformServerRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL)
     676void NavigationState::HistoryClient::didPerformServerRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL)
    663677{
    664678    if (!m_navigationState.m_historyDelegateMethods.webViewDidPerformServerRedirectFromURLToURL)
     
    672686}
    673687
    674 void NavigationState::NavigationClient::didUpdateHistoryTitle(WebKit::WebPageProxy&, const WTF::String& title, const WTF::String& url)
     688void NavigationState::HistoryClient::didUpdateHistoryTitle(WebKit::WebPageProxy&, const WTF::String& title, const WTF::String& url)
    675689{
    676690    if (!m_navigationState.m_historyDelegateMethods.webViewDidUpdateHistoryTitleForURL)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r179588 r179786  
    3434#include "APIFrameInfo.h"
    3535#include "APIGeometry.h"
     36#include "APIHistoryClient.h"
    3637#include "APILegacyContextHistoryClient.h"
    3738#include "APILoaderClient.h"
     
    509510    preferencesDidChange();
    510511}
     512   
     513void WebPageProxy::setHistoryClient(std::unique_ptr<API::HistoryClient> historyClient)
     514{
     515    m_historyClient = WTF::move(historyClient);
     516}
    511517
    512518void WebPageProxy::setNavigationClient(std::unique_ptr<API::NavigationClient> navigationClient)
     
    31563162    MESSAGE_CHECK(frame->page() == this);
    31573163
    3158     if (m_navigationClient) {
     3164    if (m_historyClient) {
    31593165        if (frame->isMainFrame())
    3160             m_navigationClient->didNavigateWithNavigationData(*this, store);
     3166            m_historyClient->didNavigateWithNavigationData(*this, store);
    31613167    } else
    31623168        m_loaderClient->didNavigateWithNavigationData(*this, store, *frame);
     
    31763182    MESSAGE_CHECK_URL(destinationURLString);
    31773183
    3178     if (m_navigationClient) {
     3184    if (m_historyClient) {
    31793185        if (frame->isMainFrame())
    3180             m_navigationClient->didPerformClientRedirect(*this, sourceURLString, destinationURLString);
     3186            m_historyClient->didPerformClientRedirect(*this, sourceURLString, destinationURLString);
    31813187    } else
    31823188        m_loaderClient->didPerformClientRedirect(*this, sourceURLString, destinationURLString, *frame);
     
    31963202    MESSAGE_CHECK_URL(destinationURLString);
    31973203
    3198     if (m_navigationClient) {
     3204    if (m_historyClient) {
    31993205        if (frame->isMainFrame())
    3200             m_navigationClient->didPerformServerRedirect(*this, sourceURLString, destinationURLString);
     3206            m_historyClient->didPerformServerRedirect(*this, sourceURLString, destinationURLString);
    32013207    } else
    32023208        m_loaderClient->didPerformServerRedirect(*this, sourceURLString, destinationURLString, *frame);
     
    32123218    MESSAGE_CHECK_URL(url);
    32133219
    3214     if (m_navigationClient) {
     3220    if (m_historyClient) {
    32153221        if (frame->isMainFrame())
    3216             m_navigationClient->didUpdateHistoryTitle(*this, title, url);
     3222            m_historyClient->didUpdateHistoryTitle(*this, title, url);
    32173223    } else
    32183224        m_loaderClient->didUpdateHistoryTitle(*this, title, url, *frame);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r179430 r179786  
    116116class FindClient;
    117117class FormClient;
     118class HistoryClient;
    118119class LoaderClient;
    119120class Navigation;
     
    317318    void setFormClient(std::unique_ptr<API::FormClient>);
    318319    void setNavigationClient(std::unique_ptr<API::NavigationClient>);
     320    void setHistoryClient(std::unique_ptr<API::HistoryClient>);
    319321    void setLoaderClient(std::unique_ptr<API::LoaderClient>);
    320322    void setPolicyClient(std::unique_ptr<API::PolicyClient>);
     
    13751377    std::unique_ptr<API::PolicyClient> m_policyClient;
    13761378    std::unique_ptr<API::NavigationClient> m_navigationClient;
     1379    std::unique_ptr<API::HistoryClient> m_historyClient;
    13771380    std::unique_ptr<API::FormClient> m_formClient;
    13781381    std::unique_ptr<API::UIClient> m_uiClient;
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r179588 r179786  
    650650                2DABA7721A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7711A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h */; };
    651651                2DABA7741A817EE600EF0F1A /* WKPluginLoadPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7731A817EE600EF0F1A /* WKPluginLoadPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
     652                2DABA7761A82B42100EF0F1A /* APIHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */; };
    652653                2DACE64E18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */; };
    653654                2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; };
     
    27722773                2DABA7711A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEventsInternal.h; sourceTree = "<group>"; };
    27732774                2DABA7731A817EE600EF0F1A /* WKPluginLoadPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginLoadPolicy.h; sourceTree = "<group>"; };
     2775                2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIHistoryClient.h; sourceTree = "<group>"; };
    27742776                2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKThumbnailViewInternal.h; sourceTree = "<group>"; };
    27752777                2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationController.h; path = ios/SmartMagnificationController.h; sourceTree = "<group>"; };
     
    61856187                                2DF9EEE31A781FB400B6CFBE /* APIFrameInfo.cpp */,
    61866188                                2DF9EEE41A781FB400B6CFBE /* APIFrameInfo.h */,
     6189                                2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */,
    61876190                                7CE4D2061A46775700C7F152 /* APILegacyContextHistoryClient.h */,
    61886191                                1A2464F21891E45100234C5B /* APILoaderClient.h */,
     
    77877790                                296BD85D15019BC30071F424 /* StringUtilities.h in Headers */,
    77887791                                CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */,
     7792                                2DABA7761A82B42100EF0F1A /* APIHistoryClient.h in Headers */,
    77897793                                1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */,
    77907794                                1QQ417CB12C00CCA002BE67B /* TextCheckerCompletion.h in Headers */,
Note: See TracChangeset for help on using the changeset viewer.