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

Side by Side Diff: mojo/application/public/cpp/lib/application_impl.cc

Issue 1427393002: Revert of Allow Chrome to bind an Application request from mojo_runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callback
Patch Set: Created 5 years, 1 month 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/application/public/cpp/application_impl.h ('k') | mojo/runner/BUILD.gn » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/application/public/cpp/application_impl.h" 5 #include "mojo/application/public/cpp/application_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 application_url, application_url, remote_services.Pass(), 79 application_url, application_url, remote_services.Pass(),
80 local_request.Pass(), allowed)); 80 local_request.Pass(), allowed));
81 shell_->ConnectToApplication(request.Pass(), remote_services_proxy.Pass(), 81 shell_->ConnectToApplication(request.Pass(), remote_services_proxy.Pass(),
82 local_services.Pass(), filter.Pass(), 82 local_services.Pass(), filter.Pass(),
83 registry->GetConnectToApplicationCallback()); 83 registry->GetConnectToApplicationCallback());
84 if (!delegate_->ConfigureOutgoingConnection(registry.get())) 84 if (!delegate_->ConfigureOutgoingConnection(registry.get()))
85 return nullptr; 85 return nullptr;
86 return registry.Pass(); 86 return registry.Pass();
87 } 87 }
88 88
89 void ApplicationImpl::WaitForInitialize() { 89 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
90 DCHECK(!shell_.is_bound()); 90 shell_ = shell.Pass();
91 binding_.WaitForIncomingMethodCall(); 91 shell_.set_connection_error_handler([this]() { OnConnectionError(); });
92 url_ = url;
93 delegate_->Initialize(this);
92 } 94 }
93 95
94 void ApplicationImpl::Quit() { 96 void ApplicationImpl::Quit() {
95 // We can't quit immediately, since there could be in-flight requests from the 97 // We can't quit immediately, since there could be in-flight requests from the
96 // shell. So check with it first. 98 // shell. So check with it first.
97 if (shell_) { 99 if (shell_) {
98 quit_requested_ = true; 100 quit_requested_ = true;
99 shell_->QuitApplication(); 101 shell_->QuitApplication();
100 } else { 102 } else {
101 QuitNow(); 103 QuitNow();
102 } 104 }
103 } 105 }
104 106
105 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
106 shell_ = shell.Pass();
107 shell_.set_connection_error_handler([this]() { OnConnectionError(); });
108 url_ = url;
109 delegate_->Initialize(this);
110 }
111
112 void ApplicationImpl::AcceptConnection( 107 void ApplicationImpl::AcceptConnection(
113 const String& requestor_url, 108 const String& requestor_url,
114 InterfaceRequest<ServiceProvider> services, 109 InterfaceRequest<ServiceProvider> services,
115 ServiceProviderPtr exposed_services, 110 ServiceProviderPtr exposed_services,
116 Array<String> allowed_interfaces, 111 Array<String> allowed_interfaces,
117 const String& url) { 112 const String& url) {
118 scoped_ptr<ApplicationConnection> registry(new internal::ServiceRegistry( 113 scoped_ptr<ApplicationConnection> registry(new internal::ServiceRegistry(
119 url, requestor_url, exposed_services.Pass(), services.Pass(), 114 url, requestor_url, exposed_services.Pass(), services.Pass(),
120 allowed_interfaces.To<std::set<std::string>>())); 115 allowed_interfaces.To<std::set<std::string>>()));
121 if (!delegate_->ConfigureIncomingConnection(registry.get())) 116 if (!delegate_->ConfigureIncomingConnection(registry.get()))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 154 }
160 155
161 void ApplicationImpl::UnbindConnections( 156 void ApplicationImpl::UnbindConnections(
162 InterfaceRequest<Application>* application_request, 157 InterfaceRequest<Application>* application_request,
163 ShellPtr* shell) { 158 ShellPtr* shell) {
164 *application_request = binding_.Unbind(); 159 *application_request = binding_.Unbind();
165 shell->Bind(shell_.PassInterface()); 160 shell->Bind(shell_.PassInterface());
166 } 161 }
167 162
168 } // namespace mojo 163 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/public/cpp/application_impl.h ('k') | mojo/runner/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698