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_DESKTOP_UI_BROWSER_WINDOW_H_ | 5 #ifndef MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ |
6 #define MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ | 6 #define MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_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 "components/mus/public/cpp/window_manager_delegate.h" |
11 #include "components/mus/public/cpp/window_tree_connection.h" | 12 #include "components/mus/public/cpp/window_tree_connection.h" |
12 #include "components/mus/public/cpp/window_tree_delegate.h" | 13 #include "components/mus/public/cpp/window_tree_delegate.h" |
13 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
14 #include "components/web_view/public/cpp/web_view.h" | 15 #include "components/web_view/public/cpp/web_view.h" |
15 #include "components/web_view/public/interfaces/web_view.mojom.h" | 16 #include "components/web_view/public/interfaces/web_view.mojom.h" |
16 #include "mandoline/ui/desktop_ui/find_bar_delegate.h" | 17 #include "mandoline/ui/desktop_ui/find_bar_delegate.h" |
17 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" | 18 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" |
18 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" | 19 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" |
19 #include "mojo/common/weak_binding_set.h" | 20 #include "mojo/common/weak_binding_set.h" |
20 #include "mojo/shell/public/cpp/interface_factory.h" | 21 #include "mojo/shell/public/cpp/interface_factory.h" |
(...skipping 16 matching lines...) Expand all Loading... |
37 } | 38 } |
38 | 39 |
39 namespace mandoline { | 40 namespace mandoline { |
40 | 41 |
41 class BrowserManager; | 42 class BrowserManager; |
42 class FindBarView; | 43 class FindBarView; |
43 class ProgressView; | 44 class ProgressView; |
44 class ToolbarView; | 45 class ToolbarView; |
45 | 46 |
46 class BrowserWindow : public mus::WindowTreeDelegate, | 47 class BrowserWindow : public mus::WindowTreeDelegate, |
47 public mus::mojom::WindowTreeHostClient, | |
48 public web_view::mojom::WebViewClient, | 48 public web_view::mojom::WebViewClient, |
49 public ViewEmbedder, | 49 public ViewEmbedder, |
50 public mojo::InterfaceFactory<ViewEmbedder>, | 50 public mojo::InterfaceFactory<ViewEmbedder>, |
51 public FindBarDelegate { | 51 public FindBarDelegate, |
| 52 public mus::WindowManagerDelegate { |
52 public: | 53 public: |
53 BrowserWindow(mojo::ApplicationImpl* app, | 54 BrowserWindow(mojo::ApplicationImpl* app, |
54 mus::mojom::WindowTreeHostFactory* host_factory, | 55 mus::mojom::WindowTreeHostFactory* host_factory, |
55 BrowserManager* manager); | 56 BrowserManager* manager); |
56 | 57 |
57 void LoadURL(const GURL& url); | 58 void LoadURL(const GURL& url); |
58 void Close(); | 59 void Close(); |
59 | 60 |
60 void ShowOmnibox(); | 61 void ShowOmnibox(); |
61 void ShowFind(); | 62 void ShowFind(); |
62 void GoBack(); | 63 void GoBack(); |
63 void GoForward(); | 64 void GoForward(); |
64 | 65 |
65 private: | 66 private: |
66 class LayoutManagerImpl; | 67 class LayoutManagerImpl; |
67 | 68 |
68 ~BrowserWindow() override; | 69 ~BrowserWindow() override; |
69 | 70 |
70 float DIPSToPixels(float value) const; | 71 float DIPSToPixels(float value) const; |
71 | 72 |
72 // Overridden from mus::WindowTreeDelegate: | 73 // Overridden from mus::WindowTreeDelegate: |
73 void OnEmbed(mus::Window* root) override; | 74 void OnEmbed(mus::Window* root) override; |
74 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 75 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
75 | 76 |
76 // Overridden from WindowTreeHostClient: | 77 // Overridden from WindowManagerDelegate: |
| 78 void SetWindowManagerClient(mus::WindowManagerClient* client) override; |
| 79 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override; |
| 80 bool OnWmSetProperty(mus::Window* window, |
| 81 const std::string& name, |
| 82 scoped_ptr<std::vector<uint8_t>>* new_data) override; |
| 83 mus::Window* OnWmCreateTopLevelWindow( |
| 84 std::map<std::string, std::vector<uint8_t>>* properties) override; |
77 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; | 85 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; |
78 | 86 |
79 // Overridden from web_view::mojom::WebViewClient: | 87 // Overridden from web_view::mojom::WebViewClient: |
80 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; | 88 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; |
81 void TopLevelNavigationStarted(const mojo::String& url) override; | 89 void TopLevelNavigationStarted(const mojo::String& url) override; |
82 void LoadingStateChanged(bool is_loading, double progress) override; | 90 void LoadingStateChanged(bool is_loading, double progress) override; |
83 void BackForwardChanged(web_view::mojom::ButtonState back_button, | 91 void BackForwardChanged(web_view::mojom::ButtonState back_button, |
84 web_view::mojom::ButtonState forward_button) override; | 92 web_view::mojom::ButtonState forward_button) override; |
85 void TitleChanged(const mojo::String& title) override; | 93 void TitleChanged(const mojo::String& title) override; |
86 void FindInPageMatchCountUpdated(int32_t request_id, | 94 void FindInPageMatchCountUpdated(int32_t request_id, |
(...skipping 13 matching lines...) Expand all Loading... |
100 // Overridden from FindBarDelegate: | 108 // Overridden from FindBarDelegate: |
101 void OnDoFind(const std::string& find, bool forward) override; | 109 void OnDoFind(const std::string& find, bool forward) override; |
102 void OnHideFindBar() override; | 110 void OnHideFindBar() override; |
103 | 111 |
104 void Init(mus::Window* root); | 112 void Init(mus::Window* root); |
105 void EmbedOmnibox(); | 113 void EmbedOmnibox(); |
106 | 114 |
107 void Layout(views::View* host); | 115 void Layout(views::View* host); |
108 | 116 |
109 mojo::ApplicationImpl* app_; | 117 mojo::ApplicationImpl* app_; |
| 118 mus::WindowManagerClient* window_manager_client_; |
110 scoped_ptr<ui::mojo::UIInit> ui_init_; | 119 scoped_ptr<ui::mojo::UIInit> ui_init_; |
111 scoped_ptr<views::AuraInit> aura_init_; | 120 scoped_ptr<views::AuraInit> aura_init_; |
112 mus::mojom::WindowTreeHostPtr host_; | 121 mus::mojom::WindowTreeHostPtr host_; |
113 mojo::Binding<WindowTreeHostClient> host_client_binding_; | |
114 BrowserManager* manager_; | 122 BrowserManager* manager_; |
115 ToolbarView* toolbar_view_; | 123 ToolbarView* toolbar_view_; |
116 ProgressView* progress_bar_; | 124 ProgressView* progress_bar_; |
117 FindBarView* find_bar_view_; | 125 FindBarView* find_bar_view_; |
118 mus::Window* root_; | 126 mus::Window* root_; |
119 mus::Window* content_; | 127 mus::Window* content_; |
120 mus::Window* omnibox_view_; | 128 mus::Window* omnibox_view_; |
121 | 129 |
122 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; | 130 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; |
123 | 131 |
(...skipping 10 matching lines...) Expand all Loading... |
134 | 142 |
135 OmniboxPtr omnibox_; | 143 OmniboxPtr omnibox_; |
136 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; | 144 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; |
137 | 145 |
138 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); | 146 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); |
139 }; | 147 }; |
140 | 148 |
141 } // namespace mandoline | 149 } // namespace mandoline |
142 | 150 |
143 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ | 151 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ |
OLD | NEW |