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

Unified Diff: remoting/protocol/pepper_session.cc

Issue 8046018: Parse termination reason and propagate the error to the Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/pepper_session.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pepper_session.cc
diff --git a/remoting/protocol/pepper_session.cc b/remoting/protocol/pepper_session.cc
index e7cdf1596662c700b44c9dc45c3b4f10b2191813..509440e779827986c6617d60190c83e296383b71 100644
--- a/remoting/protocol/pepper_session.cc
+++ b/remoting/protocol/pepper_session.cc
@@ -34,7 +34,7 @@ const int kTransportInfoSendDelayMs = 2;
PepperSession::PepperSession(PepperSessionManager* session_manager)
: session_manager_(session_manager),
state_(INITIALIZING),
- error_(ERROR_NO_ERROR) {
+ error_(OK) {
}
PepperSession::~PepperSession() {
@@ -44,14 +44,14 @@ PepperSession::~PepperSession() {
session_manager_->SessionDestroyed(this);
}
-PepperSession::Error PepperSession::error() {
+void PepperSession::SetStateChangeCallback(StateChangeCallback* callback) {
DCHECK(CalledOnValidThread());
- return error_;
+ state_change_callback_.reset(callback);
}
-void PepperSession::SetStateChangeCallback(StateChangeCallback* callback) {
+Session::Error PepperSession::error() {
DCHECK(CalledOnValidThread());
- state_change_callback_.reset(callback);
+ return error_;
}
void PepperSession::StartConnection(
@@ -98,7 +98,7 @@ void PepperSession::OnSessionInitiateResponse(
// TODO(sergeyu): There may be different reasons for error
// here. Parse the response stanza to find failure reason.
- OnError(ERROR_PEER_IS_OFFLINE);
+ OnError(PEER_IS_OFFLINE);
}
}
@@ -239,7 +239,7 @@ void PepperSession::OnAccept(const JingleMessage& message,
}
if (!InitializeConfigFromDescription(message.description.get())) {
- OnError(ERROR_INCOMPATIBLE_PROTOCOL);
+ OnError(INCOMPATIBLE_PROTOCOL);
return;
}
@@ -266,7 +266,20 @@ void PepperSession::ProcessTransportInfo(const JingleMessage& message) {
void PepperSession::OnTerminate(const JingleMessage& message,
JingleMessageReply* reply) {
if (state_ == CONNECTING) {
- OnError(ERROR_SESSION_REJECTED);
+ switch (message.reason) {
+ case JingleMessage::DECLINE:
+ OnError(SESSION_REJECTED);
+ break;
+
+ case JingleMessage::INCOMPATIBLE_PARAMETERS:
+ OnError(INCOMPATIBLE_PROTOCOL);
+ break;
+
+ default:
+ LOG(WARNING) << "Received session-terminate message "
+ "with an unexpected reason.";
+ OnError(SESSION_REJECTED);
+ }
return;
}
@@ -337,7 +350,7 @@ void PepperSession::OnChannelConnected(
if (!socket) {
LOG(ERROR) << "Failed to connect control or events channel. "
<< "Terminating connection";
- OnError(ERROR_CHANNEL_CONNECTION_FAILURE);
+ OnError(CHANNEL_CONNECTION_ERROR);
return;
}
« no previous file with comments | « remoting/protocol/pepper_session.h ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698