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 REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ | 5 #ifndef REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ |
6 #define REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ | 6 #define REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
15 #include "remoting/base/auto_thread.h" | 15 #include "remoting/base/auto_thread.h" |
16 #include "remoting/client/chromoting_client.h" | 16 #include "remoting/client/chromoting_client.h" |
17 #include "remoting/client/client_config.h" | |
18 #include "remoting/client/client_context.h" | 17 #include "remoting/client/client_context.h" |
19 #include "remoting/client/client_user_interface.h" | 18 #include "remoting/client/client_user_interface.h" |
20 #include "remoting/client/frame_consumer_proxy.h" | 19 #include "remoting/client/frame_consumer_proxy.h" |
21 #include "remoting/client/software_video_renderer.h" | 20 #include "remoting/client/software_video_renderer.h" |
22 | 21 |
23 #include "remoting/ios/bridge/frame_consumer_bridge.h" | 22 #include "remoting/ios/bridge/frame_consumer_bridge.h" |
24 | 23 |
25 #include "remoting/jingle_glue/network_settings.h" | 24 #include "remoting/jingle_glue/network_settings.h" |
26 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 25 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
27 #include "remoting/protocol/clipboard_stub.h" | 26 #include "remoting/protocol/clipboard_stub.h" |
28 #include "remoting/protocol/connection_to_host.h" | |
29 #include "remoting/protocol/cursor_shape_stub.h" | 27 #include "remoting/protocol/cursor_shape_stub.h" |
30 | 28 |
31 namespace remoting { | 29 namespace remoting { |
32 | 30 |
33 class ClientProxy; | 31 class ClientProxy; |
34 | 32 |
35 // ClientUserInterface that indirectly makes and receives OBJ_C calls from the | 33 // ClientUserInterface that indirectly makes and receives OBJ_C calls from the |
36 // UI application | 34 // UI application |
37 class ClientInstance : public ClientUserInterface, | 35 class ClientInstance : public ClientUserInterface, |
38 public protocol::ClipboardStub, | 36 public protocol::ClipboardStub, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 virtual void OnConnectionReady(bool ready) OVERRIDE; | 85 virtual void OnConnectionReady(bool ready) OVERRIDE; |
88 virtual void OnRouteChanged(const std::string& channel_name, | 86 virtual void OnRouteChanged(const std::string& channel_name, |
89 const protocol::TransportRoute& route) OVERRIDE; | 87 const protocol::TransportRoute& route) OVERRIDE; |
90 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; | 88 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; |
91 virtual void SetPairingResponse(const protocol::PairingResponse& response) | 89 virtual void SetPairingResponse(const protocol::PairingResponse& response) |
92 OVERRIDE; | 90 OVERRIDE; |
93 virtual void DeliverHostMessage(const protocol::ExtensionMessage& message) | 91 virtual void DeliverHostMessage(const protocol::ExtensionMessage& message) |
94 OVERRIDE; | 92 OVERRIDE; |
95 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; | 93 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; |
96 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; | 94 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; |
97 virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> | |
98 GetTokenFetcher(const std::string& host_public_key) OVERRIDE; | |
99 | 95 |
100 // CursorShapeStub implementation. | 96 // CursorShapeStub implementation. |
101 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) | 97 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) |
102 OVERRIDE; | 98 OVERRIDE; |
103 | 99 |
104 // ClipboardStub implementation. | 100 // ClipboardStub implementation. |
105 virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) OVERRIDE; | 101 virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) OVERRIDE; |
106 | 102 |
107 private: | 103 private: |
108 // This object is ref-counted, so it cleans itself up. | 104 // This object is ref-counted, so it cleans itself up. |
109 virtual ~ClientInstance(); | 105 virtual ~ClientInstance(); |
110 | 106 |
111 void ConnectToHostOnNetworkThread( | 107 void ConnectToHostOnNetworkThread( |
112 scoped_refptr<FrameConsumerProxy> consumer_proxy, | 108 scoped_refptr<FrameConsumerProxy> consumer_proxy, |
113 const base::Closure& done); | 109 const base::Closure& done); |
114 void DisconnectFromHostOnNetworkThread(const base::Closure& done); | 110 void DisconnectFromHostOnNetworkThread(const base::Closure& done); |
115 | 111 |
116 // Proxy to exchange messages between the | 112 // Proxy to exchange messages between the |
117 // common Chromoting protocol and UI Application. | 113 // common Chromoting protocol and UI Application. |
118 base::WeakPtr<ClientProxy> proxyToClient_; | 114 base::WeakPtr<ClientProxy> proxyToClient_; |
119 | 115 |
120 // ID of the host we are connecting to. | 116 // ID of the host we are connecting to. |
121 std::string host_id_; | 117 std::string host_id_; |
| 118 std::string host_jid_; |
122 | 119 |
123 // This group of variables is to be used on the display thread. | 120 // This group of variables is to be used on the display thread. |
124 scoped_ptr<SoftwareVideoRenderer> video_renderer_; | 121 scoped_ptr<SoftwareVideoRenderer> video_renderer_; |
125 scoped_ptr<FrameConsumerBridge> view_; | 122 scoped_ptr<FrameConsumerBridge> view_; |
126 | 123 |
127 // This group of variables is to be used on the network thread. | 124 // This group of variables is to be used on the network thread. |
128 ClientConfig client_config_; | |
129 scoped_ptr<ClientContext> client_context_; | 125 scoped_ptr<ClientContext> client_context_; |
130 scoped_ptr<protocol::ConnectionToHost> connection_; | 126 scoped_ptr<protocol::Authenticator> authenticator_; |
131 scoped_ptr<ChromotingClient> client_; | 127 scoped_ptr<ChromotingClient> client_; |
132 XmppSignalStrategy::XmppServerConfig xmpp_config_; | 128 XmppSignalStrategy::XmppServerConfig xmpp_config_; |
133 scoped_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ | 129 scoped_ptr<XmppSignalStrategy> signaling_; // Must outlive client_ |
134 | 130 |
135 // Pass this the user's PIN once we have it. To be assigned and accessed on | 131 // Pass this the user's PIN once we have it. To be assigned and accessed on |
136 // the UI thread, but must be posted to the network thread to call it. | 132 // the UI thread, but must be posted to the network thread to call it. |
137 protocol::SecretFetchedCallback pin_callback_; | 133 protocol::SecretFetchedCallback pin_callback_; |
138 | 134 |
139 // Indicates whether to establish a new pairing with this host. This is | 135 // Indicates whether to establish a new pairing with this host. This is |
140 // modified in ProvideSecret(), but thereafter to be used only from the | 136 // modified in ProvideSecret(), but thereafter to be used only from the |
(...skipping 14 matching lines...) Expand all Loading... |
155 scoped_refptr<net::URLRequestContextGetter> url_requester_; | 151 scoped_refptr<net::URLRequestContextGetter> url_requester_; |
156 | 152 |
157 friend class base::RefCountedThreadSafe<ClientInstance>; | 153 friend class base::RefCountedThreadSafe<ClientInstance>; |
158 | 154 |
159 DISALLOW_COPY_AND_ASSIGN(ClientInstance); | 155 DISALLOW_COPY_AND_ASSIGN(ClientInstance); |
160 }; | 156 }; |
161 | 157 |
162 } // namespace remoting | 158 } // namespace remoting |
163 | 159 |
164 #endif // REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ | 160 #endif // REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_ |
OLD | NEW |