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

Unified Diff: google_apis/gaia/gaia_auth_fetcher.cc

Issue 203033002: Fix "unreachable code" warnings (MSVC warning 4702) in google_apis/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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 | « google_apis/drive/drive_api_parser.cc ('k') | google_apis/gaia/gaia_auth_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/gaia_auth_fetcher.cc
===================================================================
--- google_apis/gaia/gaia_auth_fetcher.cc (revision 256983)
+++ google_apis/gaia/gaia_auth_fetcher.cc (working copy)
@@ -114,21 +114,15 @@
// static
const char GaiaAuthFetcher::kAccountDeletedError[] = "AccountDeleted";
-const char GaiaAuthFetcher::kAccountDeletedErrorCode[] = "adel";
// static
const char GaiaAuthFetcher::kAccountDisabledError[] = "AccountDisabled";
-const char GaiaAuthFetcher::kAccountDisabledErrorCode[] = "adis";
// static
const char GaiaAuthFetcher::kBadAuthenticationError[] = "BadAuthentication";
-const char GaiaAuthFetcher::kBadAuthenticationErrorCode[] = "badauth";
// static
const char GaiaAuthFetcher::kCaptchaError[] = "CaptchaRequired";
-const char GaiaAuthFetcher::kCaptchaErrorCode[] = "cr";
// static
const char GaiaAuthFetcher::kServiceUnavailableError[] =
"ServiceUnavailable";
-const char GaiaAuthFetcher::kServiceUnavailableErrorCode[] =
- "ire";
// static
const char GaiaAuthFetcher::kErrorParam[] = "Error";
// static
@@ -693,102 +687,42 @@
if (!status.is_success()) {
if (status.status() == net::URLRequestStatus::CANCELED) {
return GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
- } else {
- DLOG(WARNING) << "Could not reach Google Accounts servers: errno "
- << status.error();
- return GoogleServiceAuthError::FromConnectionError(status.error());
}
- } else {
- if (IsSecondFactorSuccess(data)) {
- return GoogleServiceAuthError(GoogleServiceAuthError::TWO_FACTOR);
- }
+ DLOG(WARNING) << "Could not reach Google Accounts servers: errno "
+ << status.error();
+ return GoogleServiceAuthError::FromConnectionError(status.error());
+ }
- std::string error;
- std::string url;
- std::string captcha_url;
- std::string captcha_token;
- ParseClientLoginFailure(data, &error, &url, &captcha_url, &captcha_token);
- DLOG(WARNING) << "ClientLogin failed with " << error;
+ if (IsSecondFactorSuccess(data))
+ return GoogleServiceAuthError(GoogleServiceAuthError::TWO_FACTOR);
- if (error == kCaptchaError) {
- GURL image_url(
- GaiaUrls::GetInstance()->captcha_base_url().Resolve(captcha_url));
- GURL unlock_url(url);
- return GoogleServiceAuthError::FromClientLoginCaptchaChallenge(
- captcha_token, image_url, unlock_url);
- }
- if (error == kAccountDeletedError)
- return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DELETED);
- if (error == kAccountDisabledError)
- return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DISABLED);
- if (error == kBadAuthenticationError) {
- return GoogleServiceAuthError(
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
- }
- if (error == kServiceUnavailableError) {
- return GoogleServiceAuthError(
- GoogleServiceAuthError::SERVICE_UNAVAILABLE);
- }
+ std::string error;
+ std::string url;
+ std::string captcha_url;
+ std::string captcha_token;
+ ParseClientLoginFailure(data, &error, &url, &captcha_url, &captcha_token);
+ DLOG(WARNING) << "ClientLogin failed with " << error;
- DLOG(WARNING) << "Incomprehensible response from Google Accounts servers.";
+ if (error == kCaptchaError) {
+ return GoogleServiceAuthError::FromClientLoginCaptchaChallenge(
+ captcha_token,
+ GURL(GaiaUrls::GetInstance()->captcha_base_url().Resolve(captcha_url)),
+ GURL(url));
+ }
+ if (error == kAccountDeletedError)
+ return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DELETED);
+ if (error == kAccountDisabledError)
+ return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DISABLED);
+ if (error == kBadAuthenticationError) {
return GoogleServiceAuthError(
- GoogleServiceAuthError::SERVICE_UNAVAILABLE);
+ GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
}
-
- NOTREACHED();
- return GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE);
-}
-
-// static
-GoogleServiceAuthError GaiaAuthFetcher::GenerateOAuthLoginError(
- const std::string& data,
- const net::URLRequestStatus& status) {
- if (!status.is_success()) {
- if (status.status() == net::URLRequestStatus::CANCELED) {
- return GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
- } else {
- DLOG(WARNING) << "Could not reach Google Accounts servers: errno "
- << status.error();
- return GoogleServiceAuthError::FromConnectionError(status.error());
- }
- } else {
- if (IsSecondFactorSuccess(data)) {
- return GoogleServiceAuthError(GoogleServiceAuthError::TWO_FACTOR);
- }
-
- std::string error;
- std::string url;
- std::string captcha_url;
- std::string captcha_token;
- ParseClientLoginFailure(data, &error, &url, &captcha_url, &captcha_token);
- LOG(WARNING) << "OAuthLogin failed with " << error;
-
- if (error == kCaptchaErrorCode) {
- GURL image_url(
- GaiaUrls::GetInstance()->captcha_base_url().Resolve(captcha_url));
- GURL unlock_url(url);
- return GoogleServiceAuthError::FromClientLoginCaptchaChallenge(
- captcha_token, image_url, unlock_url);
- }
- if (error == kAccountDeletedErrorCode)
- return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DELETED);
- if (error == kAccountDisabledErrorCode)
- return GoogleServiceAuthError(GoogleServiceAuthError::ACCOUNT_DISABLED);
- if (error == kBadAuthenticationErrorCode) {
- return GoogleServiceAuthError(
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
- }
- if (error == kServiceUnavailableErrorCode) {
- return GoogleServiceAuthError(
- GoogleServiceAuthError::SERVICE_UNAVAILABLE);
- }
-
- DLOG(WARNING) << "Incomprehensible response from Google Accounts servers.";
+ if (error == kServiceUnavailableError) {
return GoogleServiceAuthError(
GoogleServiceAuthError::SERVICE_UNAVAILABLE);
}
- NOTREACHED();
+ DLOG(WARNING) << "Incomprehensible response from Google Accounts servers.";
return GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE);
}
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | google_apis/gaia/gaia_auth_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698