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

Side by Side Diff: mojo/application/public/cpp/lib/service_registry.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_LIB_SERVICE_REGISTRY_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 10
10 #include "mojo/application/public/cpp/application_connection.h" 11 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/lib/service_connector_registry.h" 12 #include "mojo/application/public/cpp/lib/service_connector_registry.h"
12 #include "mojo/application/public/interfaces/service_provider.mojom.h" 13 #include "mojo/application/public/interfaces/service_provider.mojom.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 class Application; 17 class Application;
17 class ApplicationImpl; 18 class ApplicationImpl;
18 19
19 namespace internal { 20 namespace internal {
20 21
21 // A ServiceRegistry represents each half of a connection between two 22 // A ServiceRegistry represents each half of a connection between two
22 // applications, allowing customization of which services are published to the 23 // applications, allowing customization of which services are published to the
23 // other. 24 // other.
24 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { 25 class ServiceRegistry : public ServiceProvider, public ApplicationConnection {
25 public: 26 public:
26 ServiceRegistry(); 27 ServiceRegistry();
28 // |allowed_interfaces| are the set of interfaces that the shell has allowed
29 // an application to expose to another application. If this set is empty, the
30 // application is allowed to expose all of its interfaces.
27 ServiceRegistry(ApplicationImpl* application_impl, 31 ServiceRegistry(ApplicationImpl* application_impl,
28 const std::string& connection_url, 32 const std::string& connection_url,
29 const std::string& remote_url, 33 const std::string& remote_url,
30 ServiceProviderPtr remote_services, 34 ServiceProviderPtr remote_services,
31 InterfaceRequest<ServiceProvider> local_services); 35 InterfaceRequest<ServiceProvider> local_services,
36 std::set<std::string> allowed_interfaces);
sky 2015/07/22 15:57:45 const std::set<std::string>&
32 37
33 // ApplicationConnection overrides. 38 // ApplicationConnection overrides.
34 void SetServiceConnector(ServiceConnector* service_connector) override; 39 void SetServiceConnector(ServiceConnector* service_connector) override;
35 void SetServiceConnectorForName(ServiceConnector* service_connector, 40 void SetServiceConnectorForName(ServiceConnector* service_connector,
36 const std::string& interface_name) override; 41 const std::string& interface_name) override;
37 const std::string& GetConnectionURL() override; 42 const std::string& GetConnectionURL() override;
38 const std::string& GetRemoteApplicationURL() override; 43 const std::string& GetRemoteApplicationURL() override;
39 ServiceProvider* GetServiceProvider() override; 44 ServiceProvider* GetServiceProvider() override;
40 ServiceProvider* GetLocalServiceProvider() override; 45 ServiceProvider* GetLocalServiceProvider() override;
41 46
42 void RemoveServiceConnectorForName(const std::string& interface_name); 47 void RemoveServiceConnectorForName(const std::string& interface_name);
43 48
44 private: 49 private:
45 ~ServiceRegistry() override; 50 ~ServiceRegistry() override;
46 51
47 // ApplicationConnection overrides. 52 // ApplicationConnection overrides.
48 void OnCloseConnection() override; 53 void OnCloseConnection() override;
49 54
50 // ServiceProvider method. 55 // ServiceProvider method.
51 void ConnectToService(const mojo::String& service_name, 56 void ConnectToService(const mojo::String& service_name,
52 ScopedMessagePipeHandle client_handle) override; 57 ScopedMessagePipeHandle client_handle) override;
53 58
54 ApplicationImpl* application_impl_; 59 ApplicationImpl* application_impl_;
55 const std::string connection_url_; 60 const std::string connection_url_;
56 const std::string remote_url_; 61 const std::string remote_url_;
57 Binding<ServiceProvider> local_binding_; 62 Binding<ServiceProvider> local_binding_;
58 ServiceProviderPtr remote_service_provider_; 63 ServiceProviderPtr remote_service_provider_;
59 ServiceConnectorRegistry service_connector_registry_; 64 ServiceConnectorRegistry service_connector_registry_;
65 std::set<std::string> allowed_interfaces_;
sky 2015/07/22 15:57:45 nit: const
60 66
61 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); 67 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry);
62 }; 68 };
63 69
64 } // namespace internal 70 } // namespace internal
65 } // namespace mojo 71 } // namespace mojo
66 72
67 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ 73 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698