OLD | NEW |
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 "base/callback.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "services/shell/public/cpp/capabilities.h" | 15 #include "services/shell/public/cpp/capabilities.h" |
15 #include "services/shell/public/cpp/connection.h" | 16 #include "services/shell/public/cpp/connection.h" |
16 #include "services/shell/public/cpp/identity.h" | 17 #include "services/shell/public/cpp/identity.h" |
17 #include "services/shell/public/interfaces/connector.mojom.h" | 18 #include "services/shell/public/interfaces/connector.mojom.h" |
18 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 19 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
19 | 20 |
20 namespace shell { | 21 namespace shell { |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
(...skipping 19 matching lines...) Expand all Loading... |
42 | 43 |
43 private: | 44 private: |
44 // Connection: | 45 // Connection: |
45 bool HasCapabilityClass(const std::string& class_name) const override; | 46 bool HasCapabilityClass(const std::string& class_name) const override; |
46 const std::string& GetConnectionName() override; | 47 const std::string& GetConnectionName() override; |
47 const Identity& GetRemoteIdentity() const override; | 48 const Identity& GetRemoteIdentity() const override; |
48 void SetConnectionLostClosure(const base::Closure& handler) override; | 49 void SetConnectionLostClosure(const base::Closure& handler) override; |
49 shell::mojom::ConnectResult GetResult() const override; | 50 shell::mojom::ConnectResult GetResult() const override; |
50 bool IsPending() const override; | 51 bool IsPending() const override; |
51 uint32_t GetRemoteInstanceID() const override; | 52 uint32_t GetRemoteInstanceID() const override; |
52 void AddConnectionCompletedClosure(const mojo::Closure& callback) override; | 53 void AddConnectionCompletedClosure(const base::Closure& callback) override; |
53 bool AllowsInterface(const std::string& interface_name) const override; | 54 bool AllowsInterface(const std::string& interface_name) const override; |
54 mojom::InterfaceProvider* GetRemoteInterfaceProvider() override; | 55 mojom::InterfaceProvider* GetRemoteInterfaceProvider() override; |
55 InterfaceRegistry* GetInterfaceRegistry() override; | 56 InterfaceRegistry* GetInterfaceRegistry() override; |
56 RemoteInterfaceRegistry* GetRemoteInterfaceRegistry() override; | 57 RemoteInterfaceRegistry* GetRemoteInterfaceRegistry() override; |
57 base::WeakPtr<Connection> GetWeakPtr() override; | 58 base::WeakPtr<Connection> GetWeakPtr() override; |
58 | 59 |
59 void OnConnectionCompleted(shell::mojom::ConnectResult result, | 60 void OnConnectionCompleted(shell::mojom::ConnectResult result, |
60 mojo::String target_user_id, | 61 mojo::String target_user_id, |
61 uint32_t target_application_id); | 62 uint32_t target_application_id); |
62 | 63 |
63 const std::string connection_name_; | 64 const std::string connection_name_; |
64 Identity remote_; | 65 Identity remote_; |
65 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID; | 66 uint32_t remote_id_ = shell::mojom::kInvalidInstanceID; |
66 | 67 |
67 State state_; | 68 State state_; |
68 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED; | 69 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED; |
69 std::vector<mojo::Closure> connection_completed_callbacks_; | 70 std::vector<base::Closure> connection_completed_callbacks_; |
70 | 71 |
71 InterfaceRegistry interfaces_; | 72 InterfaceRegistry interfaces_; |
72 RemoteInterfaceRegistry remote_interfaces_; | 73 RemoteInterfaceRegistry remote_interfaces_; |
73 | 74 |
74 const CapabilityRequest capability_request_; | 75 const CapabilityRequest capability_request_; |
75 const bool allow_all_interfaces_; | 76 const bool allow_all_interfaces_; |
76 | 77 |
77 base::WeakPtrFactory<ConnectionImpl> weak_factory_; | 78 base::WeakPtrFactory<ConnectionImpl> weak_factory_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); | 80 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace internal | 83 } // namespace internal |
83 } // namespace shell | 84 } // namespace shell |
84 | 85 |
85 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ | 86 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ |
OLD | NEW |