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

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

Issue 1900903002: Fix content/shell including internals of content for service worker test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ios Created 4 years, 8 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
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/shell/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
6 #define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 6 #define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "mojo/public/cpp/bindings/interface_ptr.h" 15 #include "mojo/public/cpp/bindings/interface_ptr.h"
16 #include "mojo/public/cpp/bindings/interface_request.h" 16 #include "mojo/public/cpp/bindings/interface_request.h"
17 #include "mojo/public/cpp/system/core.h" 17 #include "mojo/public/cpp/system/core.h"
18 #include "services/shell/public/interfaces/interface_provider.mojom.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 // A ServiceRegistry exposes local services that have been added using 22 // A ServiceRegistry exposes local services that have been added using
22 // AddService to a paired remote ServiceRegistry and provides local access to 23 // AddService to a paired remote ServiceRegistry and provides local access to
23 // services exposed by the remote ServiceRegistry through 24 // services exposed by the remote ServiceRegistry through
24 // ConnectToRemoteService. 25 // ConnectToRemoteService.
25 class CONTENT_EXPORT ServiceRegistry { 26 class CONTENT_EXPORT ServiceRegistry {
26 public: 27 public:
28 static ServiceRegistry* Create();
27 virtual ~ServiceRegistry() {} 29 virtual ~ServiceRegistry() {}
28 30
31 // Binds this ServiceProvider implementation to a message pipe endpoint.
32 virtual void Bind(shell::mojom::InterfaceProviderRequest request) = 0;
33
34 // Binds to a remote ServiceProvider. This will expose added services to the
35 // remote ServiceProvider with the corresponding handle and enable
36 // ConnectToRemoteService to provide access to services exposed by the remote
37 // ServiceProvider.
38 virtual void BindRemoteServiceProvider(
39 shell::mojom::InterfaceProviderPtr service_provider) = 0;
40
29 // Make the service created by |service_factory| available to the remote 41 // Make the service created by |service_factory| available to the remote
30 // ServiceProvider. In response to each request for a service, 42 // ServiceProvider. In response to each request for a service,
31 // |service_factory| will be run with an InterfaceRequest<Interface> 43 // |service_factory| will be run with an InterfaceRequest<Interface>
32 // representing that request. Adding a factory for an already registered 44 // representing that request. Adding a factory for an already registered
33 // service will override the factory. Existing connections to the service are 45 // service will override the factory. Existing connections to the service are
34 // unaffected. 46 // unaffected.
35 template <typename Interface> 47 template <typename Interface>
36 void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)> 48 void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)>
37 service_factory) { 49 service_factory) {
38 AddService(Interface::Name_, 50 AddService(Interface::Name_,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const base::Callback<void(mojo::InterfaceRequest<Interface>)> 90 const base::Callback<void(mojo::InterfaceRequest<Interface>)>
79 service_factory, 91 service_factory,
80 mojo::ScopedMessagePipeHandle handle) { 92 mojo::ScopedMessagePipeHandle handle) {
81 service_factory.Run(mojo::MakeRequest<Interface>(std::move(handle))); 93 service_factory.Run(mojo::MakeRequest<Interface>(std::move(handle)));
82 } 94 }
83 }; 95 };
84 96
85 } // namespace content 97 } // namespace content
86 98
87 #endif // CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ 99 #endif // CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
OLDNEW
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/shell/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698