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

Side by Side Diff: services/service_manager/public/cpp/lib/connector_impl.h

Issue 2857963004: Flatten Connector & ConnectorImpl (Closed)
Patch Set: . Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
7
8 #include <map>
9 #include <memory>
10
11 #include "base/callback.h"
12 #include "base/threading/thread_checker.h"
13 #include "services/service_manager/public/cpp/connector.h"
14 #include "services/service_manager/public/interfaces/connector.mojom.h"
15
16 namespace service_manager {
17
18 class ConnectorImpl : public Connector {
19 public:
20 explicit ConnectorImpl(mojom::ConnectorPtrInfo unbound_state);
21 explicit ConnectorImpl(mojom::ConnectorPtr connector);
22 ~ConnectorImpl() override;
23
24 private:
25 void OnConnectionError();
26
27 // Connector:
28 void StartService(const Identity& identity) override;
29 void StartService(const std::string& name) override;
30 void StartService(const Identity& identity,
31 mojom::ServicePtr service,
32 mojom::PIDReceiverRequest pid_receiver_request) override;
33 void BindInterface(const Identity& target,
34 const std::string& interface_name,
35 mojo::ScopedMessagePipeHandle interface_pipe) override;
36 std::unique_ptr<Connector> Clone() override;
37 void FilterInterfaces(const std::string& spec,
38 const Identity& source_identity,
39 mojom::InterfaceProviderRequest request,
40 mojom::InterfaceProviderPtr target) override;
41 void BindConnectorRequest(mojom::ConnectorRequest request) override;
42 base::WeakPtr<Connector> GetWeakPtr() override;
43 void OverrideBinderForTesting(const std::string& service_name,
44 const std::string& interface_name,
45 const TestApi::Binder& binder) override;
46 void ClearBinderOverrides() override;
47 void SetStartServiceCallback(const StartServiceCallback& callback) override;
48 void ResetStartServiceCallback() override;
49
50 bool BindConnectorIfNecessary();
51
52 // Callback passed to mojom methods StartService()/BindInterface().
53 void StartServiceCallback(mojom::ConnectResult result,
54 const Identity& user_id);
55
56 using BinderOverrideMap = std::map<std::string, TestApi::Binder>;
57
58 mojom::ConnectorPtrInfo unbound_state_;
59 mojom::ConnectorPtr connector_;
60
61 base::ThreadChecker thread_checker_;
62
63 std::map<std::string, BinderOverrideMap> local_binder_overrides_;
64 Connector::StartServiceCallback start_service_callback_;
65
66 base::WeakPtrFactory<ConnectorImpl> weak_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(ConnectorImpl);
69 };
70
71 } // namespace service_manager
72
73 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/connector.cc ('k') | services/service_manager/public/cpp/lib/connector_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698