| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/client/app/linux/blimp_client_session_linux.h" | 5 #include "blimp/client/app/linux/blimp_client_session_linux.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "blimp/client/app/linux/blimp_display_manager.h" | 11 #include "blimp/client/app/linux/blimp_display_manager.h" |
| 12 #include "ui/events/platform/platform_event_source.h" | 12 #include "ui/events/platform/platform_event_source.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace blimp { | 16 namespace blimp { |
| 17 namespace client { | 17 namespace client { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const int kDummyTabId = 0; | 20 const int kDummyTabId = 0; |
| 21 const std::string kDefaultAssignerUrl = | 21 const char kDefaultAssignerUrl[] = |
| 22 "https://blimp-pa.googleapis.com/v1/assignment"; | 22 "https://blimp-pa.googleapis.com/v1/assignment"; |
| 23 | 23 |
| 24 class FakeNavigationFeatureDelegate | 24 class FakeNavigationFeatureDelegate |
| 25 : public NavigationFeature::NavigationFeatureDelegate { | 25 : public NavigationFeature::NavigationFeatureDelegate { |
| 26 public: | 26 public: |
| 27 FakeNavigationFeatureDelegate(); | 27 FakeNavigationFeatureDelegate(); |
| 28 ~FakeNavigationFeatureDelegate() override; | 28 ~FakeNavigationFeatureDelegate() override; |
| 29 | 29 |
| 30 // NavigationFeatureDelegate implementation. | 30 // NavigationFeatureDelegate implementation. |
| 31 void OnUrlChanged(int tab_id, const GURL& url) override; | 31 void OnUrlChanged(int tab_id, const GURL& url) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 void FakeNavigationFeatureDelegate::OnLoadingChanged(int tab_id, bool loading) { | 59 void FakeNavigationFeatureDelegate::OnLoadingChanged(int tab_id, bool loading) { |
| 60 DVLOG(1) << "Loading status changed to " << loading << " in tab " << tab_id; | 60 DVLOG(1) << "Loading status changed to " << loading << " in tab " << tab_id; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void FakeNavigationFeatureDelegate::OnPageLoadStatusUpdate(int tab_id, | 63 void FakeNavigationFeatureDelegate::OnPageLoadStatusUpdate(int tab_id, |
| 64 bool completed) { | 64 bool completed) { |
| 65 DVLOG(1) << "Page Load Status changed to completed = " << completed << | 65 DVLOG(1) << "Page Load Status changed to completed = " << completed << |
| 66 " in tab " << tab_id; | 66 " in tab " << tab_id; |
| 67 } | 67 } |
| 68 | 68 |
| 69 class FakeImeFeatureDelegate : public ImeFeature::Delegate { |
| 70 public: |
| 71 FakeImeFeatureDelegate(); |
| 72 ~FakeImeFeatureDelegate() override; |
| 73 |
| 74 // ImeFeature::Delegate implementation. |
| 75 void OnShowImeRequested(ui::TextInputType input_type, |
| 76 const std::string& text) override; |
| 77 void OnHideImeRequested() override; |
| 78 |
| 79 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(FakeImeFeatureDelegate); |
| 81 }; |
| 82 |
| 83 FakeImeFeatureDelegate::FakeImeFeatureDelegate() {} |
| 84 |
| 85 FakeImeFeatureDelegate::~FakeImeFeatureDelegate() {} |
| 86 |
| 87 void FakeImeFeatureDelegate::OnShowImeRequested(ui::TextInputType input_type, |
| 88 const std::string& text) { |
| 89 DVLOG(1) << "Show IME requested (input_type=" << input_type << ")"; |
| 90 } |
| 91 |
| 92 void FakeImeFeatureDelegate::OnHideImeRequested() { |
| 93 DVLOG(1) << "Hide IME requested"; |
| 94 } |
| 95 |
| 69 } // namespace | 96 } // namespace |
| 70 | 97 |
| 71 BlimpClientSessionLinux::BlimpClientSessionLinux() | 98 BlimpClientSessionLinux::BlimpClientSessionLinux() |
| 72 : BlimpClientSession(GURL(kDefaultAssignerUrl)), | 99 : BlimpClientSession(GURL(kDefaultAssignerUrl)), |
| 73 event_source_(ui::PlatformEventSource::CreateDefault()), | 100 event_source_(ui::PlatformEventSource::CreateDefault()), |
| 74 navigation_feature_delegate_(new FakeNavigationFeatureDelegate) { | 101 navigation_feature_delegate_(new FakeNavigationFeatureDelegate), |
| 102 ime_feature_delegate_(new FakeImeFeatureDelegate) { |
| 75 blimp_display_manager_.reset(new BlimpDisplayManager(gfx::Size(800, 600), | 103 blimp_display_manager_.reset(new BlimpDisplayManager(gfx::Size(800, 600), |
| 76 this, | 104 this, |
| 77 GetRenderWidgetFeature(), | 105 GetRenderWidgetFeature(), |
| 78 GetTabControlFeature())); | 106 GetTabControlFeature())); |
| 79 GetNavigationFeature()->SetDelegate(kDummyTabId, | 107 GetNavigationFeature()->SetDelegate(kDummyTabId, |
| 80 navigation_feature_delegate_.get()); | 108 navigation_feature_delegate_.get()); |
| 109 GetImeFeature()->set_delegate(ime_feature_delegate_.get()); |
| 81 } | 110 } |
| 82 | 111 |
| 83 BlimpClientSessionLinux::~BlimpClientSessionLinux() {} | 112 BlimpClientSessionLinux::~BlimpClientSessionLinux() {} |
| 84 | 113 |
| 85 void BlimpClientSessionLinux::OnClosed() { | 114 void BlimpClientSessionLinux::OnClosed() { |
| 86 base::MessageLoop::current()->QuitNow(); | 115 base::MessageLoop::current()->QuitNow(); |
| 87 } | 116 } |
| 88 | 117 |
| 89 } // namespace client | 118 } // namespace client |
| 90 } // namespace blimp | 119 } // namespace blimp |
| OLD | NEW |