OLD | NEW |
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 "chrome/browser/net/gaia/gaia_oauth_fetcher.h" | 5 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 // Helper method that extracts tokens from a successful reply. | 239 // Helper method that extracts tokens from a successful reply. |
240 // static | 240 // static |
241 void GaiaOAuthFetcher::ParseUserInfoResponse(const std::string& data, | 241 void GaiaOAuthFetcher::ParseUserInfoResponse(const std::string& data, |
242 std::string* email_result) { | 242 std::string* email_result) { |
243 scoped_ptr<base::Value> value(base::JSONReader::Read(data)); | 243 scoped_ptr<base::Value> value(base::JSONReader::Read(data)); |
244 if (value->GetType() == base::Value::TYPE_DICTIONARY) { | 244 if (value->GetType() == base::Value::TYPE_DICTIONARY) { |
245 Value* email_value; | 245 base::Value* email_value; |
246 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); | 246 base::DictionaryValue* dict = |
| 247 static_cast<base::DictionaryValue*>(value.get()); |
247 if (dict->Get("email", &email_value)) { | 248 if (dict->Get("email", &email_value)) { |
248 if (email_value->GetType() == base::Value::TYPE_STRING) { | 249 if (email_value->GetType() == base::Value::TYPE_STRING) { |
249 email_value->GetAsString(email_result); | 250 email_value->GetAsString(email_result); |
250 } | 251 } |
251 } | 252 } |
252 } | 253 } |
253 } | 254 } |
254 | 255 |
255 void GaiaOAuthFetcher::StartOAuthLogin( | 256 void GaiaOAuthFetcher::StartOAuthLogin( |
256 const char* source, | 257 const char* source, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 break; | 556 break; |
556 case OAUTH2_REVOKE_TOKEN: | 557 case OAUTH2_REVOKE_TOKEN: |
557 OnOAuthRevokeTokenFetched(data, status, response_code); | 558 OnOAuthRevokeTokenFetched(data, status, response_code); |
558 break; | 559 break; |
559 } | 560 } |
560 } | 561 } |
561 | 562 |
562 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) { | 563 bool GaiaOAuthFetcher::ShouldAutoFetch(RequestType fetch_step) { |
563 return fetch_step <= auto_fetch_limit_; | 564 return fetch_step <= auto_fetch_limit_; |
564 } | 565 } |
OLD | NEW |