Chromium Code Reviews| 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/view_manager/public/cpp/view_manager_init.h" | 10 #include "components/view_manager/public/cpp/view_manager_init.h" |
| 11 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" | 11 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
| 12 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" | 12 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" |
| 13 #include "mandoline/ui/browser/navigator_host_impl.h" | 13 #include "mandoline/ui/browser/navigator_host_impl.h" |
| 14 #include "mandoline/ui/browser/public/interfaces/omnibox.mojom.h" | 14 #include "mandoline/ui/browser/public/interfaces/omnibox.mojom.h" |
| 15 #include "mandoline/ui/browser/public/interfaces/view_embedder.mojom.h" | 15 #include "mandoline/ui/browser/public/interfaces/view_embedder.mojom.h" |
| 16 #include "mojo/application/public/cpp/application_delegate.h" | 16 #include "mojo/application/public/cpp/application_delegate.h" |
| 17 #include "mojo/application/public/cpp/application_impl.h" | 17 #include "mojo/application/public/cpp/application_impl.h" |
| 18 #include "mojo/application/public/cpp/connect.h" | 18 #include "mojo/application/public/cpp/connect.h" |
| 19 #include "mojo/common/weak_binding_set.h" | 19 #include "mojo/common/weak_binding_set.h" |
| 20 #include "ui/mojo/events/input_events.mojom.h" | 20 #include "ui/mojo/events/input_events.mojom.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace mojo { | 23 namespace mojo { |
| 24 class ViewManagerInit; | 24 class ViewManagerInit; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace mandoline { | 27 namespace mandoline { |
| 28 | 28 |
| 29 class BrowserManager; | 29 class BrowserDelegate; |
| 30 class BrowserUI; | 30 class BrowserUI; |
| 31 class FrameTree; | 31 class FrameTree; |
| 32 | 32 |
| 33 class Browser : public mojo::ViewManagerDelegate, | 33 class Browser : public mojo::ViewManagerDelegate, |
| 34 public mojo::ViewManagerRootClient, | 34 public mojo::ViewManagerRootClient, |
| 35 public OmniboxClient, | 35 public OmniboxClient, |
| 36 public ViewEmbedder, | 36 public ViewEmbedder, |
| 37 public mojo::InterfaceFactory<mojo::NavigatorHost>, | 37 public mojo::InterfaceFactory<mojo::NavigatorHost>, |
| 38 public mojo::InterfaceFactory<ViewEmbedder> { | 38 public mojo::InterfaceFactory<ViewEmbedder> { |
| 39 public: | 39 public: |
| 40 Browser(mojo::ApplicationImpl* app, BrowserManager* browser_manager); | 40 Browser(mojo::ApplicationImpl* app, BrowserDelegate* delegate); |
| 41 ~Browser() override; | 41 ~Browser() override; |
| 42 | 42 |
| 43 void ReplaceContentWithRequest(mojo::URLRequestPtr request); | 43 void ReplaceContentWithRequest(mojo::URLRequestPtr request); |
| 44 | 44 |
| 45 mojo::View* content() { return content_; } | 45 mojo::View* content() { return content_; } |
| 46 mojo::View* omnibox() { return omnibox_; } | 46 mojo::View* omnibox() { return omnibox_; } |
| 47 | 47 |
| 48 const GURL& current_url() const { return current_url_; } | 48 const GURL& current_url() const { return current_url_; } |
| 49 | 49 |
| 50 mojo::ApplicationConnection* GetViewManagerConnectionForTesting(); | |
|
sky
2015/06/29 16:56:02
I'm not a fan of public functions for testing. I p
Fady Samuel
2015/06/29 20:32:36
Done.
| |
| 51 | |
| 50 // Called once a valid device_pixel_ratio is determined. We gate construction | 52 // Called once a valid device_pixel_ratio is determined. We gate construction |
| 51 // of the UI until the device_pixel_ratio is available as it's necessary to | 53 // of the UI until the device_pixel_ratio is available as it's necessary to |
| 52 // properly setup the ui. | 54 // properly setup the ui. |
| 53 // TODO(sky): remove this. Only here until we move to viewmanager. | 55 // TODO(sky): remove this. Only here until we move to viewmanager. |
| 54 void OnDevicePixelRatioAvailable(); | 56 void OnDevicePixelRatioAvailable(); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 // Overridden from mojo::ViewManagerDelegate: | 59 // Overridden from mojo::ViewManagerDelegate: |
| 58 void OnEmbed(mojo::View* root) override; | 60 void OnEmbed(mojo::View* root) override; |
| 59 void OnEmbedForDescendant(mojo::View* view, | 61 void OnEmbedForDescendant(mojo::View* view, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 mojo::URLRequestPtr pending_request_; | 93 mojo::URLRequestPtr pending_request_; |
| 92 | 94 |
| 93 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; | 95 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; |
| 94 | 96 |
| 95 NavigatorHostImpl navigator_host_; | 97 NavigatorHostImpl navigator_host_; |
| 96 | 98 |
| 97 GURL current_url_; | 99 GURL current_url_; |
| 98 | 100 |
| 99 scoped_ptr<BrowserUI> ui_; | 101 scoped_ptr<BrowserUI> ui_; |
| 100 mojo::ApplicationImpl* app_; | 102 mojo::ApplicationImpl* app_; |
| 101 BrowserManager* browser_manager_; | 103 BrowserDelegate* delegate_; |
| 102 | 104 |
| 103 scoped_ptr<FrameTree> frame_tree_; | 105 scoped_ptr<FrameTree> frame_tree_; |
| 104 | 106 |
| 105 DISALLOW_COPY_AND_ASSIGN(Browser); | 107 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace mandoline | 110 } // namespace mandoline |
| 109 | 111 |
| 110 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ | 112 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ |
| OLD | NEW |