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

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

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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>
11 #include <string> 11 #include <string>
12 12
13 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "services/shell/public/cpp/capabilities.h" 14 #include "services/shell/public/cpp/capabilities.h"
15 #include "services/shell/public/cpp/connection.h" 15 #include "services/shell/public/cpp/connection.h"
16 #include "services/shell/public/cpp/identity.h" 16 #include "services/shell/public/cpp/identity.h"
17 #include "services/shell/public/interfaces/connector.mojom.h" 17 #include "services/shell/public/interfaces/connector.mojom.h"
18 #include "services/shell/public/interfaces/interface_provider.mojom.h" 18 #include "services/shell/public/interfaces/interface_provider.mojom.h"
19 19
20 namespace mojo { 20 namespace shell {
21 namespace internal { 21 namespace internal {
22 22
23 // A ConnectionImpl represents each half of a connection between two 23 // A ConnectionImpl represents each half of a connection between two
24 // applications, allowing customization of which interfaces are published to the 24 // applications, allowing customization of which interfaces are published to the
25 // other. 25 // other.
26 class ConnectionImpl : public Connection { 26 class ConnectionImpl : public Connection {
27 public: 27 public:
28 ConnectionImpl(); 28 ConnectionImpl();
29 // |allowed_interfaces| are the set of interfaces that the shell has allowed 29 // |allowed_interfaces| are the set of interfaces that the shell has allowed
30 // an application to expose to another application. If this set contains only 30 // an application to expose to another application. If this set contains only
31 // the string value "*" all interfaces may be exposed. 31 // the string value "*" all interfaces may be exposed.
32 ConnectionImpl(const std::string& connection_name, 32 ConnectionImpl(const std::string& connection_name,
33 const Identity& remote, 33 const Identity& remote,
34 uint32_t remote_id, 34 uint32_t remote_id,
35 shell::mojom::InterfaceProviderPtr remote_interfaces, 35 shell::mojom::InterfaceProviderPtr remote_interfaces,
36 shell::mojom::InterfaceProviderRequest local_interfaces, 36 shell::mojom::InterfaceProviderRequest local_interfaces,
37 const CapabilityRequest& capability_request, 37 const CapabilityRequest& capability_request,
38 State initial_state); 38 State initial_state);
39 ~ConnectionImpl() override; 39 ~ConnectionImpl() override;
40 40
41 shell::mojom::Connector::ConnectCallback GetConnectCallback(); 41 shell::mojom::Connector::ConnectCallback GetConnectCallback();
42 42
43 private: 43 private:
44 // Connection: 44 // Connection:
45 bool HasCapabilityClass(const std::string& class_name) const override; 45 bool HasCapabilityClass(const std::string& class_name) const override;
46 const std::string& GetConnectionName() override; 46 const std::string& GetConnectionName() override;
47 const Identity& GetRemoteIdentity() const override; 47 const Identity& GetRemoteIdentity() const override;
48 void SetConnectionLostClosure(const Closure& handler) override; 48 void SetConnectionLostClosure(const mojo::Closure& handler) override;
49 shell::mojom::ConnectResult GetResult() const override; 49 shell::mojom::ConnectResult GetResult() const override;
50 bool IsPending() const override; 50 bool IsPending() const override;
51 uint32_t GetRemoteInstanceID() const override; 51 uint32_t GetRemoteInstanceID() const override;
52 void AddConnectionCompletedClosure(const Closure& callback) override; 52 void AddConnectionCompletedClosure(const mojo::Closure& callback) override;
53 bool AllowsInterface(const std::string& interface_name) const override; 53 bool AllowsInterface(const std::string& interface_name) const override;
54 shell::mojom::InterfaceProvider* GetRemoteInterfaces() override; 54 shell::mojom::InterfaceProvider* GetRemoteInterfaces() override;
55 InterfaceRegistry* GetLocalRegistry() override; 55 InterfaceRegistry* GetLocalRegistry() override;
56 base::WeakPtr<Connection> GetWeakPtr() override; 56 base::WeakPtr<Connection> GetWeakPtr() override;
57 57
58 void OnConnectionCompleted(shell::mojom::ConnectResult result, 58 void OnConnectionCompleted(shell::mojom::ConnectResult result,
59 const std::string& target_user_id, 59 const std::string& target_user_id,
60 uint32_t target_application_id); 60 uint32_t target_application_id);
61 61
62 const std::string connection_name_; 62 const std::string connection_name_;
63 Identity remote_; 63 Identity remote_;
64 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID; 64 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID;
65 65
66 State state_; 66 State state_;
67 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED; 67 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED;
68 std::vector<Closure> connection_completed_callbacks_; 68 std::vector<mojo::Closure> connection_completed_callbacks_;
69 69
70 InterfaceRegistry local_registry_; 70 InterfaceRegistry local_registry_;
71 shell::mojom::InterfaceProviderPtr remote_interfaces_; 71 shell::mojom::InterfaceProviderPtr remote_interfaces_;
72 72
73 const CapabilityRequest capability_request_; 73 const CapabilityRequest capability_request_;
74 const bool allow_all_interfaces_; 74 const bool allow_all_interfaces_;
75 75
76 base::WeakPtrFactory<ConnectionImpl> weak_factory_; 76 base::WeakPtrFactory<ConnectionImpl> weak_factory_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); 78 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl);
79 }; 79 };
80 80
81 } // namespace internal 81 } // namespace internal
82 } // namespace mojo 82 } // namespace shell
83 83
84 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ 84 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/capabilities.cc ('k') | services/shell/public/cpp/lib/connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698