summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 05:42:58 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 05:42:58 +0000
commit204a9e3b84d001fe3619f14137a6ed4f3ac69b2f (patch)
tree2f9bee32d4ba68b24839ab97c6ca4ac9f550885c /remoting/client
parentf804b50923470e810fc57b95d66bb4e99c3de99b (diff)
downloadchromium_src-204a9e3b84d001fe3619f14137a6ed4f3ac69b2f.zip
chromium_src-204a9e3b84d001fe3619f14137a6ed4f3ac69b2f.tar.gz
chromium_src-204a9e3b84d001fe3619f14137a6ed4f3ac69b2f.tar.bz2
Cleanup error handling in the client plugin.
- Added new ErrorCode enum to pass error codes everywhere except between the webapp and the plugin. - Signaling timeout when connection now is interpreted as disconnect instead of error condition (see bug 112739). - Fixed webapp to properly handle unknown error codes. BUG=112739 Review URL: http://codereview.chromium.org/9567033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/chromoting_client.cc2
-rw-r--r--remoting/client/chromoting_client.h2
-rw-r--r--remoting/client/chromoting_view.h2
-rw-r--r--remoting/client/plugin/pepper_view.cc26
-rw-r--r--remoting/client/plugin/pepper_view.h2
5 files changed, 23 insertions, 11 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index 77be87e..521a875 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -166,7 +166,7 @@ void ChromotingClient::DispatchPacket() {
void ChromotingClient::OnConnectionState(
protocol::ConnectionToHost::State state,
- protocol::ConnectionToHost::Error error) {
+ protocol::ErrorCode error) {
DCHECK(message_loop()->BelongsToCurrentThread());
VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")";
if (state == protocol::ConnectionToHost::CONNECTED)
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index 50a432d..66b22de 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -52,7 +52,7 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
// ConnectionToHost::HostEventCallback implementation.
virtual void OnConnectionState(
protocol::ConnectionToHost::State state,
- protocol::ConnectionToHost::Error error) OVERRIDE;
+ protocol::ErrorCode error) OVERRIDE;
// VideoStub implementation.
virtual void ProcessVideoPacket(const VideoPacket* packet,
diff --git a/remoting/client/chromoting_view.h b/remoting/client/chromoting_view.h
index f9f0411..331e081 100644
--- a/remoting/client/chromoting_view.h
+++ b/remoting/client/chromoting_view.h
@@ -25,7 +25,7 @@ class ChromotingView {
// Record the update the state of the connection, updating the UI as needed.
virtual void SetConnectionState(protocol::ConnectionToHost::State state,
- protocol::ConnectionToHost::Error error) = 0;
+ protocol::ErrorCode error) = 0;
};
} // namespace remoting
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index 27ce1bc..6e1315e 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -31,18 +31,30 @@ namespace {
// The maximum number of image buffers to be allocated at any point of time.
const size_t kMaxPendingBuffersCount = 2;
+// TODO(sergeyu): Ideally we should just pass ErrorCode to the webapp
+// and let it handle it, but it would be hard to fix it now because
+// client plugin and webapp versions may not be in sync. It should be
+// easy to do after we are finished moving the client plugin to NaCl.
ChromotingInstance::ConnectionError ConvertConnectionError(
- protocol::ConnectionToHost::Error error) {
+ protocol::ErrorCode error) {
switch (error) {
- case protocol::ConnectionToHost::OK:
+ case protocol::OK:
return ChromotingInstance::ERROR_NONE;
- case protocol::ConnectionToHost::HOST_IS_OFFLINE:
+
+ case protocol::PEER_IS_OFFLINE:
return ChromotingInstance::ERROR_HOST_IS_OFFLINE;
- case protocol::ConnectionToHost::SESSION_REJECTED:
+
+ case protocol::SESSION_REJECTED:
+ case protocol::AUTHENTICATION_FAILED:
return ChromotingInstance::ERROR_SESSION_REJECTED;
- case protocol::ConnectionToHost::INCOMPATIBLE_PROTOCOL:
+
+ case protocol::INCOMPATIBLE_PROTOCOL:
return ChromotingInstance::ERROR_INCOMPATIBLE_PROTOCOL;
- case protocol::ConnectionToHost::NETWORK_FAILURE:
+
+ case protocol::CHANNEL_CONNECTION_ERROR:
+ case protocol::SIGNALING_ERROR:
+ case protocol::SIGNALING_TIMEOUT:
+ case protocol::UNKNOWN_ERROR:
return ChromotingInstance::ERROR_NETWORK_FAILURE;
}
DLOG(FATAL) << "Unknown error code" << error;
@@ -97,7 +109,7 @@ void PepperView::TearDown() {
}
void PepperView::SetConnectionState(protocol::ConnectionToHost::State state,
- protocol::ConnectionToHost::Error error) {
+ protocol::ErrorCode error) {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
switch (state) {
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
index 5bcef54..391c183 100644
--- a/remoting/client/plugin/pepper_view.h
+++ b/remoting/client/plugin/pepper_view.h
@@ -38,7 +38,7 @@ class PepperView : public ChromotingView,
virtual void TearDown() OVERRIDE;
virtual void SetConnectionState(
protocol::ConnectionToHost::State state,
- protocol::ConnectionToHost::Error error) OVERRIDE;
+ protocol::ErrorCode error) OVERRIDE;
// FrameConsumer implementation.
virtual void ApplyBuffer(const SkISize& view_size,