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/interfaces/view_manager_root.mojom.h" | 10 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public mojo::ViewManagerDelegate, | 33 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(); | 40 Browser(); |
41 ~Browser() override; | 41 ~Browser() override; |
42 | 42 |
43 void ReplaceContentWithURL(const mojo::String& url); | 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 private: | 50 private: |
51 // Overridden from mojo::ApplicationDelegate: | 51 // Overridden from mojo::ApplicationDelegate: |
52 void Initialize(mojo::ApplicationImpl* app) override; | 52 void Initialize(mojo::ApplicationImpl* app) override; |
53 bool ConfigureIncomingConnection( | 53 bool ConfigureIncomingConnection( |
54 mojo::ApplicationConnection* connection) override; | 54 mojo::ApplicationConnection* connection) override; |
55 bool ConfigureOutgoingConnection( | 55 bool ConfigureOutgoingConnection( |
56 mojo::ApplicationConnection* connection) override; | 56 mojo::ApplicationConnection* connection) override; |
57 | 57 |
58 // Overridden from mojo::ViewManagerDelegate: | 58 // Overridden from mojo::ViewManagerDelegate: |
59 void OnEmbed(mojo::View* root, | 59 void OnEmbed(mojo::View* root, |
60 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 60 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
61 mojo::ServiceProviderPtr exposed_services) override; | 61 mojo::ServiceProviderPtr exposed_services) override; |
62 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; | 62 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
63 | 63 |
64 // Overridden from ViewManagerRootClient: | 64 // Overridden from ViewManagerRootClient: |
65 void OnAccelerator(mojo::EventPtr event) override; | 65 void OnAccelerator(mojo::EventPtr event) override; |
66 | 66 |
67 // Overridden from OmniboxClient: | 67 // Overridden from OmniboxClient: |
68 void OpenURL(const mojo::String& url) override; | 68 void OpenURL(const mojo::String& url) override; |
69 | 69 |
70 // Overridden from ViewEmbedder: | 70 // Overridden from ViewEmbedder: |
71 void Embed(const mojo::String& url, | 71 void Embed(mojo::URLRequestPtr request, |
72 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 72 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
73 mojo::ServiceProviderPtr exposed_services) override; | 73 mojo::ServiceProviderPtr exposed_services) override; |
74 | 74 |
75 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: | 75 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: |
76 void Create(mojo::ApplicationConnection* connection, | 76 void Create(mojo::ApplicationConnection* connection, |
77 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; | 77 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; |
78 | 78 |
79 // Overridden from mojo::InterfaceFactory<ViewEmbedder>: | 79 // Overridden from mojo::InterfaceFactory<ViewEmbedder>: |
80 void Create(mojo::ApplicationConnection* connection, | 80 void Create(mojo::ApplicationConnection* connection, |
81 mojo::InterfaceRequest<ViewEmbedder> request) override; | 81 mojo::InterfaceRequest<ViewEmbedder> request) override; |
82 | 82 |
83 void ShowOmnibox(const mojo::String& url, | 83 void ShowOmnibox(mojo::URLRequestPtr request, |
84 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 84 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
85 mojo::ServiceProviderPtr exposed_services); | 85 mojo::ServiceProviderPtr exposed_services); |
86 | 86 |
87 scoped_ptr<mojo::ViewManagerInit> view_manager_init_; | 87 scoped_ptr<mojo::ViewManagerInit> view_manager_init_; |
88 | 88 |
89 // Only support being embedded once, so both application-level | 89 // Only support being embedded once, so both application-level |
90 // and embedding-level state are shared on the same object. | 90 // and embedding-level state are shared on the same object. |
91 mojo::View* root_; | 91 mojo::View* root_; |
92 mojo::View* content_; | 92 mojo::View* content_; |
93 mojo::View* omnibox_; | 93 mojo::View* omnibox_; |
94 std::string default_url_; | 94 std::string default_url_; |
95 std::string pending_url_; | 95 mojo::URLRequestPtr pending_request_; |
96 | 96 |
97 mojo::ServiceProviderImpl exposed_services_impl_; | 97 mojo::ServiceProviderImpl exposed_services_impl_; |
98 scoped_ptr<MergedServiceProvider> merged_service_provider_; | 98 scoped_ptr<MergedServiceProvider> merged_service_provider_; |
99 | 99 |
100 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; | 100 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; |
101 | 101 |
102 NavigatorHostImpl navigator_host_; | 102 NavigatorHostImpl navigator_host_; |
103 | 103 |
104 GURL current_url_; | 104 GURL current_url_; |
105 | 105 |
106 scoped_ptr<BrowserUI> ui_; | 106 scoped_ptr<BrowserUI> ui_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(Browser); | 108 DISALLOW_COPY_AND_ASSIGN(Browser); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace mandoline | 111 } // namespace mandoline |
112 | 112 |
113 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ | 113 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ |
OLD | NEW |