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 "components/mus/public/cpp/view_tree_connection.h" | 8 #include "components/mus/public/cpp/view_tree_connection.h" |
9 #include "components/mus/public/cpp/view_tree_delegate.h" | 9 #include "components/mus/public/cpp/view_tree_delegate.h" |
10 #include "components/mus/public/interfaces/view_tree_host.mojom.h" | 10 #include "components/mus/public/interfaces/view_tree_host.mojom.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class Shell; | 23 class Shell; |
24 class View; | 24 class View; |
25 } | 25 } |
26 | 26 |
27 namespace mandoline { | 27 namespace mandoline { |
28 | 28 |
29 class BrowserManager; | 29 class BrowserManager; |
30 class ProgressView; | 30 class ProgressView; |
31 class ToolbarView; | 31 class ToolbarView; |
32 | 32 |
33 class BrowserWindow : public mojo::ViewTreeDelegate, | 33 class BrowserWindow : public mus::ViewTreeDelegate, |
34 public mojo::ViewTreeHostClient, | 34 public mojo::ViewTreeHostClient, |
35 public web_view::mojom::WebViewClient, | 35 public web_view::mojom::WebViewClient, |
36 public ViewEmbedder, | 36 public ViewEmbedder, |
37 public mojo::InterfaceFactory<ViewEmbedder>, | 37 public mojo::InterfaceFactory<ViewEmbedder>, |
38 public views::LayoutManager { | 38 public views::LayoutManager { |
39 public: | 39 public: |
40 BrowserWindow(mojo::ApplicationImpl* app, | 40 BrowserWindow(mojo::ApplicationImpl* app, |
41 mojo::ViewTreeHostFactory* host_factory, | 41 mojo::ViewTreeHostFactory* host_factory, |
42 BrowserManager* manager); | 42 BrowserManager* manager); |
43 | 43 |
44 void LoadURL(const GURL& url); | 44 void LoadURL(const GURL& url); |
45 void Close(); | 45 void Close(); |
46 | 46 |
47 void ShowOmnibox(); | 47 void ShowOmnibox(); |
48 void GoBack(); | 48 void GoBack(); |
49 void GoForward(); | 49 void GoForward(); |
50 | 50 |
51 private: | 51 private: |
52 ~BrowserWindow() override; | 52 ~BrowserWindow() override; |
53 | 53 |
54 float DIPSToPixels(float value) const; | 54 float DIPSToPixels(float value) const; |
55 | 55 |
56 // Overridden from mojo::ViewTreeDelegate: | 56 // Overridden from mus::ViewTreeDelegate: |
57 void OnEmbed(mojo::View* root) override; | 57 void OnEmbed(mus::View* root) override; |
58 void OnConnectionLost(mojo::ViewTreeConnection* connection) override; | 58 void OnConnectionLost(mus::ViewTreeConnection* connection) override; |
59 | 59 |
60 // Overridden from ViewTreeHostClient: | 60 // Overridden from ViewTreeHostClient: |
61 void OnAccelerator(uint32_t id, mojo::EventPtr event) override; | 61 void OnAccelerator(uint32_t id, mojo::EventPtr event) override; |
62 | 62 |
63 // Overridden from web_view::mojom::WebViewClient: | 63 // Overridden from web_view::mojom::WebViewClient: |
64 void TopLevelNavigate(mojo::URLRequestPtr request) override; | 64 void TopLevelNavigate(mojo::URLRequestPtr request) override; |
65 void LoadingStateChanged(bool is_loading, double progress) override; | 65 void LoadingStateChanged(bool is_loading, double progress) override; |
66 void BackForwardChanged(web_view::mojom::ButtonState back_button, | 66 void BackForwardChanged(web_view::mojom::ButtonState back_button, |
67 web_view::mojom::ButtonState forward_button) override; | 67 web_view::mojom::ButtonState forward_button) override; |
68 void TitleChanged(const mojo::String& title) override; | 68 void TitleChanged(const mojo::String& title) override; |
69 | 69 |
70 // Overridden from ViewEmbedder: | 70 // Overridden from ViewEmbedder: |
71 void Embed(mojo::URLRequestPtr request) override; | 71 void Embed(mojo::URLRequestPtr request) override; |
72 | 72 |
73 // Overridden from mojo::InterfaceFactory<ViewEmbedder>: | 73 // Overridden from mojo::InterfaceFactory<ViewEmbedder>: |
74 void Create(mojo::ApplicationConnection* connection, | 74 void Create(mojo::ApplicationConnection* connection, |
75 mojo::InterfaceRequest<ViewEmbedder> request) override; | 75 mojo::InterfaceRequest<ViewEmbedder> request) override; |
76 | 76 |
77 | 77 |
78 // Overridden from views::LayoutManager: | 78 // Overridden from views::LayoutManager: |
79 gfx::Size GetPreferredSize(const views::View* view) const override; | 79 gfx::Size GetPreferredSize(const views::View* view) const override; |
80 void Layout(views::View* host) override; | 80 void Layout(views::View* host) override; |
81 | 81 |
82 void Init(mojo::View* root); | 82 void Init(mus::View* root); |
83 void EmbedOmnibox(); | 83 void EmbedOmnibox(); |
84 | 84 |
85 mojo::ApplicationImpl* app_; | 85 mojo::ApplicationImpl* app_; |
86 scoped_ptr<AuraInit> aura_init_; | 86 scoped_ptr<AuraInit> aura_init_; |
87 mojo::ViewTreeHostPtr host_; | 87 mojo::ViewTreeHostPtr host_; |
88 mojo::Binding<ViewTreeHostClient> host_client_binding_; | 88 mojo::Binding<ViewTreeHostClient> host_client_binding_; |
89 BrowserManager* manager_; | 89 BrowserManager* manager_; |
90 ToolbarView* toolbar_view_; | 90 ToolbarView* toolbar_view_; |
91 ProgressView* progress_bar_; | 91 ProgressView* progress_bar_; |
92 mojo::View* root_; | 92 mus::View* root_; |
93 mojo::View* content_; | 93 mus::View* content_; |
94 mojo::View* omnibox_view_; | 94 mus::View* omnibox_view_; |
95 | 95 |
96 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; | 96 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; |
97 | 97 |
98 GURL default_url_; | 98 GURL default_url_; |
99 GURL current_url_; | 99 GURL current_url_; |
100 | 100 |
101 web_view::WebView web_view_; | 101 web_view::WebView web_view_; |
102 | 102 |
103 OmniboxPtr omnibox_; | 103 OmniboxPtr omnibox_; |
104 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; | 104 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); | 106 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace mandoline | 109 } // namespace mandoline |
110 | 110 |
111 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ | 111 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ |
OLD | NEW |