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

Side by Side Diff: google_apis/gaia/google_service_auth_error.cc

Issue 14169010: Remove support for ClientOAuth from GaiaAuthFetcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_apis/gaia/google_service_auth_error.h" 5 #include "google_apis/gaia/google_service_auth_error.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // static 90 // static
91 GoogleServiceAuthError GoogleServiceAuthError::FromClientLoginCaptchaChallenge( 91 GoogleServiceAuthError GoogleServiceAuthError::FromClientLoginCaptchaChallenge(
92 const std::string& captcha_token, 92 const std::string& captcha_token,
93 const GURL& captcha_image_url, 93 const GURL& captcha_image_url,
94 const GURL& captcha_unlock_url) { 94 const GURL& captcha_unlock_url) {
95 return GoogleServiceAuthError(CAPTCHA_REQUIRED, captcha_token, GURL(), 95 return GoogleServiceAuthError(CAPTCHA_REQUIRED, captcha_token, GURL(),
96 captcha_image_url, captcha_unlock_url, 0, 0); 96 captcha_image_url, captcha_unlock_url, 0, 0);
97 } 97 }
98 98
99 // static
100 GoogleServiceAuthError GoogleServiceAuthError::FromCaptchaChallenge(
101 const std::string& captcha_token,
102 const GURL& captcha_audio_url,
103 const GURL& captcha_image_url,
104 int image_width,
105 int image_height) {
106 return GoogleServiceAuthError(CAPTCHA_REQUIRED, captcha_token,
107 captcha_audio_url, captcha_image_url,
108 GURL(), image_width, image_height);
109 }
110
111 // static
112 GoogleServiceAuthError GoogleServiceAuthError::FromSecondFactorChallenge(
113 const std::string& captcha_token,
114 const std::string& prompt_text,
115 const std::string& alternate_text,
116 int field_length) {
117 return GoogleServiceAuthError(TWO_FACTOR, captcha_token, prompt_text,
118 alternate_text, field_length);
119 }
120
121 // static
122 GoogleServiceAuthError GoogleServiceAuthError::FromClientOAuthError(
123 const std::string& data) {
124 scoped_ptr<base::Value> value(base::JSONReader::Read(data));
125 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
126 return GoogleServiceAuthError(CONNECTION_FAILED, 0);
127
128 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
129
130 std::string cause;
131 if (!dict->GetStringWithoutPathExpansion("cause", &cause))
132 return GoogleServiceAuthError(CONNECTION_FAILED, 0);
133
134 // The explanation field is optional.
135 std::string explanation;
136 if (!dict->GetStringWithoutPathExpansion("explanation", &explanation))
137 explanation.clear();
138
139 return GoogleServiceAuthError(explanation);
140 }
141
142 GoogleServiceAuthError GoogleServiceAuthError::AuthErrorNone() { 99 GoogleServiceAuthError GoogleServiceAuthError::AuthErrorNone() {
143 return GoogleServiceAuthError(NONE); 100 return GoogleServiceAuthError(NONE);
144 } 101 }
145 102
146 GoogleServiceAuthError::State GoogleServiceAuthError::state() const { 103 GoogleServiceAuthError::State GoogleServiceAuthError::state() const {
147 return state_; 104 return state_;
148 } 105 }
149 106
150 const GoogleServiceAuthError::Captcha& GoogleServiceAuthError::captcha() const { 107 const GoogleServiceAuthError::Captcha& GoogleServiceAuthError::captcha() const {
151 return captcha_; 108 return captcha_;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 GoogleServiceAuthError::GoogleServiceAuthError( 233 GoogleServiceAuthError::GoogleServiceAuthError(
277 State s, 234 State s,
278 const std::string& captcha_token, 235 const std::string& captcha_token,
279 const std::string& prompt_text, 236 const std::string& prompt_text,
280 const std::string& alternate_text, 237 const std::string& alternate_text,
281 int field_length) 238 int field_length)
282 : state_(s), 239 : state_(s),
283 second_factor_(captcha_token, prompt_text, alternate_text, field_length), 240 second_factor_(captcha_token, prompt_text, alternate_text, field_length),
284 network_error_(0) { 241 network_error_(0) {
285 } 242 }
OLDNEW
« no previous file with comments | « google_apis/gaia/google_service_auth_error.h ('k') | google_apis/gaia/google_service_auth_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698