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

Side by Side Diff: services/service_manager/public/cpp/connector.h

Issue 2775483003: Use public Service Manager Connector API in Blink (Closed)
Patch Set: . Created 3 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/test/BUILD.gn ('k') | services/service_manager/public/cpp/lib/connector_impl.h » ('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 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 SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_ 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "services/service_manager/public/cpp/connection.h" 10 #include "services/service_manager/public/cpp/connection.h"
(...skipping 20 matching lines...) Expand all
31 // connection with the service manager is bound to the lifetime of the instance 31 // connection with the service manager is bound to the lifetime of the instance
32 // that 32 // that
33 // created it, i.e. when the application is terminated the Connector pipe is 33 // created it, i.e. when the application is terminated the Connector pipe is
34 // closed. 34 // closed.
35 class Connector { 35 class Connector {
36 public: 36 public:
37 class TestApi { 37 class TestApi {
38 public: 38 public:
39 using Binder = base::Callback<void(mojo::ScopedMessagePipeHandle)>; 39 using Binder = base::Callback<void(mojo::ScopedMessagePipeHandle)>;
40 explicit TestApi(Connector* connector) : connector_(connector) {} 40 explicit TestApi(Connector* connector) : connector_(connector) {}
41
41 // Allows caller to specify a callback to bind requests for |interface_name| 42 // Allows caller to specify a callback to bind requests for |interface_name|
42 // locally, rather than passing the request through the Service Manager. 43 // from |service_name| locally, rather than passing the request through the
43 void OverrideBinderForTesting(const std::string& interface_name, 44 // Service Manager.
45 void OverrideBinderForTesting(const std::string& service_name,
46 const std::string& interface_name,
44 const Binder& binder) { 47 const Binder& binder) {
45 connector_->OverrideBinderForTesting(interface_name, binder); 48 connector_->OverrideBinderForTesting(service_name, interface_name,
49 binder);
46 } 50 }
47 void ClearBinderOverrides() { connector_->ClearBinderOverrides(); } 51 void ClearBinderOverrides() { connector_->ClearBinderOverrides(); }
48 52
49 private: 53 private:
50 Connector* connector_; 54 Connector* connector_;
51 }; 55 };
52 56
53 virtual ~Connector() {} 57 virtual ~Connector() {}
54 58
55 // Creates a new Connector instance and fills in |*request| with a request 59 // Creates a new Connector instance and fills in |*request| with a request
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // The returned object may be passed multiple times until Connect() is called, 103 // The returned object may be passed multiple times until Connect() is called,
100 // at which point this method must be called again to pass again. 104 // at which point this method must be called again to pass again.
101 virtual std::unique_ptr<Connector> Clone() = 0; 105 virtual std::unique_ptr<Connector> Clone() = 0;
102 106
103 // Binds a Connector request to the other end of this Connector. 107 // Binds a Connector request to the other end of this Connector.
104 virtual void BindConnectorRequest(mojom::ConnectorRequest request) = 0; 108 virtual void BindConnectorRequest(mojom::ConnectorRequest request) = 0;
105 109
106 virtual base::WeakPtr<Connector> GetWeakPtr() = 0; 110 virtual base::WeakPtr<Connector> GetWeakPtr() = 0;
107 111
108 protected: 112 protected:
109 virtual void OverrideBinderForTesting(const std::string& interface_name, 113 virtual void OverrideBinderForTesting(const std::string& service_name,
114 const std::string& interface_name,
110 const TestApi::Binder& binder) = 0; 115 const TestApi::Binder& binder) = 0;
111 virtual void ClearBinderOverrides() = 0; 116 virtual void ClearBinderOverrides() = 0;
112 }; 117 };
113 118
114 } // namespace service_manager 119 } // namespace service_manager
115 120
116 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_ 121 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
OLDNEW
« no previous file with comments | « content/test/BUILD.gn ('k') | services/service_manager/public/cpp/lib/connector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698