| OLD | NEW |
| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 info.type = user_manager::User::POLICY; | 467 info.type = user_manager::User::POLICY; |
| 468 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); | 468 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void WallpaperManagerBase::OnPolicyCleared(const std::string& policy, | 471 void WallpaperManagerBase::OnPolicyCleared(const std::string& policy, |
| 472 const AccountId& account_id) { | 472 const AccountId& account_id) { |
| 473 WallpaperInfo info; | 473 WallpaperInfo info; |
| 474 GetUserWallpaperInfo(account_id, &info); | 474 GetUserWallpaperInfo(account_id, &info); |
| 475 info.type = user_manager::User::DEFAULT; | 475 info.type = user_manager::User::DEFAULT; |
| 476 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); | 476 SetUserWallpaperInfo(account_id, info, true /* is_persistent */); |
| 477 // If the user's policy is cleared, try to set the device wallpaper first. | 477 SetDefaultWallpaperNow(account_id); |
| 478 // Note We have to modify the user wallpaper info first. Otherwise, we won't | |
| 479 // be able to override the current user policy wallpaper. The wallpaper info | |
| 480 // will be set correctly if the device wallpaper is set successfully. | |
| 481 if (!SetDeviceWallpaperIfApplicable(account_id)) { | |
| 482 SetDefaultWallpaperNow(account_id); | |
| 483 } | |
| 484 } | 478 } |
| 485 | 479 |
| 486 // static | 480 // static |
| 487 base::FilePath WallpaperManagerBase::GetCustomWallpaperPath( | 481 base::FilePath WallpaperManagerBase::GetCustomWallpaperPath( |
| 488 const char* sub_dir, | 482 const char* sub_dir, |
| 489 const wallpaper::WallpaperFilesId& wallpaper_files_id, | 483 const wallpaper::WallpaperFilesId& wallpaper_files_id, |
| 490 const std::string& file) { | 484 const std::string& file) { |
| 491 base::FilePath custom_wallpaper_path = GetCustomWallpaperDir(sub_dir); | 485 base::FilePath custom_wallpaper_path = GetCustomWallpaperDir(sub_dir); |
| 492 return custom_wallpaper_path.Append(wallpaper_files_id.id()).Append(file); | 486 return custom_wallpaper_path.Append(wallpaper_files_id.id()).Append(file); |
| 493 } | 487 } |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { | 1039 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { |
| 1046 loaded_wallpapers_for_test_++; | 1040 loaded_wallpapers_for_test_++; |
| 1047 SkBitmap bitmap; | 1041 SkBitmap bitmap; |
| 1048 bitmap.allocN32Pixels(1, 1); | 1042 bitmap.allocN32Pixels(1, 1); |
| 1049 bitmap.eraseColor(kDefaultWallpaperColor); | 1043 bitmap.eraseColor(kDefaultWallpaperColor); |
| 1050 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 1044 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 1051 default_wallpaper_image_.reset(new user_manager::UserImage(image)); | 1045 default_wallpaper_image_.reset(new user_manager::UserImage(image)); |
| 1052 } | 1046 } |
| 1053 | 1047 |
| 1054 } // namespace wallpaper | 1048 } // namespace wallpaper |
| OLD | NEW |