| 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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "components/view_manager/public/cpp/view_manager.h" | 9 #include "components/view_manager/public/cpp/view_manager.h" |
| 10 #include "components/view_manager/public/cpp/view_manager_delegate.h" | 10 #include "components/view_manager/public/cpp/view_manager_delegate.h" |
| 11 #include "components/window_manager/window_manager_app.h" | 11 #include "components/window_manager/window_manager_app.h" |
| 12 #include "components/window_manager/window_manager_delegate.h" | 12 #include "components/window_manager/window_manager_delegate.h" |
| 13 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" | 13 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" |
| 14 #include "mandoline/ui/browser/navigator_host_impl.h" | 14 #include "mandoline/ui/browser/navigator_host_impl.h" |
| 15 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.
h" | 15 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.
h" |
| 16 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" | 16 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" |
| 17 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" |
| 18 #include "third_party/mojo/src/mojo/public/cpp/application/service_provider_impl
.h" | 18 #include "third_party/mojo/src/mojo/public/cpp/application/service_provider_impl
.h" |
| 19 #include "ui/mojo/events/input_events.mojom.h" | 19 #include "ui/mojo/events/input_events.mojom.h" |
| 20 | 20 |
| 21 namespace mandoline { | 21 namespace mandoline { |
| 22 | 22 |
| 23 class BrowserUI; | 23 class BrowserUI; |
| 24 class MergedServiceProvider; | 24 class MergedServiceProvider; |
| 25 | 25 |
| 26 class Browser : public mojo::ApplicationDelegate, | 26 class Browser : public mojo::ApplicationDelegate, |
| 27 public mojo::ViewManagerDelegate, | 27 public mojo::ViewManagerDelegate, |
| 28 public mojo::ViewObserver, |
| 28 public window_manager::WindowManagerDelegate, | 29 public window_manager::WindowManagerDelegate, |
| 29 public mojo::InterfaceFactory<mojo::NavigatorHost> { | 30 public mojo::InterfaceFactory<mojo::NavigatorHost> { |
| 30 public: | 31 public: |
| 31 Browser(); | 32 Browser(); |
| 32 ~Browser() override; | 33 ~Browser() override; |
| 33 | 34 |
| 34 base::WeakPtr<Browser> GetWeakPtr(); | 35 base::WeakPtr<Browser> GetWeakPtr(); |
| 35 | 36 |
| 36 void ReplaceContentWithURL(const mojo::String& url); | 37 void ReplaceContentWithURL(const mojo::String& url); |
| 37 | 38 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 55 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 55 mojo::ServiceProviderPtr exposed_services) override; | 56 mojo::ServiceProviderPtr exposed_services) override; |
| 56 void OnAcceleratorPressed(mojo::View* view, | 57 void OnAcceleratorPressed(mojo::View* view, |
| 57 mojo::KeyboardCode keyboard_code, | 58 mojo::KeyboardCode keyboard_code, |
| 58 mojo::EventFlags flags) override; | 59 mojo::EventFlags flags) override; |
| 59 | 60 |
| 60 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: | 61 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: |
| 61 void Create(mojo::ApplicationConnection* connection, | 62 void Create(mojo::ApplicationConnection* connection, |
| 62 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; | 63 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; |
| 63 | 64 |
| 64 void LayoutContent(); | 65 // Overriden from mojo::ViewObserver: |
| 66 virtual void OnViewBoundsChanged(mojo::View* view, |
| 67 const mojo::Rect& old_bounds, |
| 68 const mojo::Rect& new_bounds) override; |
| 65 | 69 |
| 66 scoped_ptr<window_manager::WindowManagerApp> window_manager_app_; | 70 scoped_ptr<window_manager::WindowManagerApp> window_manager_app_; |
| 67 | 71 |
| 68 // Only support being embedded once, so both application-level | 72 // Only support being embedded once, so both application-level |
| 69 // and embedding-level state are shared on the same object. | 73 // and embedding-level state are shared on the same object. |
| 70 mojo::View* root_; | 74 mojo::View* root_; |
| 71 mojo::View* content_; | 75 mojo::View* content_; |
| 72 std::string default_url_; | 76 std::string default_url_; |
| 73 std::string pending_url_; | 77 std::string pending_url_; |
| 74 | 78 |
| 75 mojo::ServiceProviderImpl exposed_services_impl_; | 79 mojo::ServiceProviderImpl exposed_services_impl_; |
| 76 scoped_ptr<MergedServiceProvider> merged_service_provider_; | 80 scoped_ptr<MergedServiceProvider> merged_service_provider_; |
| 77 | 81 |
| 78 NavigatorHostImpl navigator_host_; | 82 NavigatorHostImpl navigator_host_; |
| 79 | 83 |
| 80 scoped_ptr<BrowserUI> ui_; | 84 scoped_ptr<BrowserUI> ui_; |
| 81 | 85 |
| 82 base::WeakPtrFactory<Browser> weak_factory_; | 86 base::WeakPtrFactory<Browser> weak_factory_; |
| 83 | 87 |
| 84 DISALLOW_COPY_AND_ASSIGN(Browser); | 88 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 } // namespace mandoline | 91 } // namespace mandoline |
| 88 | 92 |
| 89 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ | 93 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ |
| OLD | NEW |