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

Side by Side Diff: remoting/protocol/connection_to_host.h

Issue 10332304: Don't depend on MessageLoopProxy in remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/connection_to_client.cc ('k') | remoting/protocol/connection_to_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PROTOCOL_CONNECTION_TO_HOST_H_ 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/non_thread_safe.h"
13 #include "remoting/jingle_glue/signal_strategy.h" 14 #include "remoting/jingle_glue/signal_strategy.h"
14 #include "remoting/proto/internal.pb.h" 15 #include "remoting/proto/internal.pb.h"
15 #include "remoting/protocol/clipboard_filter.h" 16 #include "remoting/protocol/clipboard_filter.h"
16 #include "remoting/protocol/errors.h" 17 #include "remoting/protocol/errors.h"
17 #include "remoting/protocol/input_filter.h" 18 #include "remoting/protocol/input_filter.h"
18 #include "remoting/protocol/message_reader.h" 19 #include "remoting/protocol/message_reader.h"
19 #include "remoting/protocol/session.h" 20 #include "remoting/protocol/session.h"
20 #include "remoting/protocol/session_manager.h" 21 #include "remoting/protocol/session_manager.h"
21 22
22 namespace base {
23 class MessageLoopProxy;
24 } // namespace base
25
26 namespace pp { 23 namespace pp {
27 class Instance; 24 class Instance;
28 } // namespace pp 25 } // namespace pp
29 26
30 namespace remoting { 27 namespace remoting {
31 28
32 class XmppProxy; 29 class XmppProxy;
33 class VideoPacket; 30 class VideoPacket;
34 31
35 namespace protocol { 32 namespace protocol {
36 33
37 class Authenticator; 34 class Authenticator;
38 class ClientControlDispatcher; 35 class ClientControlDispatcher;
39 class ClientEventDispatcher; 36 class ClientEventDispatcher;
40 class ClientStub; 37 class ClientStub;
41 class ClipboardStub; 38 class ClipboardStub;
42 class HostStub; 39 class HostStub;
43 class InputStub; 40 class InputStub;
44 class SessionConfig; 41 class SessionConfig;
45 class TransportFactory; 42 class TransportFactory;
46 class VideoReader; 43 class VideoReader;
47 class VideoStub; 44 class VideoStub;
48 45
49 class ConnectionToHost : public SignalStrategy::Listener, 46 class ConnectionToHost : public SignalStrategy::Listener,
50 public SessionManager::Listener { 47 public SessionManager::Listener,
48 public base::NonThreadSafe {
51 public: 49 public:
52 enum State { 50 enum State {
53 CONNECTING, 51 CONNECTING,
54 CONNECTED, 52 CONNECTED,
55 FAILED, 53 FAILED,
56 CLOSED, 54 CLOSED,
57 }; 55 };
58 56
59 class HostEventCallback { 57 class HostEventCallback {
60 public: 58 public:
61 virtual ~HostEventCallback() {} 59 virtual ~HostEventCallback() {}
62 60
63 // Called when state of the connection changes. 61 // Called when state of the connection changes.
64 virtual void OnConnectionState(State state, ErrorCode error) = 0; 62 virtual void OnConnectionState(State state, ErrorCode error) = 0;
65 }; 63 };
66 64
67 ConnectionToHost(base::MessageLoopProxy* message_loop, 65 ConnectionToHost(bool allow_nat_traversal);
68 bool allow_nat_traversal);
69 virtual ~ConnectionToHost(); 66 virtual ~ConnectionToHost();
70 67
71 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, 68 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy,
72 const std::string& local_jid, 69 const std::string& local_jid,
73 const std::string& host_jid, 70 const std::string& host_jid,
74 const std::string& host_public_key, 71 const std::string& host_public_key,
75 scoped_ptr<TransportFactory> transport_factory, 72 scoped_ptr<TransportFactory> transport_factory,
76 scoped_ptr<Authenticator> authenticator, 73 scoped_ptr<Authenticator> authenticator,
77 HostEventCallback* event_callback, 74 HostEventCallback* event_callback,
78 ClientStub* client_stub, 75 ClientStub* client_stub,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Callback for |video_reader_|. 112 // Callback for |video_reader_|.
116 void OnVideoPacket(VideoPacket* packet); 113 void OnVideoPacket(VideoPacket* packet);
117 114
118 void CloseOnError(ErrorCode error); 115 void CloseOnError(ErrorCode error);
119 116
120 // Stops writing in the channels. 117 // Stops writing in the channels.
121 void CloseChannels(); 118 void CloseChannels();
122 119
123 void SetState(State state, ErrorCode error); 120 void SetState(State state, ErrorCode error);
124 121
125 scoped_refptr<base::MessageLoopProxy> message_loop_;
126 bool allow_nat_traversal_; 122 bool allow_nat_traversal_;
127 123
128 std::string host_jid_; 124 std::string host_jid_;
129 std::string host_public_key_; 125 std::string host_public_key_;
130 scoped_ptr<Authenticator> authenticator_; 126 scoped_ptr<Authenticator> authenticator_;
131 127
132 HostEventCallback* event_callback_; 128 HostEventCallback* event_callback_;
133 129
134 // Stub for incoming messages. 130 // Stub for incoming messages.
135 ClientStub* client_stub_; 131 ClientStub* client_stub_;
(...skipping 15 matching lines...) Expand all
151 ErrorCode error_; 147 ErrorCode error_;
152 148
153 private: 149 private:
154 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); 150 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost);
155 }; 151 };
156 152
157 } // namespace protocol 153 } // namespace protocol
158 } // namespace remoting 154 } // namespace remoting
159 155
160 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 156 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_client.cc ('k') | remoting/protocol/connection_to_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698