Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: mandoline/ui/browser/browser.h

Issue 1166123005: Removes ServiceProviders from ViewManager::Embed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use is_headless rather than check for browser. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mandoline/ui/browser/BUILD.gn ('k') | mandoline/ui/browser/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h" 11 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
12 #include "mandoline/ui/browser/navigator_host_impl.h" 12 #include "mandoline/ui/browser/navigator_host_impl.h"
13 #include "mandoline/ui/browser/omnibox.mojom.h" 13 #include "mandoline/ui/browser/omnibox.mojom.h"
14 #include "mandoline/ui/browser/view_embedder.mojom.h" 14 #include "mandoline/ui/browser/view_embedder.mojom.h"
15 #include "mojo/application/public/cpp/application_delegate.h" 15 #include "mojo/application/public/cpp/application_delegate.h"
16 #include "mojo/application/public/cpp/application_impl.h" 16 #include "mojo/application/public/cpp/application_impl.h"
17 #include "mojo/application/public/cpp/connect.h" 17 #include "mojo/application/public/cpp/connect.h"
18 #include "mojo/application/public/cpp/service_provider_impl.h"
19 #include "mojo/common/weak_binding_set.h" 18 #include "mojo/common/weak_binding_set.h"
20 #include "ui/mojo/events/input_events.mojom.h" 19 #include "ui/mojo/events/input_events.mojom.h"
21 #include "url/gurl.h" 20 #include "url/gurl.h"
22 21
23 namespace mojo { 22 namespace mojo {
24 class ViewManagerInit; 23 class ViewManagerInit;
25 } 24 }
26 25
27 namespace mandoline { 26 namespace mandoline {
28 27
29 class BrowserUI; 28 class BrowserUI;
30 class FrameTree; 29 class FrameTree;
31 class MergedServiceProvider;
32 30
33 class Browser : public mojo::ApplicationDelegate, 31 class Browser : public mojo::ApplicationDelegate,
34 public mojo::ViewManagerDelegate, 32 public mojo::ViewManagerDelegate,
35 public mojo::ViewManagerRootClient, 33 public mojo::ViewManagerRootClient,
36 public OmniboxClient, 34 public OmniboxClient,
37 public ViewEmbedder, 35 public ViewEmbedder,
38 public mojo::InterfaceFactory<mojo::NavigatorHost>, 36 public mojo::InterfaceFactory<mojo::NavigatorHost>,
39 public mojo::InterfaceFactory<ViewEmbedder> { 37 public mojo::InterfaceFactory<ViewEmbedder> {
40 public: 38 public:
41 Browser(); 39 Browser();
42 ~Browser() override; 40 ~Browser() override;
43 41
44 void ReplaceContentWithRequest(mojo::URLRequestPtr request); 42 void ReplaceContentWithRequest(mojo::URLRequestPtr request);
45 43
46 mojo::View* content() { return content_; } 44 mojo::View* content() { return content_; }
47 mojo::View* omnibox() { return omnibox_; } 45 mojo::View* omnibox() { return omnibox_; }
48 46
49 const GURL& current_url() const { return current_url_; } 47 const GURL& current_url() const { return current_url_; }
50 48
51 private: 49 private:
52 // Overridden from mojo::ApplicationDelegate: 50 // Overridden from mojo::ApplicationDelegate:
53 void Initialize(mojo::ApplicationImpl* app) override; 51 void Initialize(mojo::ApplicationImpl* app) override;
54 bool ConfigureIncomingConnection( 52 bool ConfigureIncomingConnection(
55 mojo::ApplicationConnection* connection) override; 53 mojo::ApplicationConnection* connection) override;
56 bool ConfigureOutgoingConnection( 54 bool ConfigureOutgoingConnection(
57 mojo::ApplicationConnection* connection) override; 55 mojo::ApplicationConnection* connection) override;
58 56
59 // Overridden from mojo::ViewManagerDelegate: 57 // Overridden from mojo::ViewManagerDelegate:
60 void OnEmbed(mojo::View* root, 58 void OnEmbed(mojo::View* root) override;
61 mojo::InterfaceRequest<mojo::ServiceProvider> services, 59 void OnEmbedForDescendant(mojo::View* view,
62 mojo::ServiceProviderPtr exposed_services) override; 60 mojo::URLRequestPtr request,
63 bool OnWillEmbed(mojo::View* view, 61 mojo::ViewManagerClientPtr* client) override;
64 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
65 mojo::ServiceProviderPtr* exposed_services) override;
66 void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; 62 void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override;
67 63
68 // Overridden from ViewManagerRootClient: 64 // Overridden from ViewManagerRootClient:
69 void OnAccelerator(mojo::EventPtr event) override; 65 void OnAccelerator(mojo::EventPtr event) override;
70 66
71 // Overridden from OmniboxClient: 67 // Overridden from OmniboxClient:
72 void OpenURL(const mojo::String& url) override; 68 void OpenURL(const mojo::String& url) override;
73 69
74 // Overridden from ViewEmbedder: 70 // Overridden from ViewEmbedder:
75 void Embed(mojo::URLRequestPtr request, 71 void Embed(mojo::URLRequestPtr request) override;
76 mojo::InterfaceRequest<mojo::ServiceProvider> services,
77 mojo::ServiceProviderPtr exposed_services) override;
78 72
79 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>: 73 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>:
80 void Create(mojo::ApplicationConnection* connection, 74 void Create(mojo::ApplicationConnection* connection,
81 mojo::InterfaceRequest<mojo::NavigatorHost> request) override; 75 mojo::InterfaceRequest<mojo::NavigatorHost> request) override;
82 76
83 // Overridden from mojo::InterfaceFactory<ViewEmbedder>: 77 // Overridden from mojo::InterfaceFactory<ViewEmbedder>:
84 void Create(mojo::ApplicationConnection* connection, 78 void Create(mojo::ApplicationConnection* connection,
85 mojo::InterfaceRequest<ViewEmbedder> request) override; 79 mojo::InterfaceRequest<ViewEmbedder> request) override;
86 80
87 void ShowOmnibox(mojo::URLRequestPtr request, 81 void ShowOmnibox(mojo::URLRequestPtr request);
88 mojo::InterfaceRequest<mojo::ServiceProvider> services,
89 mojo::ServiceProviderPtr exposed_services);
90 82
91 scoped_ptr<mojo::ViewManagerInit> view_manager_init_; 83 scoped_ptr<mojo::ViewManagerInit> view_manager_init_;
92 84
93 // Only support being embedded once, so both application-level 85 // Only support being embedded once, so both application-level
94 // and embedding-level state are shared on the same object. 86 // and embedding-level state are shared on the same object.
95 mojo::View* root_; 87 mojo::View* root_;
96 mojo::View* content_; 88 mojo::View* content_;
97 mojo::View* omnibox_; 89 mojo::View* omnibox_;
98 std::string default_url_; 90 std::string default_url_;
99 mojo::URLRequestPtr pending_request_; 91 mojo::URLRequestPtr pending_request_;
100 92
101 mojo::ServiceProviderImpl exposed_services_impl_;
102 scoped_ptr<MergedServiceProvider> merged_service_provider_;
103
104 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_; 93 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_;
105 94
106 NavigatorHostImpl navigator_host_; 95 NavigatorHostImpl navigator_host_;
107 96
108 GURL current_url_; 97 GURL current_url_;
109 98
110 scoped_ptr<BrowserUI> ui_; 99 scoped_ptr<BrowserUI> ui_;
111 mojo::ApplicationImpl* app_; 100 mojo::ApplicationImpl* app_;
112 101
113 scoped_ptr<FrameTree> frame_tree_; 102 scoped_ptr<FrameTree> frame_tree_;
114 103
115 DISALLOW_COPY_AND_ASSIGN(Browser); 104 DISALLOW_COPY_AND_ASSIGN(Browser);
116 }; 105 };
117 106
118 } // namespace mandoline 107 } // namespace mandoline
119 108
120 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_ 109 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_
OLDNEW
« no previous file with comments | « mandoline/ui/browser/BUILD.gn ('k') | mandoline/ui/browser/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698