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

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

Issue 943053003: Simple multi-url support for mojo apps (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase + fix android Created 5 years, 9 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
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/public/cpp/application/application_impl.h" 5 #include "mojo/public/cpp/application/application_impl.h"
6 6
7 #include "mojo/public/cpp/application/application_delegate.h" 7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/lib/service_registry.h" 8 #include "mojo/public/cpp/application/lib/service_registry.h"
9 #include "mojo/public/cpp/bindings/interface_ptr.h" 9 #include "mojo/public/cpp/bindings/interface_ptr.h"
10 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 ApplicationConnection* ApplicationImpl::ConnectToApplication( 56 ApplicationConnection* ApplicationImpl::ConnectToApplication(
57 const String& application_url) { 57 const String& application_url) {
58 MOJO_CHECK(shell_); 58 MOJO_CHECK(shell_);
59 ServiceProviderPtr local_services; 59 ServiceProviderPtr local_services;
60 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); 60 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services);
61 ServiceProviderPtr remote_services; 61 ServiceProviderPtr remote_services;
62 shell_->ConnectToApplication(application_url, GetProxy(&remote_services), 62 shell_->ConnectToApplication(application_url, GetProxy(&remote_services),
63 local_services.Pass()); 63 local_services.Pass());
64 internal::ServiceRegistry* registry = new internal::ServiceRegistry( 64 internal::ServiceRegistry* registry = new internal::ServiceRegistry(
65 this, application_url, remote_services.Pass(), local_request.Pass()); 65 this, application_url, application_url, remote_services.Pass(),
66 local_request.Pass());
66 if (!delegate_->ConfigureOutgoingConnection(registry)) { 67 if (!delegate_->ConfigureOutgoingConnection(registry)) {
67 delete registry; 68 delete registry;
68 return nullptr; 69 return nullptr;
69 } 70 }
70 outgoing_service_registries_.push_back(registry); 71 outgoing_service_registries_.push_back(registry);
71 return registry; 72 return registry;
72 } 73 }
73 74
74 void ApplicationImpl::Initialize(ShellPtr shell, 75 void ApplicationImpl::Initialize(ShellPtr shell,
75 Array<String> args, 76 Array<String> args,
(...skipping 14 matching lines...) Expand all
90 void ApplicationImpl::UnbindConnections( 91 void ApplicationImpl::UnbindConnections(
91 InterfaceRequest<Application>* application_request, 92 InterfaceRequest<Application>* application_request,
92 ShellPtr* shell) { 93 ShellPtr* shell) {
93 *application_request = binding_.Unbind(); 94 *application_request = binding_.Unbind();
94 shell->Bind(shell_.PassMessagePipe()); 95 shell->Bind(shell_.PassMessagePipe());
95 } 96 }
96 97
97 void ApplicationImpl::AcceptConnection( 98 void ApplicationImpl::AcceptConnection(
98 const String& requestor_url, 99 const String& requestor_url,
99 InterfaceRequest<ServiceProvider> services, 100 InterfaceRequest<ServiceProvider> services,
100 ServiceProviderPtr exposed_services) { 101 ServiceProviderPtr exposed_services,
102 const String& url) {
101 internal::ServiceRegistry* registry = new internal::ServiceRegistry( 103 internal::ServiceRegistry* registry = new internal::ServiceRegistry(
102 this, requestor_url, exposed_services.Pass(), services.Pass()); 104 this, url, requestor_url, exposed_services.Pass(), services.Pass());
103 if (!delegate_->ConfigureIncomingConnection(registry)) { 105 if (!delegate_->ConfigureIncomingConnection(registry)) {
104 delete registry; 106 delete registry;
105 return; 107 return;
106 } 108 }
107 incoming_service_registries_.push_back(registry); 109 incoming_service_registries_.push_back(registry);
108 } 110 }
109 111
110 void ApplicationImpl::RequestQuit() { 112 void ApplicationImpl::RequestQuit() {
111 delegate_->Quit(); 113 delegate_->Quit();
112 Terminate(); 114 Terminate();
113 } 115 }
114 116
115 } // namespace mojo 117 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698