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