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

Side by Side Diff: services/shell/public/cpp/lib/connection_impl.h

Issue 2090773003: Add ability to bind a different InterfaceRegistry/InterfaceProvider to an incoming Connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 15 matching lines...) Expand all
26 // other. 26 // other.
27 class ConnectionImpl : public Connection { 27 class ConnectionImpl : public Connection {
28 public: 28 public:
29 ConnectionImpl(); 29 ConnectionImpl();
30 // |allowed_interfaces| are the set of interfaces that the shell has allowed 30 // |allowed_interfaces| are the set of interfaces that the shell has allowed
31 // an application to expose to another application. If this set contains only 31 // an application to expose to another application. If this set contains only
32 // the string value "*" all interfaces may be exposed. 32 // the string value "*" all interfaces may be exposed.
33 ConnectionImpl(const std::string& connection_name, 33 ConnectionImpl(const std::string& connection_name,
34 const Identity& remote, 34 const Identity& remote,
35 uint32_t remote_id, 35 uint32_t remote_id,
36 shell::mojom::InterfaceProviderPtr remote_interfaces,
37 shell::mojom::InterfaceProviderRequest local_interfaces,
38 const CapabilityRequest& capability_request, 36 const CapabilityRequest& capability_request,
39 State initial_state); 37 State initial_state);
40 ~ConnectionImpl() override; 38 ~ConnectionImpl() override;
41 39
40 // Sets the local registry & remote provider, transferring ownership to the
41 // ConnectionImpl.
42 void SetExposedInterfaces(
43 std::unique_ptr<InterfaceRegistry> exposed_interfaces);
44 void SetRemoteInterfaces(
45 std::unique_ptr<InterfaceProvider> remote_interfaces);
46
47 // Sets the local registry & remote provider, without transferring ownership.
48 void set_exposed_interfaces(InterfaceRegistry* exposed_interfaces) {
49 exposed_interfaces_ = exposed_interfaces;
50 }
51 void set_remote_interfaces(InterfaceProvider* remote_interfaces) {
52 remote_interfaces_ = remote_interfaces;
53 }
54
42 shell::mojom::Connector::ConnectCallback GetConnectCallback(); 55 shell::mojom::Connector::ConnectCallback GetConnectCallback();
43 56
44 private: 57 private:
45 // Connection: 58 // Connection:
46 bool HasCapabilityClass(const std::string& class_name) const override; 59 bool HasCapabilityClass(const std::string& class_name) const override;
47 const std::string& GetConnectionName() override; 60 const std::string& GetConnectionName() override;
48 const Identity& GetRemoteIdentity() const override; 61 const Identity& GetRemoteIdentity() const override;
49 void SetConnectionLostClosure(const base::Closure& handler) override; 62 void SetConnectionLostClosure(const base::Closure& handler) override;
50 shell::mojom::ConnectResult GetResult() const override; 63 shell::mojom::ConnectResult GetResult() const override;
51 bool IsPending() const override; 64 bool IsPending() const override;
(...skipping 10 matching lines...) Expand all
62 uint32_t target_application_id); 75 uint32_t target_application_id);
63 76
64 const std::string connection_name_; 77 const std::string connection_name_;
65 Identity remote_; 78 Identity remote_;
66 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID; 79 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID;
67 80
68 State state_; 81 State state_;
69 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED; 82 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED;
70 std::vector<base::Closure> connection_completed_callbacks_; 83 std::vector<base::Closure> connection_completed_callbacks_;
71 84
72 InterfaceRegistry interfaces_; 85 InterfaceRegistry* exposed_interfaces_ = nullptr;
73 InterfaceProvider remote_interfaces_; 86 InterfaceProvider* remote_interfaces_ = nullptr;
87
88 std::unique_ptr<InterfaceRegistry> exposed_interfaces_owner_;
89 std::unique_ptr<InterfaceProvider> remote_interfaces_owner_;
74 90
75 const CapabilityRequest capability_request_; 91 const CapabilityRequest capability_request_;
76 const bool allow_all_interfaces_; 92 const bool allow_all_interfaces_;
77 93
78 base::WeakPtrFactory<ConnectionImpl> weak_factory_; 94 base::WeakPtrFactory<ConnectionImpl> weak_factory_;
79 95
80 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); 96 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl);
81 }; 97 };
82 98
83 } // namespace internal 99 } // namespace internal
84 } // namespace shell 100 } // namespace shell
85 101
86 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ 102 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/interface_provider.h ('k') | services/shell/public/cpp/lib/connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698