Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 8510069: Make ProfileImageDownloader available to non-chromeos code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/user_manager.cc
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
index b1d392761da804a029d6a184a07dfef18bde7100..dd88c9d0fbec4b2d23bc582dfc3791d16634d68a 100644
--- a/chrome/browser/chromeos/login/user_manager.cc
+++ b/chrome/browser/chromeos/login/user_manager.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/chromeos/system/runtime_environment.h"
#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#include "chrome/browser/defaults.h"
+#include "chrome/browser/gaia_userinfo/profile_downloader.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
@@ -457,7 +458,7 @@ void UserManager::DownloadProfileImage() {
// Another download is already in progress
return;
}
- profile_image_downloader_.reset(new ProfileImageDownloader(this));
+ profile_image_downloader_.reset(new ProfileDownloader(this));
profile_image_downloader_->Start();
profile_image_load_start_time_ = base::Time::Now();
}
@@ -793,11 +794,24 @@ void UserManager::CheckOwnership() {
is_owner));
}
-void UserManager::OnDownloadSuccess(const SkBitmap& image) {
+int UserManager::GetDesiredImageSize() {
+ return login::kUserImageSize;
+}
+
+std::string UserManager::GetProfileUserName() {
+ return logged_in_user().email();
+}
+
+Profile* UserManager::GetBrowserProfile() {
+ return ProfileManager::GetDefaultProfile();
whywhat 2011/11/15 12:19:21 Guess you need to include profile_manager.h for th
sail 2011/11/15 20:17:22 Done.
+}
+
+void UserManager::OnDownloadSuccess(const string16& full_name,
whywhat 2011/11/15 12:19:21 We should at least DCHECK that full_name is the sa
sail 2011/11/15 20:17:22 Actually the full_name here is the first and last
+ const SkBitmap& image) {
VLOG(1) << "Downloaded profile image for logged-in user.";
UMA_HISTOGRAM_ENUMERATION("UserImageDownloadResult.LoggedIn",
- ProfileImageDownloader::kDownloadSuccess,
- ProfileImageDownloader::kDownloadResultsCount);
+ ProfileDownloader::kDownloadSuccess,
+ ProfileDownloader::kDownloadResultsCount);
// Check if this image is not the same as already downloaded.
std::string new_image_data_url = web_ui_util::GetImageDataUrl(image);
@@ -816,8 +830,8 @@ void UserManager::OnDownloadSuccess(const SkBitmap& image) {
VLOG(1) << "Updating profile image for logged-in user";
UMA_HISTOGRAM_ENUMERATION("UserImageDownloadResult.LoggedIn",
- ProfileImageDownloader::kDownloadSuccessChanged,
- ProfileImageDownloader::kDownloadResultsCount);
+ ProfileDownloader::kDownloadSuccessChanged,
+ ProfileDownloader::kDownloadResultsCount);
// This will persist |downloaded_profile_image_| to file.
SaveUserImageFromProfileImage(logged_in_user().email());
@@ -834,8 +848,8 @@ void UserManager::OnDownloadSuccess(const SkBitmap& image) {
void UserManager::OnDownloadFailure() {
VLOG(1) << "Download of profile image for logged-in user failed.";
UMA_HISTOGRAM_ENUMERATION("UserImageDownloadResult.LoggedIn",
- ProfileImageDownloader::kDownloadFailure,
- ProfileImageDownloader::kDownloadResultsCount);
+ ProfileDownloader::kDownloadFailure,
+ ProfileDownloader::kDownloadResultsCount);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED,
content::Source<UserManager>(this),
@@ -843,11 +857,11 @@ void UserManager::OnDownloadFailure() {
profile_image_downloader_.reset();
}
-void UserManager::OnDownloadDefaultImage() {
+void UserManager::OnDownloadDefaultImage(const string16& full_name) {
VLOG(1) << "Logged-in user still has the default profile image.";
UMA_HISTOGRAM_ENUMERATION("UserImageDownloadResult.LoggedIn",
- ProfileImageDownloader::kDownloadDefault,
- ProfileImageDownloader::kDownloadResultsCount);
+ ProfileDownloader::kDownloadDefault,
+ ProfileDownloader::kDownloadResultsCount);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED,
content::Source<UserManager>(this),

Powered by Google App Engine
This is Rietveld 408576698