| 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 #ifndef MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ | 5 #ifndef MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ |
| 6 #define MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ | 6 #define MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/mus/public/cpp/window_observer.h" | 12 #include "components/mus/public/cpp/window_observer.h" |
| 13 #include "components/mus/public/cpp/window_tree_delegate.h" | 13 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 14 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 15 #include "components/web_view/public/cpp/web_view.h" | 15 #include "components/web_view/public/cpp/web_view.h" |
| 16 #include "components/web_view/public/interfaces/web_view.mojom.h" | 16 #include "components/web_view/public/interfaces/web_view.mojom.h" |
| 17 // TODO(beng): move this file somewhere common. | 17 // TODO(beng): move this file somewhere common. |
| 18 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" | 18 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" |
| 19 #include "mojo/common/weak_binding_set.h" | 19 #include "mojo/common/weak_binding_set.h" |
| 20 #include "mojo/shell/public/cpp/application_delegate.h" | |
| 21 #include "mojo/shell/public/cpp/interface_factory.h" | 20 #include "mojo/shell/public/cpp/interface_factory.h" |
| 21 #include "mojo/shell/public/cpp/shell_client.h" |
| 22 | 22 |
| 23 namespace mus { | 23 namespace mus { |
| 24 class View; | 24 class View; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace mandoline { | 27 namespace mandoline { |
| 28 | 28 |
| 29 class PhoneBrowserApplicationDelegate | 29 class PhoneBrowserApplicationDelegate |
| 30 : public mojo::ApplicationDelegate, | 30 : public mojo::ShellClient, |
| 31 public LaunchHandler, | 31 public LaunchHandler, |
| 32 public mus::WindowTreeDelegate, | 32 public mus::WindowTreeDelegate, |
| 33 public mus::WindowObserver, | 33 public mus::WindowObserver, |
| 34 public web_view::mojom::WebViewClient, | 34 public web_view::mojom::WebViewClient, |
| 35 public mojo::InterfaceFactory<LaunchHandler> { | 35 public mojo::InterfaceFactory<LaunchHandler> { |
| 36 public: | 36 public: |
| 37 PhoneBrowserApplicationDelegate(); | 37 PhoneBrowserApplicationDelegate(); |
| 38 ~PhoneBrowserApplicationDelegate() override; | 38 ~PhoneBrowserApplicationDelegate() override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Overridden from mojo::ApplicationDelegate: | 41 // Overridden from mojo::ShellClient: |
| 42 void Initialize(mojo::Shell* shell, const std::string& url, | 42 void Initialize(mojo::Shell* shell, const std::string& url, |
| 43 uint32_t id) override; | 43 uint32_t id) override; |
| 44 bool AcceptConnection( | 44 bool AcceptConnection(mojo::Connection* connection) override; |
| 45 mojo::ApplicationConnection* connection) override; | |
| 46 | 45 |
| 47 // Overridden from LaunchHandler: | 46 // Overridden from LaunchHandler: |
| 48 void LaunchURL(const mojo::String& url) override; | 47 void LaunchURL(const mojo::String& url) override; |
| 49 | 48 |
| 50 // Overridden from mus::WindowTreeDelegate: | 49 // Overridden from mus::WindowTreeDelegate: |
| 51 void OnEmbed(mus::Window* root) override; | 50 void OnEmbed(mus::Window* root) override; |
| 52 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 51 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 53 | 52 |
| 54 // Overridden from mus::WindowObserver: | 53 // Overridden from mus::WindowObserver: |
| 55 void OnWindowBoundsChanged(mus::Window* view, | 54 void OnWindowBoundsChanged(mus::Window* view, |
| 56 const gfx::Rect& old_bounds, | 55 const gfx::Rect& old_bounds, |
| 57 const gfx::Rect& new_bounds) override; | 56 const gfx::Rect& new_bounds) override; |
| 58 | 57 |
| 59 // Overridden from web_view::mojom::WebViewClient: | 58 // Overridden from web_view::mojom::WebViewClient: |
| 60 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; | 59 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; |
| 61 void TopLevelNavigationStarted(const mojo::String& url) override; | 60 void TopLevelNavigationStarted(const mojo::String& url) override; |
| 62 void LoadingStateChanged(bool is_loading, double progress) override; | 61 void LoadingStateChanged(bool is_loading, double progress) override; |
| 63 void BackForwardChanged(web_view::mojom::ButtonState back_button, | 62 void BackForwardChanged(web_view::mojom::ButtonState back_button, |
| 64 web_view::mojom::ButtonState forward_button) override; | 63 web_view::mojom::ButtonState forward_button) override; |
| 65 void TitleChanged(const mojo::String& title) override; | 64 void TitleChanged(const mojo::String& title) override; |
| 66 void FindInPageMatchCountUpdated(int32_t request_id, | 65 void FindInPageMatchCountUpdated(int32_t request_id, |
| 67 int32_t count, | 66 int32_t count, |
| 68 bool final_update) override {} | 67 bool final_update) override {} |
| 69 void FindInPageSelectionUpdated(int32_t request_id, | 68 void FindInPageSelectionUpdated(int32_t request_id, |
| 70 int32_t active_match_ordinal) override {} | 69 int32_t active_match_ordinal) override {} |
| 71 | 70 |
| 72 // Overridden from mojo::InterfaceFactory<LaunchHandler>: | 71 // Overridden from mojo::InterfaceFactory<LaunchHandler>: |
| 73 void Create(mojo::ApplicationConnection* connection, | 72 void Create(mojo::Connection* connection, |
| 74 mojo::InterfaceRequest<LaunchHandler> request) override; | 73 mojo::InterfaceRequest<LaunchHandler> request) override; |
| 75 | 74 |
| 76 mojo::Shell* shell_; | 75 mojo::Shell* shell_; |
| 77 mus::mojom::WindowTreeHostPtr host_; | 76 mus::mojom::WindowTreeHostPtr host_; |
| 78 | 77 |
| 79 mus::Window* root_; | 78 mus::Window* root_; |
| 80 mus::Window* content_; | 79 mus::Window* content_; |
| 81 web_view::WebView web_view_; | 80 web_view::WebView web_view_; |
| 82 | 81 |
| 83 mojo::String default_url_; | 82 mojo::String default_url_; |
| 84 | 83 |
| 85 mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_; | 84 mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_; |
| 86 | 85 |
| 87 DISALLOW_COPY_AND_ASSIGN(PhoneBrowserApplicationDelegate); | 86 DISALLOW_COPY_AND_ASSIGN(PhoneBrowserApplicationDelegate); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 } // namespace mandoline | 89 } // namespace mandoline |
| 91 | 90 |
| 92 #endif // MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ | 91 #endif // MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ |
| OLD | NEW |