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

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

Issue 1287043004: Use CapabilityFilter to restrict what HTMLViewers can connect to. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 termination_closure_(termination_closure), 52 termination_closure_(termination_closure),
53 app_lifetime_helper_(this), 53 app_lifetime_helper_(this),
54 quit_requested_(false), 54 quit_requested_(false),
55 weak_factory_(this) {} 55 weak_factory_(this) {}
56 56
57 ApplicationImpl::~ApplicationImpl() { 57 ApplicationImpl::~ApplicationImpl() {
58 app_lifetime_helper_.OnQuit(); 58 app_lifetime_helper_.OnQuit();
59 } 59 }
60 60
61 scoped_ptr<ApplicationConnection> ApplicationImpl::ConnectToApplication( 61 scoped_ptr<ApplicationConnection> ApplicationImpl::ConnectToApplication(
62 mojo::URLRequestPtr request, 62 URLRequestPtr request) {
63 CapabilityFilterPtr filter) { 63 return ConnectToApplicationWithCapabilityFilter(request.Pass(), nullptr);
64 }
65
66 scoped_ptr<ApplicationConnection>
67 ApplicationImpl::ConnectToApplicationWithCapabilityFilter(
68 URLRequestPtr request,
69 CapabilityFilterPtr filter) {
64 if (!shell_) 70 if (!shell_)
65 return nullptr; 71 return nullptr;
66 ServiceProviderPtr local_services; 72 ServiceProviderPtr local_services;
67 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); 73 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services);
68 ServiceProviderPtr remote_services; 74 ServiceProviderPtr remote_services;
69 std::string application_url = request->url.To<std::string>(); 75 std::string application_url = request->url.To<std::string>();
70 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), 76 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services),
71 local_services.Pass(), filter.Pass()); 77 local_services.Pass(), filter.Pass());
72 // We allow all interfaces on outgoing connections since we are presumably in 78 // We allow all interfaces on outgoing connections since we are presumably in
73 // a position to know who we're talking to. 79 // a position to know who we're talking to.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 157 }
152 158
153 void ApplicationImpl::UnbindConnections( 159 void ApplicationImpl::UnbindConnections(
154 InterfaceRequest<Application>* application_request, 160 InterfaceRequest<Application>* application_request,
155 ShellPtr* shell) { 161 ShellPtr* shell) {
156 *application_request = binding_.Unbind(); 162 *application_request = binding_.Unbind();
157 shell->Bind(shell_.PassInterface()); 163 shell->Bind(shell_.PassInterface());
158 } 164 }
159 165
160 } // namespace mojo 166 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/public/cpp/application_impl.h ('k') | mojo/application/public/cpp/lib/service_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698