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

Side by Side Diff: components/wallpaper/wallpaper_manager_base.cc

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 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 unified diff | Download patch
« no previous file with comments | « components/user_manager/user_manager_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/wallpaper/wallpaper_manager_base.h" 5 #include "components/wallpaper/wallpaper_manager_base.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <vector> 8 #include <vector>
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 WallpaperManagerBase::~WallpaperManagerBase() { 495 WallpaperManagerBase::~WallpaperManagerBase() {
496 // TODO(bshe): Lifetime of WallpaperManagerBase needs more consideration. 496 // TODO(bshe): Lifetime of WallpaperManagerBase needs more consideration.
497 // http://crbug.com/171694 497 // http://crbug.com/171694
498 weak_factory_.InvalidateWeakPtrs(); 498 weak_factory_.InvalidateWeakPtrs();
499 } 499 }
500 500
501 void WallpaperManagerBase::SetPolicyControlledWallpaper( 501 void WallpaperManagerBase::SetPolicyControlledWallpaper(
502 const std::string& user_id, 502 const std::string& user_id,
503 const user_manager::UserImage& user_image) { 503 const user_manager::UserImage& user_image) {
504 const user_manager::User* user = 504 const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
505 user_manager::UserManager::Get()->FindUser(user_id); 505 AccountId::FromUserEmail(user_id));
506 if (!user) { 506 if (!user) {
507 NOTREACHED() << "Unknown user."; 507 NOTREACHED() << "Unknown user.";
508 return; 508 return;
509 } 509 }
510 510
511 if (user->username_hash().empty()) { 511 if (user->username_hash().empty()) {
512 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( 512 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername(
513 user_id, 513 user_id,
514 base::Bind(&WallpaperManagerBase::SetCustomWallpaperOnSanitizedUsername, 514 base::Bind(&WallpaperManagerBase::SetCustomWallpaperOnSanitizedUsername,
515 weak_factory_.GetWeakPtr(), user_id, user_image.image(), 515 weak_factory_.GetWeakPtr(), user_id, user_image.image(),
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 const std::string& user_id, 879 const std::string& user_id,
880 const std::string& user_id_hash) { 880 const std::string& user_id_hash) {
881 WallpaperInfo info; 881 WallpaperInfo info;
882 GetUserWallpaperInfo(user_id, &info); 882 GetUserWallpaperInfo(user_id, &info);
883 if (info.type == user_manager::User::CUSTOMIZED) { 883 if (info.type == user_manager::User::CUSTOMIZED) {
884 // New file field should include user id hash in addition to file name. 884 // New file field should include user id hash in addition to file name.
885 // This is needed because at login screen, user id hash is not available. 885 // This is needed because at login screen, user id hash is not available.
886 info.location = base::FilePath(user_id_hash).Append(info.location).value(); 886 info.location = base::FilePath(user_id_hash).Append(info.location).value();
887 bool is_persistent = 887 bool is_persistent =
888 !user_manager::UserManager::Get()->IsUserNonCryptohomeDataEphemeral( 888 !user_manager::UserManager::Get()->IsUserNonCryptohomeDataEphemeral(
889 user_id); 889 AccountId::FromUserEmail(user_id));
890 SetUserWallpaperInfo(user_id, info, is_persistent); 890 SetUserWallpaperInfo(user_id, info, is_persistent);
891 } 891 }
892 } 892 }
893 893
894 void WallpaperManagerBase::MoveLoggedInUserCustomWallpaper() { 894 void WallpaperManagerBase::MoveLoggedInUserCustomWallpaper() {
895 const user_manager::User* logged_in_user = 895 const user_manager::User* logged_in_user =
896 user_manager::UserManager::Get()->GetLoggedInUser(); 896 user_manager::UserManager::Get()->GetLoggedInUser();
897 if (logged_in_user) { 897 if (logged_in_user) {
898 task_runner_->PostTask( 898 task_runner_->PostTask(
899 FROM_HERE, 899 FROM_HERE,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { 1056 void WallpaperManagerBase::CreateSolidDefaultWallpaper() {
1057 loaded_wallpapers_for_test_++; 1057 loaded_wallpapers_for_test_++;
1058 SkBitmap bitmap; 1058 SkBitmap bitmap;
1059 bitmap.allocN32Pixels(1, 1); 1059 bitmap.allocN32Pixels(1, 1);
1060 bitmap.eraseColor(kDefaultWallpaperColor); 1060 bitmap.eraseColor(kDefaultWallpaperColor);
1061 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 1061 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
1062 default_wallpaper_image_.reset(new user_manager::UserImage(image)); 1062 default_wallpaper_image_.reset(new user_manager::UserImage(image));
1063 } 1063 }
1064 1064
1065 } // namespace wallpaper 1065 } // namespace wallpaper
OLDNEW
« no previous file with comments | « components/user_manager/user_manager_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698