diff options
author | sky <sky@chromium.org> | 2015-07-24 10:42:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-24 17:42:44 +0000 |
commit | e818c5dc18f87a93efd2992faf2edce3af840129 (patch) | |
tree | 5d85be67ea4b67e497aafbb742baebc2fcef0b72 /components | |
parent | 9b3b8adb3c2ed5df2f6ce782e67714e0abe0aaf4 (diff) | |
download | chromium_src-e818c5dc18f87a93efd2992faf2edce3af840129.zip chromium_src-e818c5dc18f87a93efd2992faf2edce3af840129.tar.gz chromium_src-e818c5dc18f87a93efd2992faf2edce3af840129.tar.bz2 |
Adds NavigatorHost functions on Frame
There is no point in having this on a separate interface when it is
tied with the frame api. When we nuke the non-OOPIFs path we can ditch
NavigatorHost.
BUG=479172,490221
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/1249413002
Cr-Commit-Position: refs/heads/master@{#340289}
Diffstat (limited to 'components')
-rw-r--r-- | components/html_viewer/ax_provider_apptest.cc | 5 | ||||
-rw-r--r-- | components/html_viewer/html_frame_tree_manager.cc | 24 | ||||
-rw-r--r-- | components/html_viewer/html_frame_tree_manager.h | 4 |
3 files changed, 14 insertions, 19 deletions
diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index 67f7a8c4..130a56c1 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -50,6 +50,11 @@ class TestFrameTreeServer : public mandoline::FrameTreeServer { void ProgressChanged(uint32_t frame_id, double progress) override {} void SetFrameName(uint32_t frame_id, const mojo::String& name) override {} void OnCreatedFrame(uint32_t parent_id, uint32_t frame_id) override {} + void RequestNavigate(uint32_t frame_id, + mandoline::NavigationTarget target, + mojo::URLRequestPtr request) override {} + void DidNavigateLocally(uint32_t frame_id, const mojo::String& url) override { + } private: DISALLOW_COPY_AND_ASSIGN(TestFrameTreeServer); diff --git a/components/html_viewer/html_frame_tree_manager.cc b/components/html_viewer/html_frame_tree_manager.cc index 3f1f1e0..cea0023 100644 --- a/components/html_viewer/html_frame_tree_manager.cc +++ b/components/html_viewer/html_frame_tree_manager.cc @@ -26,18 +26,18 @@ namespace html_viewer { namespace { -mojo::Target WebNavigationPolicyToNavigationTarget( +mandoline::NavigationTarget WebNavigationPolicyToNavigationTarget( blink::WebNavigationPolicy policy) { switch (policy) { case blink::WebNavigationPolicyCurrentTab: - return mojo::TARGET_SOURCE_NODE; + return mandoline::NAVIGATION_TARGET_SOURCE_NODE; case blink::WebNavigationPolicyNewBackgroundTab: case blink::WebNavigationPolicyNewForegroundTab: case blink::WebNavigationPolicyNewWindow: case blink::WebNavigationPolicyNewPopup: - return mojo::TARGET_NEW_NODE; + return mandoline::NAVIGATION_TARGET_NEW_NODE; default: - return mojo::TARGET_DEFAULT; + return mandoline::NAVIGATION_TARGET_DEFAULT; } } @@ -99,7 +99,6 @@ HTMLFrameTreeManager::HTMLFrameTreeManager( delegate_(nullptr), local_frame_id_(local_frame_id), server_(server.Pass()), - navigator_host_(app_connection->GetServiceProvider()), root_(nullptr) {} HTMLFrameTreeManager::~HTMLFrameTreeManager() { @@ -140,14 +139,10 @@ blink::WebNavigationPolicy HTMLFrameTreeManager::DecidePolicyForNavigation( if (CanNavigateLocally(info.frame, info.urlRequest)) return info.defaultPolicy; - // TODO(sky): this is wrong for subframes. In fact NavigatorHost should likely - // be merged with Frame. - if (navigator_host_.get()) { - mojo::URLRequestPtr url_request = mojo::URLRequest::From(info.urlRequest); - navigator_host_->RequestNavigate( - WebNavigationPolicyToNavigationTarget(info.defaultPolicy), - url_request.Pass()); - } + mojo::URLRequestPtr url_request = mojo::URLRequest::From(info.urlRequest); + server_->RequestNavigate( + frame->id(), WebNavigationPolicyToNavigationTarget(info.defaultPolicy), + url_request.Pass()); return blink::WebNavigationPolicyIgnore; } @@ -159,8 +154,7 @@ void HTMLFrameTreeManager::OnFrameDidFinishLoad(HTMLFrame* frame) { void HTMLFrameTreeManager::OnFrameDidNavigateLocally(HTMLFrame* frame, const std::string& url) { - if (navigator_host_.get() && frame == root_) - navigator_host_->DidNavigateLocally(url); + server_->DidNavigateLocally(frame->id(), url); } void HTMLFrameTreeManager::OnFrameDestroyed(HTMLFrame* frame) { diff --git a/components/html_viewer/html_frame_tree_manager.h b/components/html_viewer/html_frame_tree_manager.h index 3ae2370..b1b08ac 100644 --- a/components/html_viewer/html_frame_tree_manager.h +++ b/components/html_viewer/html_frame_tree_manager.h @@ -7,9 +7,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" #include "mandoline/tab/public/interfaces/frame_tree.mojom.h" -#include "mojo/application/public/cpp/lazy_interface_ptr.h" #include "third_party/WebKit/public/web/WebFrameClient.h" #include "third_party/WebKit/public/web/WebNavigationPolicy.h" @@ -111,8 +109,6 @@ class HTMLFrameTreeManager : public mandoline::FrameTreeClient { mandoline::FrameTreeServerPtr server_; - mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; - HTMLFrame* root_; DISALLOW_COPY_AND_ASSIGN(HTMLFrameTreeManager); |