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

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

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « google_apis/gaia/gaia_oauth_client.cc ('k') | google_apis/gaia/oauth2_access_token_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 default: 128 default:
129 NOTREACHED(); 129 NOTREACHED();
130 } 130 }
131 return EmptyString(); 131 return EmptyString();
132 } 132 }
133 133
134 const std::string& GoogleServiceAuthError::error_message() const { 134 const std::string& GoogleServiceAuthError::error_message() const {
135 return error_message_; 135 return error_message_;
136 } 136 }
137 137
138 DictionaryValue* GoogleServiceAuthError::ToValue() const { 138 base::DictionaryValue* GoogleServiceAuthError::ToValue() const {
139 DictionaryValue* value = new DictionaryValue(); 139 base::DictionaryValue* value = new base::DictionaryValue();
140 std::string state_str; 140 std::string state_str;
141 switch (state_) { 141 switch (state_) {
142 #define STATE_CASE(x) case x: state_str = #x; break 142 #define STATE_CASE(x) case x: state_str = #x; break
143 STATE_CASE(NONE); 143 STATE_CASE(NONE);
144 STATE_CASE(INVALID_GAIA_CREDENTIALS); 144 STATE_CASE(INVALID_GAIA_CREDENTIALS);
145 STATE_CASE(USER_NOT_SIGNED_UP); 145 STATE_CASE(USER_NOT_SIGNED_UP);
146 STATE_CASE(CONNECTION_FAILED); 146 STATE_CASE(CONNECTION_FAILED);
147 STATE_CASE(CAPTCHA_REQUIRED); 147 STATE_CASE(CAPTCHA_REQUIRED);
148 STATE_CASE(ACCOUNT_DELETED); 148 STATE_CASE(ACCOUNT_DELETED);
149 STATE_CASE(ACCOUNT_DISABLED); 149 STATE_CASE(ACCOUNT_DISABLED);
150 STATE_CASE(SERVICE_UNAVAILABLE); 150 STATE_CASE(SERVICE_UNAVAILABLE);
151 STATE_CASE(TWO_FACTOR); 151 STATE_CASE(TWO_FACTOR);
152 STATE_CASE(REQUEST_CANCELED); 152 STATE_CASE(REQUEST_CANCELED);
153 STATE_CASE(HOSTED_NOT_ALLOWED); 153 STATE_CASE(HOSTED_NOT_ALLOWED);
154 #undef STATE_CASE 154 #undef STATE_CASE
155 default: 155 default:
156 NOTREACHED(); 156 NOTREACHED();
157 break; 157 break;
158 } 158 }
159 value->SetString("state", state_str); 159 value->SetString("state", state_str);
160 if (state_ == CAPTCHA_REQUIRED) { 160 if (state_ == CAPTCHA_REQUIRED) {
161 DictionaryValue* captcha_value = new DictionaryValue(); 161 base::DictionaryValue* captcha_value = new base::DictionaryValue();
162 value->Set("captcha", captcha_value); 162 value->Set("captcha", captcha_value);
163 captcha_value->SetString("token", captcha_.token); 163 captcha_value->SetString("token", captcha_.token);
164 captcha_value->SetString("audioUrl", captcha_.audio_url.spec()); 164 captcha_value->SetString("audioUrl", captcha_.audio_url.spec());
165 captcha_value->SetString("imageUrl", captcha_.image_url.spec()); 165 captcha_value->SetString("imageUrl", captcha_.image_url.spec());
166 captcha_value->SetString("unlockUrl", captcha_.unlock_url.spec()); 166 captcha_value->SetString("unlockUrl", captcha_.unlock_url.spec());
167 captcha_value->SetInteger("imageWidth", captcha_.image_width); 167 captcha_value->SetInteger("imageWidth", captcha_.image_width);
168 captcha_value->SetInteger("imageHeight", captcha_.image_height); 168 captcha_value->SetInteger("imageHeight", captcha_.image_height);
169 } else if (state_ == CONNECTION_FAILED) { 169 } else if (state_ == CONNECTION_FAILED) {
170 value->SetString("networkError", net::ErrorToString(network_error_)); 170 value->SetString("networkError", net::ErrorToString(network_error_));
171 } else if (state_ == TWO_FACTOR) { 171 } else if (state_ == TWO_FACTOR) {
172 DictionaryValue* two_factor_value = new DictionaryValue(); 172 base::DictionaryValue* two_factor_value = new base::DictionaryValue();
173 value->Set("two_factor", two_factor_value); 173 value->Set("two_factor", two_factor_value);
174 two_factor_value->SetString("token", second_factor_.token); 174 two_factor_value->SetString("token", second_factor_.token);
175 two_factor_value->SetString("promptText", second_factor_.prompt_text); 175 two_factor_value->SetString("promptText", second_factor_.prompt_text);
176 two_factor_value->SetString("alternateText", second_factor_.alternate_text); 176 two_factor_value->SetString("alternateText", second_factor_.alternate_text);
177 two_factor_value->SetInteger("fieldLength", second_factor_.field_length); 177 two_factor_value->SetInteger("fieldLength", second_factor_.field_length);
178 } 178 }
179 return value; 179 return value;
180 } 180 }
181 181
182 std::string GoogleServiceAuthError::ToString() const { 182 std::string GoogleServiceAuthError::ToString() const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 GoogleServiceAuthError::GoogleServiceAuthError( 233 GoogleServiceAuthError::GoogleServiceAuthError(
234 State s, 234 State s,
235 const std::string& captcha_token, 235 const std::string& captcha_token,
236 const std::string& prompt_text, 236 const std::string& prompt_text,
237 const std::string& alternate_text, 237 const std::string& alternate_text,
238 int field_length) 238 int field_length)
239 : state_(s), 239 : state_(s),
240 second_factor_(captcha_token, prompt_text, alternate_text, field_length), 240 second_factor_(captcha_token, prompt_text, alternate_text, field_length),
241 network_error_(0) { 241 network_error_(0) {
242 } 242 }
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_oauth_client.cc ('k') | google_apis/gaia/oauth2_access_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698