Commit cac62e3f authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

wallpaper refactoring: Move SetDefaultWallpaper to WallpaperController

1) Emphasize the default wallpaper selection order in
   DoSetDefaultWallpaper (renamed to SetDefaultWallpaperImpl).
   Create two additional member variables to store the customized
   default wallpaper file paths to make the distinction with a regular
   default wallpaper (ie. from the command line). Previously, these
   two are mixed in the code.

2) Rename |SetDefaultWallpaperPath| to
   |SetCustomizedDefaultWallpaperImpl|.

3) |SetDefaultWallpaperPathsFromCommandLine| is removed. We don't have
   the need to cache the values which come from the command line.

TBR=oshima@chromium.org, ochang@chromium.org

Test: Manual (device/Linux build), ash_unittests, browser tests
Bug: 792233
Change-Id: I09876e23ea7609c7b7e876d4daf79c4fa35088c5
Reviewed-on: https://chromium-review.googlesource.com/808092Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarOliver Chang <ochang@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523324}
parent b2a17033
...@@ -80,7 +80,7 @@ interface WallpaperController { ...@@ -80,7 +80,7 @@ interface WallpaperController {
// Sets wallpaper from policy or from a local file. Saves the custom wallpaper // Sets wallpaper from policy or from a local file. Saves the custom wallpaper
// to file, posts task to generate thumbnail and updates local state. // to file, posts task to generate thumbnail and updates local state.
// |user_info|: The user's information related to wallpaper. // |user_info|: The user's information related to wallpaper.
// |wallpaper_files_id|: The unique id of each wallpaper file. // |wallpaper_files_id|: The file id for user_info.account_id.
// |file_name|: The name of the wallpaper file. // |file_name|: The name of the wallpaper file.
// |layout|: The layout of the wallpaper, used for wallpaper resizing. // |layout|: The layout of the wallpaper, used for wallpaper resizing.
// |type|: The type of the wallpaper, e.g., default, policy etc. // |type|: The type of the wallpaper, e.g., default, policy etc.
...@@ -111,9 +111,13 @@ interface WallpaperController { ...@@ -111,9 +111,13 @@ interface WallpaperController {
bool show_wallpaper); bool show_wallpaper);
// Sets the user's wallpaper to be the default wallpaper. Note: different user // Sets the user's wallpaper to be the default wallpaper. Note: different user
// types may have different default wallpapers. If |show_wallpaper| is false, // types may have different default wallpapers.
// don't show the default wallpaper now. // |wallpaper_files_id|: The file id for user_info.account_id.
SetDefaultWallpaper(WallpaperUserInfo user_info, bool show_wallpaper); // |show_wallpaper|: If false, don't show the new wallpaper now but only
// update cache.
SetDefaultWallpaper(WallpaperUserInfo user_info,
string wallpaper_files_id,
bool show_wallpaper);
// Sets a customized default wallpaper to be used wherever a default wallpaper // Sets a customized default wallpaper to be used wherever a default wallpaper
// is needed. Note: it doesn't change the default wallpaper for guest and // is needed. Note: it doesn't change the default wallpaper for guest and
...@@ -139,7 +143,7 @@ interface WallpaperController { ...@@ -139,7 +143,7 @@ interface WallpaperController {
ShowSigninWallpaper(); ShowSigninWallpaper();
// Removes all of the user's saved wallpapers and related info. // Removes all of the user's saved wallpapers and related info.
// |wallpaper_files_id|: The unique id of each wallpaper file. // |wallpaper_files_id|: The file id for user_info.account_id.
RemoveUserWallpaper(WallpaperUserInfo user_info, string wallpaper_files_id); RemoveUserWallpaper(WallpaperUserInfo user_info, string wallpaper_files_id);
// TODO(crbug.com/776464): This is only used by WallpaperManager. Remove this // TODO(crbug.com/776464): This is only used by WallpaperManager. Remove this
......
This diff is collapsed.
This diff is collapsed.
...@@ -229,7 +229,7 @@ void ArcWallpaperService::SetDefaultWallpaper() { ...@@ -229,7 +229,7 @@ void ArcWallpaperService::SetDefaultWallpaper() {
// ImageDecoder::ImageRequest. // ImageDecoder::ImageRequest.
decode_request_.reset(); decode_request_.reset();
const PrimaryAccount& account = GetPrimaryAccount(); const PrimaryAccount& account = GetPrimaryAccount();
chromeos::WallpaperManager::Get()->SetDefaultWallpaper( WallpaperControllerClient::Get()->SetDefaultWallpaper(
account.id, account.is_active /* show_wallpaper */); account.id, account.is_active /* show_wallpaper */);
} }
......
...@@ -144,10 +144,10 @@ class ArcWallpaperServiceTest : public ash::AshTestBase { ...@@ -144,10 +144,10 @@ class ArcWallpaperServiceTest : public ash::AshTestBase {
protected: protected:
arc::ArcWallpaperService* service_ = nullptr; arc::ArcWallpaperService* service_ = nullptr;
std::unique_ptr<arc::FakeWallpaperInstance> wallpaper_instance_ = nullptr; std::unique_ptr<arc::FakeWallpaperInstance> wallpaper_instance_ = nullptr;
private:
std::unique_ptr<WallpaperControllerClient> wallpaper_controller_client_; std::unique_ptr<WallpaperControllerClient> wallpaper_controller_client_;
TestWallpaperController test_wallpaper_controller_; TestWallpaperController test_wallpaper_controller_;
private:
chromeos::FakeChromeUserManager* const user_manager_ = nullptr; chromeos::FakeChromeUserManager* const user_manager_ = nullptr;
user_manager::ScopedUserManager user_manager_enabler_; user_manager::ScopedUserManager user_manager_enabler_;
arc::ArcServiceManager arc_service_manager_; arc::ArcServiceManager arc_service_manager_;
...@@ -161,12 +161,10 @@ class ArcWallpaperServiceTest : public ash::AshTestBase { ...@@ -161,12 +161,10 @@ class ArcWallpaperServiceTest : public ash::AshTestBase {
} // namespace } // namespace
TEST_F(ArcWallpaperServiceTest, SetDefaultWallpaper) { TEST_F(ArcWallpaperServiceTest, SetDefaultWallpaper) {
test_wallpaper_controller_.ClearCounts();
service_->SetDefaultWallpaper(); service_->SetDefaultWallpaper();
RunAllPendingInMessageLoop(); wallpaper_controller_client_->FlushForTesting();
// Wait until wallpaper loading is done. EXPECT_EQ(1, test_wallpaper_controller_.set_default_wallpaper_count());
chromeos::wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
ASSERT_EQ(1u, wallpaper_instance_->changed_ids().size());
EXPECT_EQ(-1, wallpaper_instance_->changed_ids()[0]);
} }
TEST_F(ArcWallpaperServiceTest, SetAndGetWallpaper) { TEST_F(ArcWallpaperServiceTest, SetAndGetWallpaper) {
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wallpaper/wallpaper_controller.h" #include "ash/wallpaper/wallpaper_controller.h"
#include "ash/wallpaper/wallpaper_controller_observer.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -56,32 +56,30 @@ const char kServicesManifest[] = ...@@ -56,32 +56,30 @@ const char kServicesManifest[] =
// Expected minimal wallpaper download retry interval in milliseconds. // Expected minimal wallpaper download retry interval in milliseconds.
const int kDownloadRetryIntervalMS = 100; const int kDownloadRetryIntervalMS = 100;
class TestWallpaperObserver : public WallpaperManager::Observer { class TestWallpaperObserver : public ash::WallpaperControllerObserver {
public: public:
explicit TestWallpaperObserver(WallpaperManager* wallpaper_manager) explicit TestWallpaperObserver(ash::WallpaperController* wallpaper_controller)
: finished_(false), : finished_(false), wallpaper_controller_(wallpaper_controller) {
wallpaper_manager_(wallpaper_manager) { wallpaper_controller_->AddObserver(this);
DCHECK(wallpaper_manager_);
wallpaper_manager_->AddObserver(this);
} }
~TestWallpaperObserver() override { ~TestWallpaperObserver() override {
wallpaper_manager_->RemoveObserver(this); wallpaper_controller_->RemoveObserver(this);
} }
void OnWallpaperAnimationFinished(const AccountId&) override { void OnWallpaperDataChanged() override {
finished_ = true; finished_ = true;
base::RunLoop::QuitCurrentWhenIdleDeprecated(); base::RunLoop::QuitCurrentWhenIdleDeprecated();
} }
void WaitForWallpaperAnimationFinished() { void WaitForWallpaperDataChanged() {
while (!finished_) while (!finished_)
base::RunLoop().Run(); base::RunLoop().Run();
} }
private: private:
bool finished_; bool finished_;
WallpaperManager* wallpaper_manager_; ash::WallpaperController* wallpaper_controller_;
DISALLOW_COPY_AND_ASSIGN(TestWallpaperObserver); DISALLOW_COPY_AND_ASSIGN(TestWallpaperObserver);
}; };
...@@ -191,7 +189,7 @@ class WallpaperImageFetcherFactory { ...@@ -191,7 +189,7 @@ class WallpaperImageFetcherFactory {
SkColor color, SkColor color,
const size_t require_retries) { const size_t require_retries) {
std::vector<unsigned char> oem_wallpaper_; std::vector<unsigned char> oem_wallpaper_;
ASSERT_TRUE(wallpaper_manager_test_utils::CreateJPEGImage( ASSERT_TRUE(ash::WallpaperController::CreateJPEGImageForTesting(
width, height, color, &oem_wallpaper_)); width, height, color, &oem_wallpaper_));
url_callback_.reset(new TestWallpaperImageURLFetcherCallback( url_callback_.reset(new TestWallpaperImageURLFetcherCallback(
...@@ -226,81 +224,59 @@ class CustomizationWallpaperDownloaderBrowserTest ...@@ -226,81 +224,59 @@ class CustomizationWallpaperDownloaderBrowserTest
command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
} }
protected:
void CreateCmdlineWallpapers() {
cmdline_wallpaper_dir_.reset(new base::ScopedTempDir);
ASSERT_TRUE(cmdline_wallpaper_dir_->CreateUniqueTempDir());
wallpaper_manager_test_utils::CreateCmdlineWallpapers(
*cmdline_wallpaper_dir_, &wallpaper_manager_command_line_);
}
std::unique_ptr<base::CommandLine> wallpaper_manager_command_line_;
// Directory created by CreateCmdlineWallpapersAndSetFlags() to store default
// wallpaper images.
std::unique_ptr<base::ScopedTempDir> cmdline_wallpaper_dir_;
private: private:
DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest); DISALLOW_COPY_AND_ASSIGN(CustomizationWallpaperDownloaderBrowserTest);
}; };
IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
OEMWallpaperIsPresent) { OEMWallpaperIsPresent) {
CreateCmdlineWallpapers(); ash::WallpaperController* wallpaper_controller =
WallpaperManager::Get()->SetDefaultWallpaper(EmptyAccountId(), ash::Shell::Get()->wallpaper_controller();
true /* update_wallpaper */); wallpaper_controller->ShowDefaultWallpaperForTesting();
wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
ash::Shell::Get()->wallpaper_controller()->GetWallpaper(),
wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
WallpaperImageFetcherFactory url_factory( WallpaperImageFetcherFactory url_factory(
GURL(kOEMWallpaperURL), GURL(kOEMWallpaperURL), wallpaper_manager_test_utils::kWallpaperSize,
wallpaper_manager_test_utils::kWallpaperSize, wallpaper_manager_test_utils::kWallpaperSize,
wallpaper_manager_test_utils::kWallpaperSize, wallpaper_manager_test_utils::kLargeCustomWallpaperColor,
wallpaper_manager_test_utils::kCustomWallpaperColor,
0 /* require_retries */); 0 /* require_retries */);
TestWallpaperObserver observer(WallpaperManager::Get()); TestWallpaperObserver observer(wallpaper_controller);
chromeos::ServicesCustomizationDocument* customization = chromeos::ServicesCustomizationDocument* customization =
chromeos::ServicesCustomizationDocument::GetInstance(); chromeos::ServicesCustomizationDocument::GetInstance();
EXPECT_TRUE( EXPECT_TRUE(
customization->LoadManifestFromString(std::string(kServicesManifest))); customization->LoadManifestFromString(std::string(kServicesManifest)));
observer.WaitForWallpaperAnimationFinished(); observer.WaitForWallpaperDataChanged();
EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_controller->GetWallpaper(),
wallpaper_manager_test_utils::kCustomWallpaperColor)); wallpaper_manager_test_utils::kLargeCustomWallpaperColor));
EXPECT_EQ(1U, url_factory.num_attempts()); EXPECT_EQ(1U, url_factory.num_attempts());
} }
IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest, IN_PROC_BROWSER_TEST_F(CustomizationWallpaperDownloaderBrowserTest,
OEMWallpaperRetryFetch) { OEMWallpaperRetryFetch) {
CreateCmdlineWallpapers(); ash::WallpaperController* wallpaper_controller =
WallpaperManager::Get()->SetDefaultWallpaper(EmptyAccountId(), ash::Shell::Get()->wallpaper_controller();
true /* update_wallpaper */); wallpaper_controller->ShowDefaultWallpaperForTesting();
wallpaper_manager_test_utils::WaitAsyncWallpaperLoadFinished();
EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
ash::Shell::Get()->wallpaper_controller()->GetWallpaper(),
wallpaper_manager_test_utils::kSmallDefaultWallpaperColor));
WallpaperImageFetcherFactory url_factory( WallpaperImageFetcherFactory url_factory(
GURL(kOEMWallpaperURL), GURL(kOEMWallpaperURL), wallpaper_manager_test_utils::kWallpaperSize,
wallpaper_manager_test_utils::kWallpaperSize, wallpaper_manager_test_utils::kWallpaperSize,
wallpaper_manager_test_utils::kWallpaperSize, wallpaper_manager_test_utils::kLargeCustomWallpaperColor,
wallpaper_manager_test_utils::kCustomWallpaperColor,
1 /* require_retries */); 1 /* require_retries */);
TestWallpaperObserver observer(WallpaperManager::Get()); TestWallpaperObserver observer(wallpaper_controller);
chromeos::ServicesCustomizationDocument* customization = chromeos::ServicesCustomizationDocument* customization =
chromeos::ServicesCustomizationDocument::GetInstance(); chromeos::ServicesCustomizationDocument::GetInstance();
EXPECT_TRUE( EXPECT_TRUE(
customization->LoadManifestFromString(std::string(kServicesManifest))); customization->LoadManifestFromString(std::string(kServicesManifest)));
observer.WaitForWallpaperAnimationFinished(); observer.WaitForWallpaperDataChanged();
EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor( EXPECT_TRUE(wallpaper_manager_test_utils::ImageIsNearColor(
ash::Shell::Get()->wallpaper_controller()->GetWallpaper(), wallpaper_controller->GetWallpaper(),
wallpaper_manager_test_utils::kCustomWallpaperColor)); wallpaper_manager_test_utils::kLargeCustomWallpaperColor));
EXPECT_EQ(2U, url_factory.num_attempts()); EXPECT_EQ(2U, url_factory.num_attempts());
} }
......
...@@ -210,8 +210,9 @@ void WallpaperSetWallpaperFunction::GenerateThumbnail( ...@@ -210,8 +210,9 @@ void WallpaperSetWallpaperFunction::GenerateThumbnail(
image->height(), &original_data, NULL); image->height(), &original_data, NULL);
chromeos::WallpaperManager::Get()->ResizeImage( chromeos::WallpaperManager::Get()->ResizeImage(
*image, wallpaper::WALLPAPER_LAYOUT_STRETCH, *image, wallpaper::WALLPAPER_LAYOUT_STRETCH,
chromeos::kWallpaperThumbnailWidth, chromeos::kWallpaperThumbnailHeight, ash::WallpaperController::kWallpaperThumbnailWidth,
&thumbnail_data, NULL); ash::WallpaperController::kWallpaperThumbnailHeight, &thumbnail_data,
NULL);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::BindOnce(&WallpaperSetWallpaperFunction::ThumbnailGenerated, this, base::BindOnce(&WallpaperSetWallpaperFunction::ThumbnailGenerated, this,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wallpaper/wallpaper_controller.h"
#include "ash/wallpaper/wallpaper_window_state_manager.h" #include "ash/wallpaper/wallpaper_window_state_manager.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_enumerator.h" #include "base/files/file_enumerator.h"
...@@ -278,15 +279,15 @@ bool WallpaperPrivateSetWallpaperIfExistsFunction::RunAsync() { ...@@ -278,15 +279,15 @@ bool WallpaperPrivateSetWallpaperIfExistsFunction::RunAsync() {
base::FilePath wallpaper_path; base::FilePath wallpaper_path;
base::FilePath fallback_path; base::FilePath fallback_path;
chromeos::WallpaperManager::WallpaperResolution resolution = ash::WallpaperController::WallpaperResolution resolution =
wallpaper_manager->GetAppropriateResolution(); ash::WallpaperController::GetAppropriateResolution();
std::string file_name = GURL(params->url).ExtractFileName(); std::string file_name = GURL(params->url).ExtractFileName();
CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS,
&wallpaper_path)); &wallpaper_path));
fallback_path = wallpaper_path.Append(file_name); fallback_path = wallpaper_path.Append(file_name);
if (params->layout != wallpaper_base::WALLPAPER_LAYOUT_STRETCH && if (params->layout != wallpaper_base::WALLPAPER_LAYOUT_STRETCH &&
resolution == chromeos::WallpaperManager::WALLPAPER_RESOLUTION_SMALL) { resolution == ash::WallpaperController::WALLPAPER_RESOLUTION_SMALL) {
file_name = base::FilePath(file_name) file_name = base::FilePath(file_name)
.InsertBeforeExtension(chromeos::kSmallWallpaperSuffix) .InsertBeforeExtension(chromeos::kSmallWallpaperSuffix)
.value(); .value();
...@@ -417,8 +418,8 @@ void WallpaperPrivateSetWallpaperFunction::SaveToFile() { ...@@ -417,8 +418,8 @@ void WallpaperPrivateSetWallpaperFunction::SaveToFile() {
// maintain the aspect ratio after resize. // maintain the aspect ratio after resize.
chromeos::WallpaperManager::Get()->ResizeAndSaveWallpaper( chromeos::WallpaperManager::Get()->ResizeAndSaveWallpaper(
wallpaper_, file_path, wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper_, file_path, wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED,
chromeos::kSmallWallpaperMaxWidth, chromeos::kSmallWallpaperMaxHeight, ash::WallpaperController::kSmallWallpaperMaxWidth,
NULL); ash::WallpaperController::kSmallWallpaperMaxHeight, NULL);
} else { } else {
std::string error = base::StringPrintf( std::string error = base::StringPrintf(
"Failed to create/write wallpaper to %s.", file_name.c_str()); "Failed to create/write wallpaper to %s.", file_name.c_str());
...@@ -460,12 +461,11 @@ bool WallpaperPrivateResetWallpaperFunction::RunAsync() { ...@@ -460,12 +461,11 @@ bool WallpaperPrivateResetWallpaperFunction::RunAsync() {
user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); user_manager::UserManager::Get()->GetActiveUser()->GetAccountId();
// Do not change wallpaper if policy is in effect. // Do not change wallpaper if policy is in effect.
chromeos::WallpaperManager* wallpaper_manager = if (chromeos::WallpaperManager::Get()->IsPolicyControlled(account_id))
chromeos::WallpaperManager::Get();
if (wallpaper_manager->IsPolicyControlled(account_id))
return false; return false;
wallpaper_manager->SetDefaultWallpaper(account_id, true /* show_wallpaper */); WallpaperControllerClient::Get()->SetDefaultWallpaper(
account_id, true /* show_wallpaper */);
Profile* profile = Profile::FromBrowserContext(browser_context()); Profile* profile = Profile::FromBrowserContext(browser_context());
// This API is only available to the component wallpaper picker. We do not // This API is only available to the component wallpaper picker. We do not
...@@ -548,8 +548,8 @@ void WallpaperPrivateSetCustomWallpaperFunction::GenerateThumbnail( ...@@ -548,8 +548,8 @@ void WallpaperPrivateSetCustomWallpaperFunction::GenerateThumbnail(
scoped_refptr<base::RefCountedBytes> data; scoped_refptr<base::RefCountedBytes> data;
chromeos::WallpaperManager::Get()->ResizeImage( chromeos::WallpaperManager::Get()->ResizeImage(
*image, wallpaper::WALLPAPER_LAYOUT_STRETCH, *image, wallpaper::WALLPAPER_LAYOUT_STRETCH,
chromeos::kWallpaperThumbnailWidth, chromeos::kWallpaperThumbnailHeight, ash::WallpaperController::kWallpaperThumbnailWidth,
&data, NULL); ash::WallpaperController::kWallpaperThumbnailHeight, &data, NULL);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::BindOnce( base::BindOnce(
......
...@@ -69,29 +69,14 @@ extern const char kWallpaperSequenceTokenName[]; ...@@ -69,29 +69,14 @@ extern const char kWallpaperSequenceTokenName[];
extern const char kSmallWallpaperSuffix[]; extern const char kSmallWallpaperSuffix[];
extern const char kLargeWallpaperSuffix[]; extern const char kLargeWallpaperSuffix[];
// The width and height of small/large resolution wallpaper. When screen size is
// smaller than |kSmallWallpaperMaxWidth| and |kSmallWallpaperMaxHeight|, the
// small resolution wallpaper should be used. Otherwise, use the large
// resolution wallpaper.
extern const int kSmallWallpaperMaxWidth;
extern const int kSmallWallpaperMaxHeight;
extern const int kLargeWallpaperMaxWidth;
extern const int kLargeWallpaperMaxHeight;
// The width and height of wallpaper thumbnails.
extern const int kWallpaperThumbnailWidth;
extern const int kWallpaperThumbnailHeight;
class WallpaperManager : public content::NotificationObserver, class WallpaperManager : public content::NotificationObserver,
public wm::ActivationChangeObserver, public wm::ActivationChangeObserver,
public aura::WindowObserver { public aura::WindowObserver {
public: public:
class PendingWallpaper; class PendingWallpaper;
enum WallpaperResolution { using MovableOnDestroyCallbackHolder =
WALLPAPER_RESOLUTION_LARGE, ash::WallpaperController::MovableOnDestroyCallbackHolder;
WALLPAPER_RESOLUTION_SMALL
};
class CustomizedWallpaperRescaledFiles { class CustomizedWallpaperRescaledFiles {
public: public:
...@@ -128,24 +113,6 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -128,24 +113,6 @@ class WallpaperManager : public content::NotificationObserver,
DISALLOW_COPY_AND_ASSIGN(CustomizedWallpaperRescaledFiles); DISALLOW_COPY_AND_ASSIGN(CustomizedWallpaperRescaledFiles);
}; };
// This object is passed between several threads while wallpaper is being
// loaded. It will notify callback when last reference to it is removed
// (thus indicating that the last load action has finished).
class MovableOnDestroyCallback {
public:
explicit MovableOnDestroyCallback(const base::Closure& callback);
~MovableOnDestroyCallback();
private:
base::Closure callback_;
DISALLOW_COPY_AND_ASSIGN(MovableOnDestroyCallback);
};
using MovableOnDestroyCallbackHolder =
std::unique_ptr<MovableOnDestroyCallback>;
class TestApi { class TestApi {
public: public:
explicit TestApi(WallpaperManager* wallpaper_manager); explicit TestApi(WallpaperManager* wallpaper_manager);
...@@ -240,11 +207,6 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -240,11 +207,6 @@ class WallpaperManager : public content::NotificationObserver,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
bool show_wallpaper); bool show_wallpaper);
// Sets |account_id|'s wallpaper to be the default wallpaper. Note: different
// user types may have different default wallpapers. If |show_wallpaper| is
// false, don't show the default wallpaper now.
void SetDefaultWallpaper(const AccountId& account_id, bool show_wallpaper);
// Sets a customized default wallpaper to be used wherever a default wallpaper // Sets a customized default wallpaper to be used wherever a default wallpaper
// is needed. Note: it doesn't change the default wallpaper for guest and // is needed. Note: it doesn't change the default wallpaper for guest and
// child accounts. // child accounts.
...@@ -286,18 +248,12 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -286,18 +248,12 @@ class WallpaperManager : public content::NotificationObserver,
// from gfx::ImageSkia by using WallpaperResizer::GetImageId(). // from gfx::ImageSkia by using WallpaperResizer::GetImageId().
bool IsPendingWallpaper(uint32_t image_id); bool IsPendingWallpaper(uint32_t image_id);
// Returns the appropriate wallpaper resolution for all root windows.
WallpaperResolution GetAppropriateResolution();
// Gets wallpaper information of logged in user. // Gets wallpaper information of logged in user.
bool GetLoggedInUserWallpaperInfo(wallpaper::WallpaperInfo* info); bool GetLoggedInUserWallpaperInfo(wallpaper::WallpaperInfo* info);
// Adds |this| as an observer to various settings. // Adds |this| as an observer to various settings.
void AddObservers(); void AddObservers();
// Sets command line and initialize |*default_*_wallpaper_file_|.
void SetCommandLineForTesting(base::CommandLine* command_line);
// Loads wallpaper asynchronously if the current wallpaper is not the // Loads wallpaper asynchronously if the current wallpaper is not the
// wallpaper of logged in user. // wallpaper of logged in user.
void EnsureLoggedInUserWallpaperLoaded(); void EnsureLoggedInUserWallpaperLoaded();
...@@ -343,10 +299,6 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -343,10 +299,6 @@ class WallpaperManager : public content::NotificationObserver,
// aura::WindowObserver: // aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override; void OnWindowDestroying(aura::Window* window) override;
// Shows the default wallpaper based on the user type of |account_id|. For
// testing purpose only.
void ShowDefaultWallpaperForTesting(const AccountId& account_id);
private: private:
friend class WallpaperManagerBrowserTest; friend class WallpaperManagerBrowserTest;
friend class WallpaperManagerBrowserTestDefaultWallpaper; friend class WallpaperManagerBrowserTestDefaultWallpaper;
...@@ -390,8 +342,7 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -390,8 +342,7 @@ class WallpaperManager : public content::NotificationObserver,
gfx::ImageSkia* small_wallpaper_image, gfx::ImageSkia* small_wallpaper_image,
gfx::ImageSkia* large_wallpaper_image); gfx::ImageSkia* large_wallpaper_image);
// Initialize wallpaper info for the user to default and saves the settings // A wrapper of |WallpaperController::InitializeUserWallpaperInfo|.
// in local state.
void InitializeUserWallpaperInfo(const AccountId& account_id); void InitializeUserWallpaperInfo(const AccountId& account_id);
// If the device is enterprise managed and the device wallpaper policy exists, // If the device is enterprise managed and the device wallpaper policy exists,
...@@ -477,11 +428,10 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -477,11 +428,10 @@ class WallpaperManager : public content::NotificationObserver,
MovableOnDestroyCallbackHolder on_finish, MovableOnDestroyCallbackHolder on_finish,
std::unique_ptr<user_manager::UserImage> user_image); std::unique_ptr<user_manager::UserImage> user_image);
// Sets wallpaper to default if |update_wallpaper| is true. Otherwise just // A wrapper of |WallpaperController::SetDefaultWallpaperImpl|.
// load defaut wallpaper to cache. void SetDefaultWallpaperImpl(const AccountId& account_id,
void DoSetDefaultWallpaper(const AccountId& account_id, bool show_wallpaper,
bool update_wallpaper, MovableOnDestroyCallbackHolder on_finish);
MovableOnDestroyCallbackHolder on_finish);
// Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is // Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is
// already loaded for that user, do nothing. Must be called on UI thread. // already loaded for that user, do nothing. Must be called on UI thread.
...@@ -523,37 +473,12 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -523,37 +473,12 @@ class WallpaperManager : public content::NotificationObserver,
std::unique_ptr<gfx::ImageSkia> small_wallpaper_image, std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
std::unique_ptr<gfx::ImageSkia> large_wallpaper_image); std::unique_ptr<gfx::ImageSkia> large_wallpaper_image);
// Init |*default_*_wallpaper_file_| from given command line and
// clear |default_wallpaper_image_|.
void SetDefaultWallpaperPathsFromCommandLine(base::CommandLine* command_line);
// Sets wallpaper to decoded default if |update_wallpaper| is true.
void OnDefaultWallpaperDecoded(
const base::FilePath& path,
const wallpaper::WallpaperLayout layout,
bool update_wallpaper,
std::unique_ptr<user_manager::UserImage>* result,
MovableOnDestroyCallbackHolder on_finish,
std::unique_ptr<user_manager::UserImage> user_image);
// Start decoding given default wallpaper and set it as wallpaper if
// |update_wallpaper| is true.
void StartLoadAndSetDefaultWallpaper(
const base::FilePath& path,
const wallpaper::WallpaperLayout layout,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish,
std::unique_ptr<user_manager::UserImage>* result_out);
// Record the Wallpaper App that the user is using right now on Chrome OS. // Record the Wallpaper App that the user is using right now on Chrome OS.
void RecordWallpaperAppType(); void RecordWallpaperAppType();
// Returns wallpaper subdirectory name for current resolution. // Returns wallpaper subdirectory name for current resolution.
const char* GetCustomWallpaperSubdirForCurrentResolution(); const char* GetCustomWallpaperSubdirForCurrentResolution();
// Init default_wallpaper_image_ with 1x1 image of default color.
void CreateSolidDefaultWallpaper();
// Callback function for GetCustomWallpaperInternal(). // Callback function for GetCustomWallpaperInternal().
void OnCustomWallpaperFileNotFound(const AccountId& account_id, void OnCustomWallpaperFileNotFound(const AccountId& account_id,
const base::FilePath& expected_path, const base::FilePath& expected_path,
...@@ -598,12 +523,8 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -598,12 +523,8 @@ class WallpaperManager : public content::NotificationObserver,
const AccountId& account_id, const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image); std::unique_ptr<user_manager::UserImage> user_image);
// Use given files as new default wallpaper. // A wrapper of |WallpaperController::SetCustomizedDefaultWallpaperImpl|.
// Reloads current wallpaper, if old default was loaded. void SetCustomizedDefaultWallpaperImpl(
// Current value of default_wallpaper_image_ is destroyed.
// Sets default_wallpaper_image_ either to |small_wallpaper_image| or
// |large_wallpaper_image| depending on GetAppropriateResolution().
void SetDefaultWallpaperPath(
const base::FilePath& customized_default_wallpaper_file_small, const base::FilePath& customized_default_wallpaper_file_small,
std::unique_ptr<gfx::ImageSkia> small_wallpaper_image, std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
const base::FilePath& customized_default_wallpaper_file_large, const base::FilePath& customized_default_wallpaper_file_large,
...@@ -656,18 +577,6 @@ class WallpaperManager : public content::NotificationObserver, ...@@ -656,18 +577,6 @@ class WallpaperManager : public content::NotificationObserver,
// last N wallpaper loads times. // last N wallpaper loads times.
base::circular_deque<base::TimeDelta> last_load_times_; base::circular_deque<base::TimeDelta> last_load_times_;
base::FilePath default_small_wallpaper_file_;
base::FilePath default_large_wallpaper_file_;
base::FilePath guest_small_wallpaper_file_;
base::FilePath guest_large_wallpaper_file_;
base::FilePath child_small_wallpaper_file_;
base::FilePath child_large_wallpaper_file_;
// Current decoded default image is stored in cache.
std::unique_ptr<user_manager::UserImage> default_wallpaper_image_;
bool retry_download_if_failed_ = true; bool retry_download_if_failed_ = true;
// Pointer to last inactive (waiting) entry of 'loading_' list. // Pointer to last inactive (waiting) entry of 'loading_' list.
......
...@@ -6,19 +6,15 @@ ...@@ -6,19 +6,15 @@
#include <stddef.h> #include <stddef.h>
#include "base/command_line.h" #include "ash/shell.h"
#include "base/files/file_path.h" #include "ash/wallpaper/wallpaper_controller.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
#include "chromeos/chromeos_switches.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -65,33 +61,11 @@ class TestWallpaperObserverPendingListEmpty ...@@ -65,33 +61,11 @@ class TestWallpaperObserverPendingListEmpty
namespace wallpaper_manager_test_utils { namespace wallpaper_manager_test_utils {
const SkColor kLargeDefaultWallpaperColor = SK_ColorRED; const SkColor kLargeCustomWallpaperColor = SK_ColorDKGRAY;
const SkColor kSmallDefaultWallpaperColor = SK_ColorGREEN; const SkColor kSmallCustomWallpaperColor = SK_ColorLTGRAY;
const SkColor kLargeGuestWallpaperColor = SK_ColorBLUE;
const SkColor kSmallGuestWallpaperColor = SK_ColorYELLOW;
const SkColor kLargeChildWallpaperColor = SK_ColorCYAN;
const SkColor kSmallChildWallpaperColor = SK_ColorMAGENTA;
const SkColor kCustomWallpaperColor = SK_ColorMAGENTA;
const int kWallpaperSize = 2; const int kWallpaperSize = 2;
bool CreateJPEGImage(int width,
int height,
SkColor color,
std::vector<unsigned char>* output) {
SkBitmap bitmap;
bitmap.allocN32Pixels(width, height);
bitmap.eraseColor(color);
constexpr int kQuality = 80;
if (!gfx::JPEGCodec::Encode(bitmap, kQuality, output)) {
LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap";
return false;
}
return true;
}
gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) {
SkBitmap bitmap; SkBitmap bitmap;
bitmap.allocN32Pixels(width, height); bitmap.allocN32Pixels(width, height);
...@@ -99,25 +73,6 @@ gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { ...@@ -99,25 +73,6 @@ gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) {
return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
} }
bool WriteJPEGFile(const base::FilePath& path,
int width,
int height,
SkColor color) {
base::ScopedAllowBlockingForTesting allow_blocking;
std::vector<unsigned char> output;
if (!CreateJPEGImage(width, height, color, &output))
return false;
size_t bytes_written = base::WriteFile(
path, reinterpret_cast<const char*>(&output[0]), output.size());
if (bytes_written != output.size()) {
LOG(ERROR) << "Wrote " << bytes_written << " byte(s) instead of "
<< output.size() << " to " << path.value();
return false;
}
return true;
}
bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color) { bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color) {
if (image.size().IsEmpty()) { if (image.size().IsEmpty()) {
LOG(ERROR) << "Image is empty"; LOG(ERROR) << "Image is empty";
...@@ -155,62 +110,6 @@ void WaitAsyncWallpaperLoadFinished() { ...@@ -155,62 +110,6 @@ void WaitAsyncWallpaperLoadFinished() {
observer.WaitForPendingListEmpty(); observer.WaitForPendingListEmpty();
} }
void CreateCmdlineWallpapers(const base::ScopedTempDir& dir,
std::unique_ptr<base::CommandLine>* command_line) {
std::vector<std::string> options;
options.push_back(std::string("WM_Test_cmdline"));
const base::FilePath small_file =
dir.GetPath().Append(FILE_PATH_LITERAL("small.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kDefaultWallpaperSmall + "=" +
small_file.value());
const base::FilePath large_file =
dir.GetPath().Append(FILE_PATH_LITERAL("large.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kDefaultWallpaperLarge + "=" +
large_file.value());
const base::FilePath guest_small_file =
dir.GetPath().Append(FILE_PATH_LITERAL("guest_small.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kGuestWallpaperSmall + "=" +
guest_small_file.value());
const base::FilePath guest_large_file =
dir.GetPath().Append(FILE_PATH_LITERAL("guest_large.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kGuestWallpaperLarge + "=" +
guest_large_file.value());
const base::FilePath child_small_file =
dir.GetPath().Append(FILE_PATH_LITERAL("child_small.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kChildWallpaperSmall + "=" +
child_small_file.value());
const base::FilePath child_large_file =
dir.GetPath().Append(FILE_PATH_LITERAL("child_large.jpg"));
options.push_back(std::string("--") +
chromeos::switches::kChildWallpaperLarge + "=" +
child_large_file.value());
ASSERT_TRUE(WriteJPEGFile(small_file, kWallpaperSize, kWallpaperSize,
kSmallDefaultWallpaperColor));
ASSERT_TRUE(WriteJPEGFile(large_file, kWallpaperSize, kWallpaperSize,
kLargeDefaultWallpaperColor));
ASSERT_TRUE(WriteJPEGFile(guest_small_file, kWallpaperSize, kWallpaperSize,
kSmallGuestWallpaperColor));
ASSERT_TRUE(WriteJPEGFile(guest_large_file, kWallpaperSize, kWallpaperSize,
kLargeGuestWallpaperColor));
ASSERT_TRUE(WriteJPEGFile(child_small_file, kWallpaperSize, kWallpaperSize,
kSmallChildWallpaperColor));
ASSERT_TRUE(WriteJPEGFile(child_large_file, kWallpaperSize, kWallpaperSize,
kLargeChildWallpaperColor));
command_line->reset(new base::CommandLine(options));
WallpaperManager::Get()->SetCommandLineForTesting(command_line->get());
}
} // namespace wallpaper_manager_test_utils } // namespace wallpaper_manager_test_utils
} // namespace chromeos } // namespace chromeos
...@@ -10,50 +10,21 @@ ...@@ -10,50 +10,21 @@
#include "ash/ash_constants.h" #include "ash/ash_constants.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
namespace base {
class CommandLine;
class FilePath;
class ScopedTempDir;
} // namespace base
namespace chromeos { namespace chromeos {
namespace wallpaper_manager_test_utils { namespace wallpaper_manager_test_utils {
// Colors used for different default wallpapers by CreateCmdlineWallpapers(). // Custom wallpaper colors.
extern const SkColor kLargeDefaultWallpaperColor; extern const SkColor kLargeCustomWallpaperColor;
extern const SkColor kSmallDefaultWallpaperColor; extern const SkColor kSmallCustomWallpaperColor;
extern const SkColor kLargeGuestWallpaperColor;
extern const SkColor kSmallGuestWallpaperColor;
extern const SkColor kLargeChildWallpaperColor;
extern const SkColor kSmallChildWallpaperColor;
// A custom color, specifically chosen to not
// conflict with any of the default wallpaper colors.
extern const SkColor kCustomWallpaperColor;
// Dimension used for width and height of default wallpaper images. A // Dimension used for width and height of default wallpaper images. A
// small value is used to minimize the amount of time spent compressing // small value is used to minimize the amount of time spent compressing
// and writing images. // and writing images.
extern const int kWallpaperSize; extern const int kWallpaperSize;
// Creates compressed JPEG image of solid color.
// Result bytes are written to |output|.
// Returns true if gfx::JPEGCodec::Encode() succeeds.
bool CreateJPEGImage(int width,
int height,
SkColor color,
std::vector<unsigned char>* output);
// Creates a test image of given size. // Creates a test image of given size.
gfx::ImageSkia CreateTestImage(int width, int height, SkColor color); gfx::ImageSkia CreateTestImage(int width, int height, SkColor color);
// Writes a JPEG image of the specified size and color to |path|. Returns
// true on success.
bool WriteJPEGFile(const base::FilePath& path,
int width,
int height,
SkColor color);
// Returns true if the color at the center of |image| is close to // Returns true if the color at the center of |image| is close to
// |expected_color|. (The center is used so small wallpaper images can be // |expected_color|. (The center is used so small wallpaper images can be
// used.) // used.)
...@@ -63,13 +34,6 @@ bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color); ...@@ -63,13 +34,6 @@ bool ImageIsNearColor(gfx::ImageSkia image, SkColor expected_color);
// a stable state. // a stable state.
void WaitAsyncWallpaperLoadFinished(); void WaitAsyncWallpaperLoadFinished();
// Initializes default wallpaper paths "*default_*file" and writes JPEG
// wallpaper images to them.
// Only needs to be called (once) by tests that want to test loading of
// default wallpapers.
void CreateCmdlineWallpapers(const base::ScopedTempDir& dir,
std::unique_ptr<base::CommandLine>* command_line);
} // namespace wallpaper_manager_test_utils } // namespace wallpaper_manager_test_utils
} // namespace chromeos } // namespace chromeos
......
...@@ -49,8 +49,9 @@ void TestWallpaperController::SetOnlineWallpaper( ...@@ -49,8 +49,9 @@ void TestWallpaperController::SetOnlineWallpaper(
void TestWallpaperController::SetDefaultWallpaper( void TestWallpaperController::SetDefaultWallpaper(
ash::mojom::WallpaperUserInfoPtr user_info, ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
bool show_wallpaper) { bool show_wallpaper) {
NOTIMPLEMENTED(); set_default_wallpaper_count_++;
} }
void TestWallpaperController::SetCustomizedDefaultWallpaper( void TestWallpaperController::SetCustomizedDefaultWallpaper(
......
...@@ -19,10 +19,13 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -19,10 +19,13 @@ class TestWallpaperController : ash::mojom::WallpaperController {
~TestWallpaperController() override; ~TestWallpaperController() override;
void ClearCounts(); void ClearCounts();
bool was_client_set() const { return was_client_set_; } bool was_client_set() const { return was_client_set_; }
int remove_user_wallpaper_count() const {
int remove_user_wallpaper_count() { return remove_user_wallpaper_count_; } return remove_user_wallpaper_count_;
}
int set_default_wallpaper_count() const {
return set_default_wallpaper_count_;
}
// Returns a mojo interface pointer bound to this object. // Returns a mojo interface pointer bound to this object.
ash::mojom::WallpaperControllerPtr CreateInterfacePtr(); ash::mojom::WallpaperControllerPtr CreateInterfacePtr();
...@@ -46,6 +49,7 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -46,6 +49,7 @@ class TestWallpaperController : ash::mojom::WallpaperController {
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
bool show_wallpaper) override; bool show_wallpaper) override;
void SetDefaultWallpaper(ash::mojom::WallpaperUserInfoPtr user_info, void SetDefaultWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
bool show_wallpaper) override; bool show_wallpaper) override;
void SetCustomizedDefaultWallpaper( void SetCustomizedDefaultWallpaper(
const GURL& wallpaper_url, const GURL& wallpaper_url,
...@@ -65,8 +69,8 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -65,8 +69,8 @@ class TestWallpaperController : ash::mojom::WallpaperController {
mojo::Binding<ash::mojom::WallpaperController> binding_; mojo::Binding<ash::mojom::WallpaperController> binding_;
bool was_client_set_ = false; bool was_client_set_ = false;
int remove_user_wallpaper_count_ = 0; int remove_user_wallpaper_count_ = 0;
int set_default_wallpaper_count_ = 0;
DISALLOW_COPY_AND_ASSIGN(TestWallpaperController); DISALLOW_COPY_AND_ASSIGN(TestWallpaperController);
}; };
......
...@@ -178,8 +178,8 @@ void WallpaperControllerClient::SetDefaultWallpaper(const AccountId& account_id, ...@@ -178,8 +178,8 @@ void WallpaperControllerClient::SetDefaultWallpaper(const AccountId& account_id,
AccountIdToWallpaperUserInfo(account_id); AccountIdToWallpaperUserInfo(account_id);
if (!user_info) if (!user_info)
return; return;
wallpaper_controller_->SetDefaultWallpaper(std::move(user_info), wallpaper_controller_->SetDefaultWallpaper(
show_wallpaper); std::move(user_info), GetFilesId(account_id).id(), show_wallpaper);
} }
void WallpaperControllerClient::SetCustomizedDefaultWallpaper( void WallpaperControllerClient::SetCustomizedDefaultWallpaper(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment