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

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

Issue 2772973003: Chrome OS: revert the device wallpaper change within a user session. (Closed)
Patch Set: Created 3 years, 9 months 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/wallpaper/wallpaper_manager_base.h ('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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 info.type = user_manager::User::POLICY; 483 info.type = user_manager::User::POLICY;
484 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); 484 SetUserWallpaperInfo(account_id, info, true /* is_persistent */);
485 } 485 }
486 486
487 void WallpaperManagerBase::OnPolicyCleared(const std::string& policy, 487 void WallpaperManagerBase::OnPolicyCleared(const std::string& policy,
488 const AccountId& account_id) { 488 const AccountId& account_id) {
489 WallpaperInfo info; 489 WallpaperInfo info;
490 GetUserWallpaperInfo(account_id, &info); 490 GetUserWallpaperInfo(account_id, &info);
491 info.type = user_manager::User::DEFAULT; 491 info.type = user_manager::User::DEFAULT;
492 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); 492 SetUserWallpaperInfo(account_id, info, true /* is_persistent */);
493 // If the user's policy is cleared, try to set the device wallpaper first. 493 SetDefaultWallpaperNow(account_id);
494 // Note We have to modify the user wallpaper info first. Otherwise, we won't
495 // be able to override the current user policy wallpaper. The wallpaper info
496 // will be set correctly if the device wallpaper is set successfully.
497 if (!SetDeviceWallpaperIfApplicable(account_id)) {
498 SetDefaultWallpaperNow(account_id);
499 }
500 } 494 }
501 495
502 // static 496 // static
503 base::FilePath WallpaperManagerBase::GetCustomWallpaperPath( 497 base::FilePath WallpaperManagerBase::GetCustomWallpaperPath(
504 const char* sub_dir, 498 const char* sub_dir,
505 const wallpaper::WallpaperFilesId& wallpaper_files_id, 499 const wallpaper::WallpaperFilesId& wallpaper_files_id,
506 const std::string& file) { 500 const std::string& file) {
507 base::FilePath custom_wallpaper_path = GetCustomWallpaperDir(sub_dir); 501 base::FilePath custom_wallpaper_path = GetCustomWallpaperDir(sub_dir);
508 return custom_wallpaper_path.Append(wallpaper_files_id.id()).Append(file); 502 return custom_wallpaper_path.Append(wallpaper_files_id.id()).Append(file);
509 } 503 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { 1055 void WallpaperManagerBase::CreateSolidDefaultWallpaper() {
1062 loaded_wallpapers_for_test_++; 1056 loaded_wallpapers_for_test_++;
1063 SkBitmap bitmap; 1057 SkBitmap bitmap;
1064 bitmap.allocN32Pixels(1, 1); 1058 bitmap.allocN32Pixels(1, 1);
1065 bitmap.eraseColor(kDefaultWallpaperColor); 1059 bitmap.eraseColor(kDefaultWallpaperColor);
1066 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 1060 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
1067 default_wallpaper_image_.reset(new user_manager::UserImage(image)); 1061 default_wallpaper_image_.reset(new user_manager::UserImage(image));
1068 } 1062 }
1069 1063
1070 } // namespace wallpaper 1064 } // namespace wallpaper
OLDNEW
« no previous file with comments | « components/wallpaper/wallpaper_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698