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

Side by Side Diff: mojo/application/public/cpp/application_impl.h

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 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 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const std::string& url() const { return url_; } 74 const std::string& url() const { return url_; }
75 75
76 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } 76 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; }
77 77
78 // Requests a new connection to an application. Returns a pointer to the 78 // Requests a new connection to an application. Returns a pointer to the
79 // connection if the connection is permitted by this application's delegate, 79 // connection if the connection is permitted by this application's delegate,
80 // or nullptr otherwise. Caller does not take ownership. The pointer remains 80 // or nullptr otherwise. Caller does not take ownership. The pointer remains
81 // valid until an error occurs on the connection with the Shell, until the 81 // valid until an error occurs on the connection with the Shell, until the
82 // ApplicationImpl is destroyed, or until the connection is closed through a 82 // ApplicationImpl is destroyed, or until the connection is closed through a
83 // call to ApplicationConnection::CloseConnection. 83 // call to ApplicationConnection::CloseConnection.
84 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); 84 ApplicationConnection* ConnectToApplication(
85 URLRequestPtr request,
86 CapabilityFilterPtr filter = nullptr);
sky 2015/07/22 15:57:44 Style guide says no default values.
85 87
86 // Closes the |connection|. 88 // Closes the |connection|.
87 void CloseConnection(ApplicationConnection* connection); 89 void CloseConnection(ApplicationConnection* connection);
88 90
89 // Connect to application identified by |request->url| and connect to the 91 // Connect to application identified by |request->url| and connect to the
90 // service implementation of the interface identified by |Interface|. 92 // service implementation of the interface identified by |Interface|.
91 template <typename Interface> 93 template <typename Interface>
92 void ConnectToService(mojo::URLRequestPtr request, 94 void ConnectToService(mojo::URLRequestPtr request,
93 InterfacePtr<Interface>* ptr) { 95 InterfacePtr<Interface>* ptr) {
94 ApplicationConnection* connection = ConnectToApplication(request.Pass()); 96 ApplicationConnection* connection = ConnectToApplication(request.Pass());
(...skipping 19 matching lines...) Expand all
114 void Terminate(); 116 void Terminate();
115 117
116 // Quits without waiting to check with the shell. 118 // Quits without waiting to check with the shell.
117 void QuitNow(); 119 void QuitNow();
118 120
119 private: 121 private:
120 // Application implementation. 122 // Application implementation.
121 void AcceptConnection(const String& requestor_url, 123 void AcceptConnection(const String& requestor_url,
122 InterfaceRequest<ServiceProvider> services, 124 InterfaceRequest<ServiceProvider> services,
123 ServiceProviderPtr exposed_services, 125 ServiceProviderPtr exposed_services,
126 Array<String> allowed_interfaces,
124 const String& url) override; 127 const String& url) override;
125 void OnQuitRequested(const Callback<void(bool)>& callback) override; 128 void OnQuitRequested(const Callback<void(bool)>& callback) override;
126 129
127 void OnConnectionError(); 130 void OnConnectionError();
128 131
129 void ClearConnections(); 132 void ClearConnections();
130 133
131 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; 134 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList;
132 135
133 ServiceRegistryList incoming_service_registries_; 136 ServiceRegistryList incoming_service_registries_;
134 ServiceRegistryList outgoing_service_registries_; 137 ServiceRegistryList outgoing_service_registries_;
135 ApplicationDelegate* delegate_; 138 ApplicationDelegate* delegate_;
136 Binding<Application> binding_; 139 Binding<Application> binding_;
137 ShellPtr shell_; 140 ShellPtr shell_;
138 std::string url_; 141 std::string url_;
139 base::Closure termination_closure_; 142 base::Closure termination_closure_;
140 AppLifetimeHelper app_lifetime_helper_; 143 AppLifetimeHelper app_lifetime_helper_;
141 bool quit_requested_; 144 bool quit_requested_;
142 bool in_destructor_; 145 bool in_destructor_;
143 base::WeakPtrFactory<ApplicationImpl> weak_factory_; 146 base::WeakPtrFactory<ApplicationImpl> weak_factory_;
144 147
145 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 148 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
146 }; 149 };
147 150
148 } // namespace mojo 151 } // namespace mojo
149 152
150 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 153 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698