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

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

Issue 10692179: Propagate connection state from networking layer to UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/client/plugin/chromoting_instance.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 <set>
8 #include <string> 9 #include <string>
9 10
10 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
14 #include "remoting/jingle_glue/signal_strategy.h" 15 #include "remoting/jingle_glue/signal_strategy.h"
15 #include "remoting/proto/internal.pb.h" 16 #include "remoting/proto/internal.pb.h"
16 #include "remoting/protocol/clipboard_filter.h" 17 #include "remoting/protocol/clipboard_filter.h"
17 #include "remoting/protocol/errors.h" 18 #include "remoting/protocol/errors.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 FAILED, 58 FAILED,
58 CLOSED, 59 CLOSED,
59 }; 60 };
60 61
61 class HostEventCallback { 62 class HostEventCallback {
62 public: 63 public:
63 virtual ~HostEventCallback() {} 64 virtual ~HostEventCallback() {}
64 65
65 // Called when state of the connection changes. 66 // Called when state of the connection changes.
66 virtual void OnConnectionState(State state, ErrorCode error) = 0; 67 virtual void OnConnectionState(State state, ErrorCode error) = 0;
68
69 // Called when ready state of the connection changes. When |ready|
70 // is set to false some data sent by the peers may be
71 // delayed. This is used to indicate in the UI when connection is
72 // temporarily broken.
73 virtual void OnConnectionReady(bool ready) = 0;
67 }; 74 };
68 75
69 ConnectionToHost(bool allow_nat_traversal); 76 ConnectionToHost(bool allow_nat_traversal);
70 virtual ~ConnectionToHost(); 77 virtual ~ConnectionToHost();
71 78
72 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, 79 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy,
73 const std::string& local_jid, 80 const std::string& local_jid,
74 const std::string& host_jid, 81 const std::string& host_jid,
75 const std::string& host_public_key, 82 const std::string& host_public_key,
76 scoped_ptr<TransportFactory> transport_factory, 83 scoped_ptr<TransportFactory> transport_factory,
(...skipping 20 matching lines...) Expand all
97 // SessionManager::Listener interface. 104 // SessionManager::Listener interface.
98 virtual void OnSessionManagerReady() OVERRIDE; 105 virtual void OnSessionManagerReady() OVERRIDE;
99 virtual void OnIncomingSession( 106 virtual void OnIncomingSession(
100 Session* session, 107 Session* session,
101 SessionManager::IncomingSessionResponse* response) OVERRIDE; 108 SessionManager::IncomingSessionResponse* response) OVERRIDE;
102 109
103 // Session::EventHandler interface. 110 // Session::EventHandler interface.
104 virtual void OnSessionStateChange(Session::State state) OVERRIDE; 111 virtual void OnSessionStateChange(Session::State state) OVERRIDE;
105 virtual void OnSessionRouteChange(const std::string& channel_name, 112 virtual void OnSessionRouteChange(const std::string& channel_name,
106 const TransportRoute& route) OVERRIDE; 113 const TransportRoute& route) OVERRIDE;
114 virtual void OnSessionChannelReady(const std::string& channel_name,
115 bool ready) OVERRIDE;
107 116
108 // Return the current state of ConnectionToHost. 117 // Return the current state of ConnectionToHost.
109 State state() const; 118 State state() const;
110 119
111 private: 120 private:
112 // Callbacks for channel initialization 121 // Callbacks for channel initialization
113 void OnChannelInitialized(bool successful); 122 void OnChannelInitialized(bool successful);
114 123
115 void NotifyIfChannelsReady(); 124 void NotifyIfChannelsReady();
116 125
(...skipping 26 matching lines...) Expand all
143 scoped_ptr<AudioReader> audio_reader_; 152 scoped_ptr<AudioReader> audio_reader_;
144 scoped_ptr<ClientControlDispatcher> control_dispatcher_; 153 scoped_ptr<ClientControlDispatcher> control_dispatcher_;
145 scoped_ptr<ClientEventDispatcher> event_dispatcher_; 154 scoped_ptr<ClientEventDispatcher> event_dispatcher_;
146 ClipboardFilter clipboard_forwarder_; 155 ClipboardFilter clipboard_forwarder_;
147 InputFilter event_forwarder_; 156 InputFilter event_forwarder_;
148 157
149 // Internal state of the connection. 158 // Internal state of the connection.
150 State state_; 159 State state_;
151 ErrorCode error_; 160 ErrorCode error_;
152 161
162 // List of channels that are not currently ready.
163 std::set<std::string> not_ready_channels_;
164
153 private: 165 private:
154 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); 166 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost);
155 }; 167 };
156 168
157 } // namespace protocol 169 } // namespace protocol
158 } // namespace remoting 170 } // namespace remoting
159 171
160 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 172 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/protocol/connection_to_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698