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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/mus/public/cpp/view_observer.h" | 10 #include "components/mus/public/cpp/view_observer.h" |
11 #include "components/mus/public/cpp/view_tree_delegate.h" | 11 #include "components/mus/public/cpp/view_tree_delegate.h" |
12 #include "components/mus/public/interfaces/view_tree_host.mojom.h" | 12 #include "components/mus/public/interfaces/view_tree_host.mojom.h" |
13 #include "components/web_view/public/cpp/web_view.h" | 13 #include "components/web_view/public/cpp/web_view.h" |
14 #include "components/web_view/public/interfaces/web_view.mojom.h" | 14 #include "components/web_view/public/interfaces/web_view.mojom.h" |
15 // TODO(beng): move this file somewhere common. | 15 // TODO(beng): move this file somewhere common. |
16 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" | 16 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" |
17 #include "mojo/application/public/cpp/application_delegate.h" | 17 #include "mojo/application/public/cpp/application_delegate.h" |
18 #include "mojo/application/public/cpp/interface_factory.h" | 18 #include "mojo/application/public/cpp/interface_factory.h" |
19 #include "mojo/common/weak_binding_set.h" | 19 #include "mojo/common/weak_binding_set.h" |
20 | 20 |
21 namespace mus { | 21 namespace mojo { |
22 class View; | 22 class View; |
23 } | 23 } |
24 | 24 |
25 namespace mandoline { | 25 namespace mandoline { |
26 | 26 |
27 class PhoneBrowserApplicationDelegate | 27 class PhoneBrowserApplicationDelegate : |
28 : public mojo::ApplicationDelegate, | 28 public mojo::ApplicationDelegate, |
29 public LaunchHandler, | 29 public LaunchHandler, |
30 public mus::ViewTreeDelegate, | 30 public mojo::ViewTreeDelegate, |
31 public mus::ViewObserver, | 31 public mojo::ViewObserver, |
32 public web_view::mojom::WebViewClient, | 32 public web_view::mojom::WebViewClient, |
33 public mojo::InterfaceFactory<LaunchHandler> { | 33 public mojo::InterfaceFactory<LaunchHandler> { |
34 public: | 34 public: |
35 PhoneBrowserApplicationDelegate(); | 35 PhoneBrowserApplicationDelegate(); |
36 ~PhoneBrowserApplicationDelegate() override; | 36 ~PhoneBrowserApplicationDelegate() override; |
37 | 37 |
38 private: | 38 private: |
39 // Overridden from mojo::ApplicationDelegate: | 39 // Overridden from mojo::ApplicationDelegate: |
40 void Initialize(mojo::ApplicationImpl* app) override; | 40 void Initialize(mojo::ApplicationImpl* app) override; |
41 bool ConfigureIncomingConnection( | 41 bool ConfigureIncomingConnection( |
42 mojo::ApplicationConnection* connection) override; | 42 mojo::ApplicationConnection* connection) override; |
43 | 43 |
44 // Overridden from LaunchHandler: | 44 // Overridden from LaunchHandler: |
45 void LaunchURL(const mojo::String& url) override; | 45 void LaunchURL(const mojo::String& url) override; |
46 | 46 |
47 // Overridden from mus::ViewTreeDelegate: | 47 // Overridden from mojo::ViewTreeDelegate: |
48 void OnEmbed(mus::View* root) override; | 48 void OnEmbed(mojo::View* root) override; |
49 void OnConnectionLost(mus::ViewTreeConnection* connection) override; | 49 void OnConnectionLost(mojo::ViewTreeConnection* connection) override; |
50 | 50 |
51 // Overridden from mus::ViewObserver: | 51 // Overridden from mojo::ViewObserver: |
52 void OnViewBoundsChanged(mus::View* view, | 52 void OnViewBoundsChanged(mojo::View* view, |
53 const mojo::Rect& old_bounds, | 53 const mojo::Rect& old_bounds, |
54 const mojo::Rect& new_bounds) override; | 54 const mojo::Rect& new_bounds) override; |
55 | 55 |
56 // Overridden from web_view::mojom::WebViewClient: | 56 // Overridden from web_view::mojom::WebViewClient: |
57 void TopLevelNavigate(mojo::URLRequestPtr request) override; | 57 void TopLevelNavigate(mojo::URLRequestPtr request) override; |
58 void LoadingStateChanged(bool is_loading) override; | 58 void LoadingStateChanged(bool is_loading) override; |
59 void ProgressChanged(double progress) override; | 59 void ProgressChanged(double progress) override; |
60 void BackForwardChanged(web_view::mojom::ButtonState back_button, | 60 void BackForwardChanged(web_view::mojom::ButtonState back_button, |
61 web_view::mojom::ButtonState forward_button) override; | 61 web_view::mojom::ButtonState forward_button) override; |
62 void TitleChanged(const mojo::String& title) override; | 62 void TitleChanged(const mojo::String& title) override; |
63 | 63 |
64 // Overridden from mojo::InterfaceFactory<LaunchHandler>: | 64 // Overridden from mojo::InterfaceFactory<LaunchHandler>: |
65 void Create(mojo::ApplicationConnection* connection, | 65 void Create(mojo::ApplicationConnection* connection, |
66 mojo::InterfaceRequest<LaunchHandler> request) override; | 66 mojo::InterfaceRequest<LaunchHandler> request) override; |
67 | 67 |
68 mojo::ApplicationImpl* app_; | 68 mojo::ApplicationImpl* app_; |
69 mojo::ViewTreeHostPtr host_; | 69 mojo::ViewTreeHostPtr host_; |
70 | 70 |
71 mus::View* root_; | 71 mojo::View* root_; |
72 mus::View* content_; | 72 mojo::View* content_; |
73 web_view::WebView web_view_; | 73 web_view::WebView web_view_; |
74 | 74 |
75 mojo::String default_url_; | 75 mojo::String default_url_; |
76 | 76 |
77 mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_; | 77 mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(PhoneBrowserApplicationDelegate); | 79 DISALLOW_COPY_AND_ASSIGN(PhoneBrowserApplicationDelegate); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace mandoline | 82 } // namespace mandoline |
83 | 83 |
84 #endif // MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ | 84 #endif // MANDOLINE_UI_PHONE_UI_PHONE_BROWSER_APPLICATION_DELEGATE_H_ |
OLD | NEW |