| 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/profiles/profile_downloader.h" | 5 #include "chrome/browser/profiles/profile_downloader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 std::string* url, | 132 std::string* url, |
| 133 int image_size) { | 133 int image_size) { |
| 134 DCHECK(nick_name); | 134 DCHECK(nick_name); |
| 135 DCHECK(url); | 135 DCHECK(url); |
| 136 *nick_name = string16(); | 136 *nick_name = string16(); |
| 137 *url = std::string(); | 137 *url = std::string(); |
| 138 | 138 |
| 139 int error_code = -1; | 139 int error_code = -1; |
| 140 std::string error_message; | 140 std::string error_message; |
| 141 scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError( | 141 scoped_ptr<base::Value> root_value(base::JSONReader::ReadAndReturnError( |
| 142 data, false, &error_code, &error_message)); | 142 data, base::JSON_PARSE_RFC, &error_code, &error_message)); |
| 143 if (!root_value.get()) { | 143 if (!root_value.get()) { |
| 144 LOG(ERROR) << "Error while parsing user entry response: " | 144 LOG(ERROR) << "Error while parsing user entry response: " |
| 145 << error_message; | 145 << error_message; |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 if (!root_value->IsType(base::Value::TYPE_DICTIONARY)) { | 148 if (!root_value->IsType(base::Value::TYPE_DICTIONARY)) { |
| 149 LOG(ERROR) << "JSON root is not a dictionary: " | 149 LOG(ERROR) << "JSON root is not a dictionary: " |
| 150 << root_value->GetType(); | 150 << root_value->GetType(); |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { | 375 void ProfileDownloader::OnGetTokenSuccess(const std::string& access_token) { |
| 376 auth_token_ = access_token; | 376 auth_token_ = access_token; |
| 377 StartFetchingImage(); | 377 StartFetchingImage(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 // Callback for OAuth2AccessTokenFetcher on failure. | 380 // Callback for OAuth2AccessTokenFetcher on failure. |
| 381 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { | 381 void ProfileDownloader::OnGetTokenFailure(const GoogleServiceAuthError& error) { |
| 382 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; | 382 LOG(WARNING) << "ProfileDownloader: token request using refresh token failed"; |
| 383 delegate_->OnDownloadComplete(this, false); | 383 delegate_->OnDownloadComplete(this, false); |
| 384 } | 384 } |
| OLD | NEW |