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

Side by Side Diff: content/public/common/service_manager_connection.h

Issue 2456493003: Add frame-specific InterfaceProviderSpec. (Closed)
Patch Set: . Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_
6 #define CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_ 6 #define CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 21 matching lines...) Expand all
32 // interfaces 32 // interfaces
33 // will be exposed to inbound connections to this object's Service. 33 // will be exposed to inbound connections to this object's Service.
34 // Alternatively clients can define named services that will be constructed when 34 // Alternatively clients can define named services that will be constructed when
35 // requests for those service names are received. 35 // requests for those service names are received.
36 // Clients must call any of the registration methods when receiving 36 // Clients must call any of the registration methods when receiving
37 // ContentBrowserClient::RegisterInProcessServices(). 37 // ContentBrowserClient::RegisterInProcessServices().
38 class CONTENT_EXPORT ServiceManagerConnection { 38 class CONTENT_EXPORT ServiceManagerConnection {
39 public: 39 public:
40 using ServiceRequestHandler = 40 using ServiceRequestHandler =
41 base::Callback<void(service_manager::mojom::ServiceRequest)>; 41 base::Callback<void(service_manager::mojom::ServiceRequest)>;
42 using OnConnectHandler =
43 base::Callback<void(const service_manager::ServiceInfo&,
44 const service_manager::ServiceInfo&)>;
42 using Factory = 45 using Factory =
43 base::Callback<std::unique_ptr<ServiceManagerConnection>(void)>; 46 base::Callback<std::unique_ptr<ServiceManagerConnection>(void)>;
44 47
45 // Stores an instance of |connection| in TLS for the current process. Must be 48 // Stores an instance of |connection| in TLS for the current process. Must be
46 // called on the thread the connection was created on. 49 // called on the thread the connection was created on.
47 static void SetForProcess( 50 static void SetForProcess(
48 std::unique_ptr<ServiceManagerConnection> connection); 51 std::unique_ptr<ServiceManagerConnection> connection);
49 52
50 // Returns the per-process instance, or nullptr if the Service Manager 53 // Returns the per-process instance, or nullptr if the Service Manager
51 // connection has not yet been bound. Must be called on the thread the 54 // connection has not yet been bound. Must be called on the thread the
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 140
138 // Adds a generic ServiceRequestHandler for a given service name. This 141 // Adds a generic ServiceRequestHandler for a given service name. This
139 // will be used to satisfy any incoming calls to CreateService() which 142 // will be used to satisfy any incoming calls to CreateService() which
140 // reference the given name. 143 // reference the given name.
141 // 144 //
142 // For in-process services, it is preferable to use |AddEmbeddedService()| as 145 // For in-process services, it is preferable to use |AddEmbeddedService()| as
143 // defined above. 146 // defined above.
144 virtual void AddServiceRequestHandler( 147 virtual void AddServiceRequestHandler(
145 const std::string& name, 148 const std::string& name,
146 const ServiceRequestHandler& handler) = 0; 149 const ServiceRequestHandler& handler) = 0;
150
151 // Registers a callback to be run when the service_manager::Service
152 // implementation on the IO thread receives OnConnect(). Returns an id that
153 // can be passed to RemoveOnConnectHandler(), starting at 1.
154 virtual int AddOnConnectHandler(const OnConnectHandler& handler) = 0;
155 virtual void RemoveOnConnectHandler(int id) = 0;
147 }; 156 };
148 157
149 } // namespace content 158 } // namespace content
150 159
151 #endif // CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_ 160 #endif // CONTENT_PUBLIC_COMMON_SERVICE_MANAGER_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/public/app/mojo/content_renderer_manifest.json ('k') | content/public/test/mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698