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

Unified Diff: mojo/application/public/cpp/lib/application_impl.cc

Issue 1244233002: Allow trusted brokers to restrict connections for spawned applications to whitelisted applications … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: mojo/application/public/cpp/lib/application_impl.cc
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc
index 200bce4083a13c223f4f06e5d1314f7bf2d3bb44..416daa4f51e43f59fa585d088f411c38074442f6 100644
--- a/mojo/application/public/cpp/lib/application_impl.cc
+++ b/mojo/application/public/cpp/lib/application_impl.cc
@@ -23,6 +23,18 @@ void DefaultTerminationClosure() {
base::MessageLoop::current()->Quit();
}
+template <typename E, typename T>
+struct TypeConverter < std::set<E>, Array<T> > {
sky 2015/07/22 15:57:44 You shouldn't need the extra spaces anymore, eg <s
+ static std::set<E> Convert(const Array<T>& input) {
+ std::set<E> result;
+ if (!input.is_null()) {
+ for (size_t i = 0; i < input.size(); ++i)
+ result.insert(TypeConverter<E, T>::Convert(input[i]));
+ }
+ return result;
+ }
+};
+
} // namespace
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
@@ -65,7 +77,8 @@ ApplicationImpl::~ApplicationImpl() {
}
ApplicationConnection* ApplicationImpl::ConnectToApplication(
- mojo::URLRequestPtr request) {
+ mojo::URLRequestPtr request,
+ CapabilityFilterPtr filter) {
if (!shell_)
return nullptr;
ServiceProviderPtr local_services;
@@ -73,10 +86,10 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
ServiceProviderPtr remote_services;
std::string application_url = request->url.To<std::string>();
shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services),
- local_services.Pass());
+ local_services.Pass(), filter.Pass());
internal::ServiceRegistry* registry = new internal::ServiceRegistry(
this, application_url, application_url, remote_services.Pass(),
- local_request.Pass());
+ local_request.Pass(), std::set<std::string>());
if (!delegate_->ConfigureOutgoingConnection(registry)) {
registry->CloseConnection();
return nullptr;
@@ -141,9 +154,11 @@ void ApplicationImpl::AcceptConnection(
const String& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
+ Array<String> allowed_interfaces,
const String& url) {
internal::ServiceRegistry* registry = new internal::ServiceRegistry(
- this, url, requestor_url, exposed_services.Pass(), services.Pass());
+ this, url, requestor_url, exposed_services.Pass(), services.Pass(),
+ allowed_interfaces.To<std::set<std::string> >());
sky 2015/07/22 15:57:45 nit: '> >' -> '>>'
if (!delegate_->ConfigureIncomingConnection(registry)) {
registry->CloseConnection();
return;

Powered by Google App Engine
This is Rietveld 408576698