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 MOJO_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ | 6 #define MOJO_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 12 matching lines...) Expand all Loading... |
23 // other. | 23 // other. |
24 class ConnectionImpl : public Connection { | 24 class ConnectionImpl : public Connection { |
25 public: | 25 public: |
26 ConnectionImpl(); | 26 ConnectionImpl(); |
27 // |allowed_interfaces| are the set of interfaces that the shell has allowed | 27 // |allowed_interfaces| are the set of interfaces that the shell has allowed |
28 // an application to expose to another application. If this set contains only | 28 // an application to expose to another application. If this set contains only |
29 // the string value "*" all interfaces may be exposed. | 29 // the string value "*" all interfaces may be exposed. |
30 ConnectionImpl(const std::string& connection_name, | 30 ConnectionImpl(const std::string& connection_name, |
31 const std::string& remote_name, | 31 const std::string& remote_name, |
32 uint32_t remote_id, | 32 uint32_t remote_id, |
33 uint32_t remote_user_id, | 33 const std::string& remote_user_id, |
34 shell::mojom::InterfaceProviderPtr remote_interfaces, | 34 shell::mojom::InterfaceProviderPtr remote_interfaces, |
35 shell::mojom::InterfaceProviderRequest local_interfaces, | 35 shell::mojom::InterfaceProviderRequest local_interfaces, |
36 const std::set<std::string>& allowed_interfaces); | 36 const std::set<std::string>& allowed_interfaces); |
37 ~ConnectionImpl() override; | 37 ~ConnectionImpl() override; |
38 | 38 |
39 shell::mojom::Connector::ConnectCallback GetConnectCallback(); | 39 shell::mojom::Connector::ConnectCallback GetConnectCallback(); |
40 | 40 |
41 private: | 41 private: |
42 // Connection: | 42 // Connection: |
43 const std::string& GetConnectionName() override; | 43 const std::string& GetConnectionName() override; |
44 const std::string& GetRemoteApplicationName() override; | 44 const std::string& GetRemoteApplicationName() override; |
45 uint32_t GetRemoteUserID() const override; | 45 const std::string& GetRemoteUserID() const override; |
46 void SetRemoteInterfaceProviderConnectionErrorHandler( | 46 void SetRemoteInterfaceProviderConnectionErrorHandler( |
47 const Closure& handler) override; | 47 const Closure& handler) override; |
48 bool GetRemoteApplicationID(uint32_t* remote_id) const override; | 48 bool GetRemoteApplicationID(uint32_t* remote_id) const override; |
49 void AddRemoteIDCallback(const Closure& callback) override; | 49 void AddRemoteIDCallback(const Closure& callback) override; |
50 bool AllowsInterface(const std::string& interface_name) const override; | 50 bool AllowsInterface(const std::string& interface_name) const override; |
51 shell::mojom::InterfaceProvider* GetRemoteInterfaces() override; | 51 shell::mojom::InterfaceProvider* GetRemoteInterfaces() override; |
52 InterfaceRegistry* GetLocalRegistry() override; | 52 InterfaceRegistry* GetLocalRegistry() override; |
53 base::WeakPtr<Connection> GetWeakPtr() override; | 53 base::WeakPtr<Connection> GetWeakPtr() override; |
54 | 54 |
55 void OnGotInstanceID(uint32_t target_application_id, | 55 void OnGotInstanceID(const std::string& target_user_id, |
56 uint32_t target_user_id); | 56 uint32_t target_application_id); |
57 | 57 |
58 const std::string connection_name_; | 58 const std::string connection_name_; |
59 const std::string remote_name_; | 59 const std::string remote_name_; |
60 | 60 |
61 uint32_t remote_id_; | 61 uint32_t remote_id_; |
62 bool remote_ids_valid_; | 62 bool remote_ids_valid_; |
63 std::vector<Closure> remote_id_callbacks_; | 63 std::vector<Closure> remote_id_callbacks_; |
64 uint32_t remote_user_id_; | 64 std::string remote_user_id_; |
65 | 65 |
66 InterfaceRegistry local_registry_; | 66 InterfaceRegistry local_registry_; |
67 shell::mojom::InterfaceProviderPtr remote_interfaces_; | 67 shell::mojom::InterfaceProviderPtr remote_interfaces_; |
68 | 68 |
69 const std::set<std::string> allowed_interfaces_; | 69 const std::set<std::string> allowed_interfaces_; |
70 const bool allow_all_interfaces_; | 70 const bool allow_all_interfaces_; |
71 | 71 |
72 base::WeakPtrFactory<ConnectionImpl> weak_factory_; | 72 base::WeakPtrFactory<ConnectionImpl> weak_factory_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); | 74 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace internal | 77 } // namespace internal |
78 } // namespace mojo | 78 } // namespace mojo |
79 | 79 |
80 #endif // MOJO_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ | 80 #endif // MOJO_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_ |
OLD | NEW |