| 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_BROWSER_BROWSER_H_ | 5 #ifndef MANDOLINE_UI_BROWSER_BROWSER_H_ |
| 6 #define MANDOLINE_UI_BROWSER_BROWSER_H_ | 6 #define MANDOLINE_UI_BROWSER_BROWSER_H_ |
| 7 | 7 |
| 8 #include "components/view_manager/public/cpp/view_manager.h" | 8 #include "components/view_manager/public/cpp/view_manager.h" |
| 9 #include "components/view_manager/public/cpp/view_manager_delegate.h" | 9 #include "components/view_manager/public/cpp/view_manager_delegate.h" |
| 10 #include "components/window_manager/window_manager_app.h" | 10 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
| 11 #include "components/window_manager/window_manager_delegate.h" | |
| 12 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" | 11 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" |
| 13 #include "mandoline/ui/browser/navigator_host_impl.h" | 12 #include "mandoline/ui/browser/navigator_host_impl.h" |
| 14 #include "mandoline/ui/browser/omnibox.mojom.h" | 13 #include "mandoline/ui/browser/omnibox.mojom.h" |
| 15 #include "mojo/application/public/cpp/application_delegate.h" | 14 #include "mojo/application/public/cpp/application_delegate.h" |
| 16 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
| 17 #include "mojo/application/public/cpp/connect.h" | 16 #include "mojo/application/public/cpp/connect.h" |
| 18 #include "mojo/application/public/cpp/service_provider_impl.h" | 17 #include "mojo/application/public/cpp/service_provider_impl.h" |
| 19 #include "ui/mojo/events/input_events.mojom.h" | 18 #include "ui/mojo/events/input_events.mojom.h" |
| 20 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 21 | 20 |
| 21 namespace mojo { |
| 22 class ViewManagerInit; |
| 23 } |
| 24 |
| 22 namespace mandoline { | 25 namespace mandoline { |
| 23 | 26 |
| 24 class BrowserUI; | 27 class BrowserUI; |
| 25 class MergedServiceProvider; | 28 class MergedServiceProvider; |
| 26 | 29 |
| 27 class Browser : public mojo::ApplicationDelegate, | 30 class Browser : public mojo::ApplicationDelegate, |
| 28 public mojo::ViewManagerDelegate, | 31 public mojo::ViewManagerDelegate, |
| 29 public window_manager::WindowManagerDelegate, | 32 public mojo::ViewManagerRootClient, |
| 30 public OmniboxClient, | 33 public OmniboxClient, |
| 31 public mojo::InterfaceFactory<mojo::NavigatorHost> { | 34 public mojo::InterfaceFactory<mojo::NavigatorHost> { |
| 32 public: | 35 public: |
| 33 Browser(); | 36 Browser(); |
| 34 ~Browser() override; | 37 ~Browser() override; |
| 35 | 38 |
| 36 void ReplaceContentWithURL(const mojo::String& url); | 39 void ReplaceContentWithURL(const mojo::String& url); |
| 37 | 40 |
| 38 mojo::View* content() { return content_; } | 41 mojo::View* content() { return content_; } |
| 39 mojo::View* omnibox() { return omnibox_; } | 42 mojo::View* omnibox() { return omnibox_; } |
| 40 | 43 |
| 41 const GURL& current_url() const { return current_url_; } | 44 const GURL& current_url() const { return current_url_; } |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 // Overridden from mojo::ApplicationDelegate: | 47 // Overridden from mojo::ApplicationDelegate: |
| 45 void Initialize(mojo::ApplicationImpl* app) override; | 48 void Initialize(mojo::ApplicationImpl* app) override; |
| 46 bool ConfigureIncomingConnection( | 49 bool ConfigureIncomingConnection( |
| 47 mojo::ApplicationConnection* connection) override; | 50 mojo::ApplicationConnection* connection) override; |
| 48 bool ConfigureOutgoingConnection( | 51 bool ConfigureOutgoingConnection( |
| 49 mojo::ApplicationConnection* connection) override; | 52 mojo::ApplicationConnection* connection) override; |
| 50 | 53 |
| 51 // Overridden from mojo::ViewManagerDelegate: | 54 // Overridden from mojo::ViewManagerDelegate: |
| 52 void OnEmbed(mojo::View* root, | 55 void OnEmbed(mojo::View* root, |
| 53 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 56 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 54 mojo::ServiceProviderPtr exposed_services) override; | 57 mojo::ServiceProviderPtr exposed_services) override; |
| 55 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; | 58 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
| 56 | 59 |
| 57 // Overridden from WindowManagerDelegate: | 60 // Overridden from ViewManagerRootClient: |
| 58 void Embed(const mojo::String& url, | 61 void OnAccelerator(mojo::EventPtr event) override; |
| 59 mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
| 60 mojo::ServiceProviderPtr exposed_services) override; | |
| 61 void OnAcceleratorPressed(mojo::View* view, | |
| 62 mojo::KeyboardCode keyboard_code, | |
| 63 mojo::EventFlags flags) override; | |
| 64 | 62 |
| 65 // Overridden from OmniboxClient: | 63 // Overridden from OmniboxClient: |
| 66 void OpenURL(const mojo::String& url) override; | 64 void OpenURL(const mojo::String& url) override; |
| 67 | 65 |
| 68 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: | 66 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: |
| 69 void Create(mojo::ApplicationConnection* connection, | 67 void Create(mojo::ApplicationConnection* connection, |
| 70 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; | 68 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; |
| 71 | 69 |
| 70 void Embed(const mojo::String& url, |
| 71 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 72 mojo::ServiceProviderPtr exposed_services); |
| 73 |
| 72 void ShowOmnibox(const mojo::String& url, | 74 void ShowOmnibox(const mojo::String& url, |
| 73 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 75 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 74 mojo::ServiceProviderPtr exposed_services); | 76 mojo::ServiceProviderPtr exposed_services); |
| 75 | 77 |
| 76 scoped_ptr<window_manager::WindowManagerApp> window_manager_app_; | 78 scoped_ptr<mojo::ViewManagerInit> view_manager_init_; |
| 77 | 79 |
| 78 // Only support being embedded once, so both application-level | 80 // Only support being embedded once, so both application-level |
| 79 // and embedding-level state are shared on the same object. | 81 // and embedding-level state are shared on the same object. |
| 80 mojo::View* root_; | 82 mojo::View* root_; |
| 81 mojo::View* content_; | 83 mojo::View* content_; |
| 82 mojo::View* omnibox_; | 84 mojo::View* omnibox_; |
| 83 std::string default_url_; | 85 std::string default_url_; |
| 84 std::string pending_url_; | 86 std::string pending_url_; |
| 85 | 87 |
| 86 mojo::ServiceProviderImpl exposed_services_impl_; | 88 mojo::ServiceProviderImpl exposed_services_impl_; |
| 87 scoped_ptr<MergedServiceProvider> merged_service_provider_; | 89 scoped_ptr<MergedServiceProvider> merged_service_provider_; |
| 88 | 90 |
| 89 NavigatorHostImpl navigator_host_; | 91 NavigatorHostImpl navigator_host_; |
| 90 | 92 |
| 91 GURL current_url_; | 93 GURL current_url_; |
| 92 | 94 |
| 93 scoped_ptr<BrowserUI> ui_; | 95 scoped_ptr<BrowserUI> ui_; |
| 94 | 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(Browser); | 97 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace mandoline | 100 } // namespace mandoline |
| 99 | 101 |
| 100 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ | 102 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ |
| OLD | NEW |