| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  257       if (OAuthRequestSigner::Decode(i->second, &decoded)) |  257       if (OAuthRequestSigner::Decode(i->second, &decoded)) | 
|  258         expires_in->assign(decoded); |  258         expires_in->assign(decoded); | 
|  259     } |  259     } | 
|  260   } |  260   } | 
|  261 } |  261 } | 
|  262  |  262  | 
|  263 // Helper method that extracts tokens from a successful reply. |  263 // Helper method that extracts tokens from a successful reply. | 
|  264 // static |  264 // static | 
|  265 void GaiaOAuthFetcher::ParseUserInfoResponse(const std::string& data, |  265 void GaiaOAuthFetcher::ParseUserInfoResponse(const std::string& data, | 
|  266                                              std::string* email_result) { |  266                                              std::string* email_result) { | 
|  267   base::JSONReader reader; |  267   scoped_ptr<base::Value> value(base::JSONReader::Read(data)); | 
|  268   scoped_ptr<base::Value> value(reader.Read(data, false)); |  | 
|  269   if (value->GetType() == base::Value::TYPE_DICTIONARY) { |  268   if (value->GetType() == base::Value::TYPE_DICTIONARY) { | 
|  270     Value* email_value; |  269     Value* email_value; | 
|  271     DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); |  270     DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); | 
|  272     if (dict->Get("email", &email_value)) { |  271     if (dict->Get("email", &email_value)) { | 
|  273       if (email_value->GetType() == base::Value::TYPE_STRING) { |  272       if (email_value->GetType() == base::Value::TYPE_STRING) { | 
|  274         StringValue* email = static_cast<StringValue*>(email_value); |  273         StringValue* email = static_cast<StringValue*>(email_value); | 
|  275         email->GetAsString(email_result); |  274         email->GetAsString(email_result); | 
|  276       } |  275       } | 
|  277     } |  276     } | 
|  278   } |  277   } | 
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  686                              true)) { |  685                              true)) { | 
|  687     OnOAuthRevokeTokenFetched(data, status, response_code); |  686     OnOAuthRevokeTokenFetched(data, status, response_code); | 
|  688   } else { |  687   } else { | 
|  689     NOTREACHED(); |  688     NOTREACHED(); | 
|  690   } |  689   } | 
|  691 } |  690 } | 
|  692  |  691  | 
|  693 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { |  692 bool GaiaOAuthFetcher::ShouldAutoFetch(AutoFetchLimit fetch_step) { | 
|  694   return fetch_step <= auto_fetch_limit_; |  693   return fetch_step <= auto_fetch_limit_; | 
|  695 } |  694 } | 
| OLD | NEW |