| 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/window_tree_connection.h" | 8 #include "components/mus/public/cpp/window_tree_connection.h" |
| 9 #include "components/mus/public/cpp/window_tree_delegate.h" | 9 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 10 #include "components/mus/public/interfaces/view_tree_host.mojom.h" | 10 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 11 #include "components/web_view/public/cpp/web_view.h" | 11 #include "components/web_view/public/cpp/web_view.h" |
| 12 #include "components/web_view/public/interfaces/web_view.mojom.h" | 12 #include "components/web_view/public/interfaces/web_view.mojom.h" |
| 13 #include "mandoline/ui/desktop_ui/find_bar_delegate.h" | 13 #include "mandoline/ui/desktop_ui/find_bar_delegate.h" |
| 14 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" | 14 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" |
| 15 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" | 15 #include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h" |
| 16 #include "mojo/application/public/cpp/interface_factory.h" | 16 #include "mojo/application/public/cpp/interface_factory.h" |
| 17 #include "mojo/common/weak_binding_set.h" | 17 #include "mojo/common/weak_binding_set.h" |
| 18 #include "ui/views/layout/layout_manager.h" | 18 #include "ui/views/layout/layout_manager.h" |
| 19 #include "ui/views/mus/aura_init.h" | 19 #include "ui/views/mus/aura_init.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 namespace mojo { | 22 namespace mojo { |
| 23 class ApplicationConnection; | 23 class ApplicationConnection; |
| 24 class Shell; | 24 class Shell; |
| 25 class View; | |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace mandoline { | 27 namespace mandoline { |
| 29 | 28 |
| 30 class BrowserManager; | 29 class BrowserManager; |
| 31 class FindBarView; | 30 class FindBarView; |
| 32 class ProgressView; | 31 class ProgressView; |
| 33 class ToolbarView; | 32 class ToolbarView; |
| 34 | 33 |
| 35 class BrowserWindow : public mus::WindowTreeDelegate, | 34 class BrowserWindow : public mus::WindowTreeDelegate, |
| 36 public mojo::ViewTreeHostClient, | 35 public mus::mojom::WindowTreeHostClient, |
| 37 public web_view::mojom::WebViewClient, | 36 public web_view::mojom::WebViewClient, |
| 38 public ViewEmbedder, | 37 public ViewEmbedder, |
| 39 public mojo::InterfaceFactory<ViewEmbedder>, | 38 public mojo::InterfaceFactory<ViewEmbedder>, |
| 40 public views::LayoutManager, | 39 public views::LayoutManager, |
| 41 public FindBarDelegate { | 40 public FindBarDelegate { |
| 42 public: | 41 public: |
| 43 BrowserWindow(mojo::ApplicationImpl* app, | 42 BrowserWindow(mojo::ApplicationImpl* app, |
| 44 mojo::ViewTreeHostFactory* host_factory, | 43 mus::mojom::WindowTreeHostFactory* host_factory, |
| 45 BrowserManager* manager); | 44 BrowserManager* manager); |
| 46 | 45 |
| 47 void LoadURL(const GURL& url); | 46 void LoadURL(const GURL& url); |
| 48 void Close(); | 47 void Close(); |
| 49 | 48 |
| 50 void ShowOmnibox(); | 49 void ShowOmnibox(); |
| 51 void ShowFind(); | 50 void ShowFind(); |
| 52 void GoBack(); | 51 void GoBack(); |
| 53 void GoForward(); | 52 void GoForward(); |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 ~BrowserWindow() override; | 55 ~BrowserWindow() override; |
| 57 | 56 |
| 58 float DIPSToPixels(float value) const; | 57 float DIPSToPixels(float value) const; |
| 59 | 58 |
| 60 // Overridden from mus::WindowTreeDelegate: | 59 // Overridden from mus::WindowTreeDelegate: |
| 61 void OnEmbed(mus::Window* root) override; | 60 void OnEmbed(mus::Window* root) override; |
| 62 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 61 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 63 | 62 |
| 64 // Overridden from ViewTreeHostClient: | 63 // Overridden from WindowTreeHostClient: |
| 65 void OnAccelerator(uint32_t id, mojo::EventPtr event) override; | 64 void OnAccelerator(uint32_t id, mojo::EventPtr event) override; |
| 66 | 65 |
| 67 // Overridden from web_view::mojom::WebViewClient: | 66 // Overridden from web_view::mojom::WebViewClient: |
| 68 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; | 67 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; |
| 69 void TopLevelNavigationStarted(const mojo::String& url) override; | 68 void TopLevelNavigationStarted(const mojo::String& url) override; |
| 70 void LoadingStateChanged(bool is_loading, double progress) override; | 69 void LoadingStateChanged(bool is_loading, double progress) override; |
| 71 void BackForwardChanged(web_view::mojom::ButtonState back_button, | 70 void BackForwardChanged(web_view::mojom::ButtonState back_button, |
| 72 web_view::mojom::ButtonState forward_button) override; | 71 web_view::mojom::ButtonState forward_button) override; |
| 73 void TitleChanged(const mojo::String& title) override; | 72 void TitleChanged(const mojo::String& title) override; |
| 74 void FindInPageMatchCountUpdated(int32_t request_id, | 73 void FindInPageMatchCountUpdated(int32_t request_id, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 91 | 90 |
| 92 // Overridden from FindBarDelegate: | 91 // Overridden from FindBarDelegate: |
| 93 void OnDoFind(const std::string& find, bool forward) override; | 92 void OnDoFind(const std::string& find, bool forward) override; |
| 94 void OnHideFindBar() override; | 93 void OnHideFindBar() override; |
| 95 | 94 |
| 96 void Init(mus::Window* root); | 95 void Init(mus::Window* root); |
| 97 void EmbedOmnibox(); | 96 void EmbedOmnibox(); |
| 98 | 97 |
| 99 mojo::ApplicationImpl* app_; | 98 mojo::ApplicationImpl* app_; |
| 100 scoped_ptr<views::AuraInit> aura_init_; | 99 scoped_ptr<views::AuraInit> aura_init_; |
| 101 mojo::ViewTreeHostPtr host_; | 100 mus::mojom::WindowTreeHostPtr host_; |
| 102 mojo::Binding<ViewTreeHostClient> host_client_binding_; | 101 mojo::Binding<WindowTreeHostClient> host_client_binding_; |
| 103 BrowserManager* manager_; | 102 BrowserManager* manager_; |
| 104 ToolbarView* toolbar_view_; | 103 ToolbarView* toolbar_view_; |
| 105 ProgressView* progress_bar_; | 104 ProgressView* progress_bar_; |
| 106 FindBarView* find_bar_view_; | 105 FindBarView* find_bar_view_; |
| 107 mus::Window* root_; | 106 mus::Window* root_; |
| 108 mus::Window* content_; | 107 mus::Window* content_; |
| 109 mus::Window* omnibox_view_; | 108 mus::Window* omnibox_view_; |
| 110 | 109 |
| 111 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; | 110 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; |
| 112 | 111 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 123 | 122 |
| 124 OmniboxPtr omnibox_; | 123 OmniboxPtr omnibox_; |
| 125 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; | 124 scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; |
| 126 | 125 |
| 127 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); | 126 DISALLOW_COPY_AND_ASSIGN(BrowserWindow); |
| 128 }; | 127 }; |
| 129 | 128 |
| 130 } // namespace mandoline | 129 } // namespace mandoline |
| 131 | 130 |
| 132 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ | 131 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_WINDOW_H_ |
| OLD | NEW |