diff options
author | haibinlu <haibinlu@chromium.org> | 2016-01-11 13:07:32 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-11 21:08:37 +0000 |
commit | 4b4fae44258f127561853e21b92f402ea0bbeaf1 (patch) | |
tree | b95f27431829961dade78515ccfd5e4e5928ea9a /blimp/client | |
parent | 6c98508d79c87fb92e01fa10eaf76d564497fb67 (diff) | |
download | chromium_src-4b4fae44258f127561853e21b92f402ea0bbeaf1.zip chromium_src-4b4fae44258f127561853e21b92f402ea0bbeaf1.tar.gz chromium_src-4b4fae44258f127561853e21b92f402ea0bbeaf1.tar.bz2 |
[Blimp Client] Implements NavigationFeatureDelegate for Linux client
Since Linux client does not have toolbar, a dummy delegate is used.
BUG=574602
Review URL: https://codereview.chromium.org/1572033002
Cr-Commit-Position: refs/heads/master@{#368667}
Diffstat (limited to 'blimp/client')
-rw-r--r-- | blimp/client/session/blimp_client_session_linux.cc | 50 | ||||
-rw-r--r-- | blimp/client/session/blimp_client_session_linux.h | 3 | ||||
-rw-r--r-- | blimp/client/session/navigation_feature.cc | 7 |
3 files changed, 52 insertions, 8 deletions
diff --git a/blimp/client/session/blimp_client_session_linux.cc b/blimp/client/session/blimp_client_session_linux.cc index d37a02f..70aff42 100644 --- a/blimp/client/session/blimp_client_session_linux.cc +++ b/blimp/client/session/blimp_client_session_linux.cc @@ -4,20 +4,68 @@ #include "blimp/client/session/blimp_client_session_linux.h" +#include "base/logging.h" #include "base/message_loop/message_loop.h" #include "blimp/client/linux/blimp_display_manager.h" #include "ui/events/platform/platform_event_source.h" #include "ui/gfx/geometry/size.h" +#include "url/gurl.h" namespace blimp { namespace client { +namespace { + +const int kDummyTabId = 0; + +class FakeNavigationFeatureDelegate + : public NavigationFeature::NavigationFeatureDelegate { + public: + FakeNavigationFeatureDelegate(); + ~FakeNavigationFeatureDelegate(); + + // NavigationFeatureDelegate implementation. + void OnUrlChanged(int tab_id, const GURL& url) override; + void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; + void OnTitleChanged(int tab_id, const std::string& title) override; + void OnLoadingChanged(int tab_id, bool loading) override; + + private: + DISALLOW_COPY_AND_ASSIGN(FakeNavigationFeatureDelegate); +}; + +FakeNavigationFeatureDelegate::FakeNavigationFeatureDelegate() {} + +FakeNavigationFeatureDelegate::~FakeNavigationFeatureDelegate() {} + +void FakeNavigationFeatureDelegate::OnUrlChanged(int tab_id, const GURL& url) { + DVLOG(1) << "URL changed to " << url << " in tab " << tab_id; +} + +void FakeNavigationFeatureDelegate::OnFaviconChanged(int tab_id, + const SkBitmap& favicon) { + DVLOG(1) << "Favicon changed in tab " << tab_id; +} + +void FakeNavigationFeatureDelegate::OnTitleChanged(int tab_id, + const std::string& title) { + DVLOG(1) << "Title changed to " << title << " in tab " << tab_id; +} + +void FakeNavigationFeatureDelegate::OnLoadingChanged(int tab_id, bool loading) { + DVLOG(1) << "Loading status changed to " << loading << " in tab " << tab_id; +} + +} // namespace BlimpClientSessionLinux::BlimpClientSessionLinux() - : event_source_(ui::PlatformEventSource::CreateDefault()) { + : event_source_(ui::PlatformEventSource::CreateDefault()), + navigation_feature_delegate_(new FakeNavigationFeatureDelegate) { blimp_display_manager_.reset(new BlimpDisplayManager(gfx::Size(800, 600), this, GetRenderWidgetFeature(), GetTabControlFeature())); + GetNavigationFeature()->SetDelegate(kDummyTabId, + navigation_feature_delegate_.get()); } BlimpClientSessionLinux::~BlimpClientSessionLinux() {} diff --git a/blimp/client/session/blimp_client_session_linux.h b/blimp/client/session/blimp_client_session_linux.h index bee3ad9..577cbad 100644 --- a/blimp/client/session/blimp_client_session_linux.h +++ b/blimp/client/session/blimp_client_session_linux.h @@ -8,6 +8,7 @@ #include "base/macros.h" #include "blimp/client/linux/blimp_display_manager.h" #include "blimp/client/session/blimp_client_session.h" +#include "blimp/client/session/navigation_feature.h" namespace ui { class PlatformEventSource; @@ -28,6 +29,8 @@ class BlimpClientSessionLinux : public BlimpClientSession, private: scoped_ptr<ui::PlatformEventSource> event_source_; scoped_ptr<BlimpDisplayManager> blimp_display_manager_; + scoped_ptr<NavigationFeature::NavigationFeatureDelegate> + navigation_feature_delegate_; DISALLOW_COPY_AND_ASSIGN(BlimpClientSessionLinux); }; diff --git a/blimp/client/session/navigation_feature.cc b/blimp/client/session/navigation_feature.cc index bafd633..c02931a 100644 --- a/blimp/client/session/navigation_feature.cc +++ b/blimp/client/session/navigation_feature.cc @@ -85,13 +85,6 @@ void NavigationFeature::ProcessMessage( const NavigationMessage& navigation_message = message->navigation(); NavigationFeatureDelegate* delegate = FindDelegate(tab_id); - if (!delegate) { - // TODO(haibinlu): implement NavigationFeatureDelegate for Linux client. - // crbug.com/574602 - LOG(WARNING) << "NavigationFeatureDelegate not found"; - return; - } - switch (navigation_message.type()) { case NavigationMessage::NAVIGATION_STATE_CHANGED: { const NavigationStateChangeMessage& details = |