diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 00:43:13 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 00:43:13 +0000 |
commit | b7e8666561aef452da43f80556be37ae182e2744 (patch) | |
tree | 6c0f7568beb0ad061182a3d7192ae07799c370d6 /remoting/protocol/connection_to_host.h | |
parent | c7e1d4748e6b8fb34e9c2d59a9cc9ca4286d5c9c (diff) | |
download | chromium_src-b7e8666561aef452da43f80556be37ae182e2744.zip chromium_src-b7e8666561aef452da43f80556be37ae182e2744.tar.gz chromium_src-b7e8666561aef452da43f80556be37ae182e2744.tar.bz2 |
Expose connection error code to the web app.
BUG=91402
TEST=None
Review URL: http://codereview.chromium.org/8038054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/connection_to_host.h')
-rw-r--r-- | remoting/protocol/connection_to_host.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h index c8c1b44..fbf03e2 100644 --- a/remoting/protocol/connection_to_host.h +++ b/remoting/protocol/connection_to_host.h @@ -48,25 +48,27 @@ class ConnectionToHost : public SignalStrategy::StatusObserver, public SessionManager::Listener { public: enum State { - STATE_EMPTY, - STATE_CONNECTED, - STATE_AUTHENTICATED, - STATE_FAILED, - STATE_CLOSED, + CONNECTING, + CONNECTED, + AUTHENTICATED, + FAILED, + CLOSED, + }; + + enum Error { + OK, + HOST_IS_OFFLINE, + SESSION_REJECTED, + INCOMPATIBLE_PROTOCOL, + NETWORK_FAILURE, }; class HostEventCallback { public: virtual ~HostEventCallback() {} - // Called when the network connection is opened. - virtual void OnConnectionOpened(ConnectionToHost* conn) = 0; - - // Called when the network connection is closed. - virtual void OnConnectionClosed(ConnectionToHost* conn) = 0; - - // Called when the network connection has failed. - virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; + // Called when state of the connection changes. + virtual void OnConnectionState(State state, Error error) = 0; }; ConnectionToHost(base::MessageLoopProxy* message_loop, @@ -124,11 +126,13 @@ class ConnectionToHost : public SignalStrategy::StatusObserver, // Callback for |video_reader_|. void OnVideoPacket(VideoPacket* packet); - void CloseOnError(); + void CloseOnError(Error error); // Stops writing in the channels. void CloseChannels(); + void SetState(State state, Error error); + scoped_refptr<base::MessageLoopProxy> message_loop_; pp::Instance* pp_instance_; bool allow_nat_traversal_; @@ -158,6 +162,7 @@ class ConnectionToHost : public SignalStrategy::StatusObserver, // Internal state of the connection. State state_; + Error error_; // State of the channels. bool control_connected_; |