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

Unified Diff: remoting/protocol/validating_authenticator.cc

Issue 2308133002: Addressing feedback from ValidatingAuthenticator CL (Closed)
Patch Set: Fixing a gt cl formatting issue Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/validating_authenticator.cc
diff --git a/remoting/protocol/validating_authenticator.cc b/remoting/protocol/validating_authenticator.cc
index d3da78d12427b741dfdc5359bbb02aebd98ee93c..0546c3d4b144b160e1db6590b9e8a8f6e8e35418 100644
--- a/remoting/protocol/validating_authenticator.cc
+++ b/remoting/protocol/validating_authenticator.cc
@@ -91,18 +91,16 @@ void ValidatingAuthenticator::OnValidateComplete(
const buzz::XmlElement* message,
const base::Closure& resume_callback,
Result validation_result) {
- if (validation_result == Result::SUCCESS) {
- current_authenticator_->ProcessMessage(
- message, base::Bind(&ValidatingAuthenticator::UpdateState,
- weak_factory_.GetWeakPtr(), resume_callback));
- return;
- }
-
- // |validation_result| represents a rejected state so map the result to a
- // rejection reason and call the callback to let the caller know the result.
- state_ = Authenticator::REJECTED;
-
+ // Process the original message in the success case, otherwise map
+ // |rejection_reason_| to a known reason, set |state_| to REJECTED and notify
+ // the listener of the connection error via the callback.
switch (validation_result) {
+ case Result::SUCCESS:
+ current_authenticator_->ProcessMessage(
+ message, base::Bind(&ValidatingAuthenticator::UpdateState,
+ weak_factory_.GetWeakPtr(), resume_callback));
+ return;
+
case Result::ERROR_INVALID_CREDENTIALS:
rejection_reason_ = Authenticator::INVALID_CREDENTIALS;
break;
@@ -115,12 +113,11 @@ void ValidatingAuthenticator::OnValidateComplete(
rejection_reason_ = Authenticator::REJECTED_BY_USER;
break;
- default:
- // Log an error and fail to prevent logging a misleading error value.
- CHECK(false) << "Unknown validation result value: "
- << static_cast<unsigned int>(validation_result);
+ // No default statement exists as we want the compiler to error out if a
Sergey Ulanov 2016/09/02 23:13:39 Don't really need this comment - we don't have sim
+ // new value is added to the enum but not added here.
}
+ state_ = Authenticator::REJECTED;
resume_callback.Run();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698