OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/user_image_downloader.h" | 5 #include "chrome/browser/chromeos/login/user_image_downloader.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 profile_fetcher_->set_request_context( | 50 profile_fetcher_->set_request_context( |
51 ProfileManager::GetDefaultProfile()->GetRequestContext()); | 51 ProfileManager::GetDefaultProfile()->GetRequestContext()); |
52 profile_fetcher_->set_extra_request_headers( | 52 profile_fetcher_->set_extra_request_headers( |
53 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); | 53 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); |
54 profile_fetcher_->Start(); | 54 profile_fetcher_->Start(); |
55 } | 55 } |
56 | 56 |
57 UserImageDownloader::~UserImageDownloader() { | 57 UserImageDownloader::~UserImageDownloader() { |
58 } | 58 } |
59 | 59 |
60 void UserImageDownloader::OnURLFetchComplete(const URLFetcher* source, | 60 void UserImageDownloader::OnURLFetchComplete( |
61 const GURL& url, | 61 const URLFetcher* source, |
62 const URLRequestStatus& status, | 62 const GURL& url, |
63 int response_code, | 63 const net::URLRequestStatus& status, |
64 const ResponseCookies& cookies, | 64 int response_code, |
65 const std::string& data) { | 65 const ResponseCookies& cookies, |
| 66 const std::string& data) { |
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
67 if (response_code != 200) { | 68 if (response_code != 200) { |
68 LOG(ERROR) << "Response code is " << response_code; | 69 LOG(ERROR) << "Response code is " << response_code; |
69 LOG(ERROR) << "Url is " << url.spec(); | 70 LOG(ERROR) << "Url is " << url.spec(); |
70 LOG(ERROR) << "Data is " << data; | 71 LOG(ERROR) << "Data is " << data; |
71 return; | 72 return; |
72 } | 73 } |
73 | 74 |
74 if (source == profile_fetcher_.get()) { | 75 if (source == profile_fetcher_.get()) { |
75 GURL image_url; | 76 GURL image_url; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 if (!link_dictionary->GetStringASCII("href", &url)) | 184 if (!link_dictionary->GetStringASCII("href", &url)) |
184 continue; | 185 continue; |
185 | 186 |
186 *image_url = GURL(url); | 187 *image_url = GURL(url); |
187 return true; | 188 return true; |
188 } | 189 } |
189 return false; | 190 return false; |
190 } | 191 } |
191 | 192 |
192 } // namespace chromeos | 193 } // namespace chromeos |
OLD | NEW |