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

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

Issue 1311353005: Adds a way to determine id of content handler that created app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke comment Created 5 years, 3 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/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 scoped_ptr<ApplicationConnection> 53 scoped_ptr<ApplicationConnection>
54 ApplicationImpl::ConnectToApplicationWithCapabilityFilter( 54 ApplicationImpl::ConnectToApplicationWithCapabilityFilter(
55 URLRequestPtr request, 55 URLRequestPtr request,
56 CapabilityFilterPtr filter) { 56 CapabilityFilterPtr filter) {
57 if (!shell_) 57 if (!shell_)
58 return nullptr; 58 return nullptr;
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 std::string application_url = request->url.To<std::string>(); 62 std::string application_url = request->url.To<std::string>();
63 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services),
64 local_services.Pass(), filter.Pass());
65 // We allow all interfaces on outgoing connections since we are presumably in 63 // We allow all interfaces on outgoing connections since we are presumably in
66 // a position to know who we're talking to. 64 // a position to know who we're talking to.
67 // TODO(beng): is this a valid assumption or do we need to figure some way to 65 // TODO(beng): is this a valid assumption or do we need to figure some way to
68 // filter here too? 66 // filter here too?
69 std::set<std::string> allowed; 67 std::set<std::string> allowed;
70 allowed.insert("*"); 68 allowed.insert("*");
71 scoped_ptr<ApplicationConnection> registry(new internal::ServiceRegistry( 69 InterfaceRequest<ServiceProvider> remote_services_proxy =
70 GetProxy(&remote_services);
71 scoped_ptr<internal::ServiceRegistry> registry(new internal::ServiceRegistry(
72 application_url, application_url, remote_services.Pass(), 72 application_url, application_url, remote_services.Pass(),
73 local_request.Pass(), allowed)); 73 local_request.Pass(), allowed));
74 shell_->ConnectToApplication(request.Pass(), remote_services_proxy.Pass(),
75 local_services.Pass(), filter.Pass(),
76 registry->GetConnectToApplicationCallback());
74 if (!delegate_->ConfigureOutgoingConnection(registry.get())) 77 if (!delegate_->ConfigureOutgoingConnection(registry.get()))
75 return nullptr; 78 return nullptr;
76 return registry.Pass(); 79 return registry.Pass();
77 } 80 }
78 81
79 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) { 82 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
80 shell_ = shell.Pass(); 83 shell_ = shell.Pass();
81 shell_.set_connection_error_handler([this]() { OnConnectionError(); }); 84 shell_.set_connection_error_handler([this]() { OnConnectionError(); });
82 url_ = url; 85 url_ = url;
83 delegate_->Initialize(this); 86 delegate_->Initialize(this);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 147 }
145 148
146 void ApplicationImpl::UnbindConnections( 149 void ApplicationImpl::UnbindConnections(
147 InterfaceRequest<Application>* application_request, 150 InterfaceRequest<Application>* application_request,
148 ShellPtr* shell) { 151 ShellPtr* shell) {
149 *application_request = binding_.Unbind(); 152 *application_request = binding_.Unbind();
150 shell->Bind(shell_.PassInterface()); 153 shell->Bind(shell_.PassInterface());
151 } 154 }
152 155
153 } // namespace mojo 156 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/public/cpp/application_connection.h ('k') | mojo/application/public/cpp/lib/service_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698