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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 LOG(ERROR) << "Data is " << data; | 71 LOG(ERROR) << "Data is " << data; |
72 return; | 72 return; |
73 } | 73 } |
74 | 74 |
75 if (source == profile_fetcher_.get()) { | 75 if (source == profile_fetcher_.get()) { |
76 GURL image_url; | 76 GURL image_url; |
77 if (!GetImageURL(data, &image_url)) { | 77 if (!GetImageURL(data, &image_url)) { |
78 LOG(ERROR) << "Didn't find image url in " << data; | 78 LOG(ERROR) << "Didn't find image url in " << data; |
79 return; | 79 return; |
80 } | 80 } |
81 LOG(INFO) << "Sending request to " << image_url; | 81 VLOG(1) << "Sending request to " << image_url; |
82 new ImageDownloader(this, GURL(image_url), auth_token_); | 82 new ImageDownloader(this, GURL(image_url), auth_token_); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void UserImageDownloader::OnImageDecoded(const SkBitmap& decoded_image) { | 86 void UserImageDownloader::OnImageDecoded(const SkBitmap& decoded_image) { |
87 // Save the image to file and its path to preferences. | 87 // Save the image to file and its path to preferences. |
88 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 88 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
89 if (user_manager) { | 89 if (user_manager) { |
90 if (user_manager->logged_in_user().email() == username_) { | 90 if (user_manager->logged_in_user().email() == username_) { |
91 user_manager->SetLoggedInUserImage(decoded_image); | 91 user_manager->SetLoggedInUserImage(decoded_image); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (!link_dictionary->GetStringASCII("href", &url)) | 184 if (!link_dictionary->GetStringASCII("href", &url)) |
185 continue; | 185 continue; |
186 | 186 |
187 *image_url = GURL(url); | 187 *image_url = GURL(url); |
188 return true; | 188 return true; |
189 } | 189 } |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 } // namespace chromeos | 193 } // namespace chromeos |
OLD | NEW |