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

Side by Side Diff: mojo/ui/view_provider_app.cc

Issue 1679023006: Reify view ownership as a message pipe. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « mojo/ui/view_provider_app.h ('k') | services/ui/launcher/launcher_app.h » ('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 #include "mojo/ui/view_provider_app.h" 5 #include "mojo/ui/view_provider_app.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace ui { 11 namespace ui {
12 12
13 class ViewProviderApp::DelegatingViewProvider : public mojo::ui::ViewProvider { 13 class ViewProviderApp::DelegatingViewProvider : public mojo::ui::ViewProvider {
14 public: 14 public:
15 DelegatingViewProvider(ViewProviderApp* app, 15 DelegatingViewProvider(ViewProviderApp* app,
16 const std::string& view_provider_url) 16 const std::string& view_provider_url)
17 : app_(app), view_provider_url_(view_provider_url) {} 17 : app_(app), view_provider_url_(view_provider_url) {}
18 18
19 ~DelegatingViewProvider() override {} 19 ~DelegatingViewProvider() override {}
20 20
21 private: 21 private:
22 // |ViewProvider|: 22 // |ViewProvider|:
23 void CreateView( 23 void CreateView(
24 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
24 mojo::InterfaceRequest<mojo::ServiceProvider> services, 25 mojo::InterfaceRequest<mojo::ServiceProvider> services,
25 mojo::ServiceProviderPtr exposed_services, 26 mojo::ServiceProviderPtr exposed_services) override {
26 const mojo::ui::ViewProvider::CreateViewCallback& callback) override { 27 app_->CreateView(this, view_provider_url_, view_owner_request.Pass(),
27 app_->CreateView(this, view_provider_url_, services.Pass(), 28 services.Pass(), exposed_services.Pass());
28 exposed_services.Pass(), callback);
29 } 29 }
30 30
31 ViewProviderApp* app_; 31 ViewProviderApp* app_;
32 std::string view_provider_url_; 32 std::string view_provider_url_;
33 33
34 MOJO_DISALLOW_COPY_AND_ASSIGN(DelegatingViewProvider); 34 MOJO_DISALLOW_COPY_AND_ASSIGN(DelegatingViewProvider);
35 }; 35 };
36 36
37 ViewProviderApp::ViewProviderApp() {} 37 ViewProviderApp::ViewProviderApp() {}
38 38
(...skipping 19 matching lines...) Expand all
58 mojo::ApplicationConnection* connection, 58 mojo::ApplicationConnection* connection,
59 mojo::InterfaceRequest<mojo::ui::ViewProvider> request) { 59 mojo::InterfaceRequest<mojo::ui::ViewProvider> request) {
60 bindings_.AddBinding( 60 bindings_.AddBinding(
61 new DelegatingViewProvider(this, connection->GetConnectionURL()), 61 new DelegatingViewProvider(this, connection->GetConnectionURL()),
62 request.Pass()); 62 request.Pass());
63 } 63 }
64 64
65 void ViewProviderApp::CreateView( 65 void ViewProviderApp::CreateView(
66 DelegatingViewProvider* provider, 66 DelegatingViewProvider* provider,
67 const std::string& view_provider_url, 67 const std::string& view_provider_url,
68 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
68 mojo::InterfaceRequest<mojo::ServiceProvider> services, 69 mojo::InterfaceRequest<mojo::ServiceProvider> services,
69 mojo::ServiceProviderPtr exposed_services, 70 mojo::ServiceProviderPtr exposed_services) {
70 const mojo::ui::ViewProvider::CreateViewCallback& callback) { 71 CreateView(view_provider_url, view_owner_request.Pass(), services.Pass(),
71 if (!CreateView(view_provider_url, services.Pass(), exposed_services.Pass(), 72 exposed_services.Pass());
72 callback)) {
73 bindings_.RemoveBindings(provider);
74 delete provider;
75 }
76 } 73 }
77 74
78 } // namespace ui 75 } // namespace ui
79 } // namespace mojo 76 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/ui/view_provider_app.h ('k') | services/ui/launcher/launcher_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698