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

wallpaper refactoring: Reimplement SetPolicyWallpaper

A few differences with the current implementation:

1) Currently there're both |WallpaperManager::OnPolicySet| and
   |OnPolicyFetched|. |OnPolicySet| merely labels the wallpaper
   as POLICY type to prevent potential wallpaper changes. This results
   in a temporary inconsistency between the actual wallpaper and its
   type. In this version this method is deleted. (ie, if policy fetch
   never succeeds, WallpaperController won't know about the policy.)

2) Currently |OnPolicyCleared| only sets the type back to DEFAULT
   without deleting the policy wallpaper file. This doesn't result in
   visible bugs, but it's better to delete the files and explicitly
   calls SetDefaultWallpaper for this user.

3) The existing tests in wallpaper_manager_policy_browsertest.cc stay
   unchanged in this CL. But they may be moved to a different place
   later.

Test: Verified on Admin console, no conflict with device policy.
Bug: 779221, 800182
Change-Id: Ibb3fa38ddc19b095bfd684fe2fa6e500d7a580b4
Reviewed-on: https://chromium-review.googlesource.com/845262Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531301}
parent 07bce4a6
...@@ -81,13 +81,12 @@ interface WallpaperController { ...@@ -81,13 +81,12 @@ interface WallpaperController {
mojo.common.mojom.FilePath chromeos_custom_wallpapers_path, mojo.common.mojom.FilePath chromeos_custom_wallpapers_path,
bool is_device_wallpaper_policy_enforced); bool is_device_wallpaper_policy_enforced);
// Sets wallpaper from policy or from a local file. Saves the custom wallpaper // Sets wallpaper from a local file. Saves the custom wallpaper to file, posts
// to file, posts task to generate thumbnail and updates local state. // 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 file id for user_info.account_id. // |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.
// |image|: The wallpaper image. // |image|: The wallpaper image.
// |show_wallpaper|: If false, don't show the new wallpaper now but only // |show_wallpaper|: If false, don't show the new wallpaper now but only
// update cache. // update cache.
...@@ -95,7 +94,6 @@ interface WallpaperController { ...@@ -95,7 +94,6 @@ interface WallpaperController {
string wallpaper_files_id, string wallpaper_files_id,
string file_name, string file_name,
WallpaperLayout layout, WallpaperLayout layout,
WallpaperType type,
skia.mojom.Bitmap image, skia.mojom.Bitmap image,
bool show_wallpaper); bool show_wallpaper);
...@@ -134,6 +132,17 @@ interface WallpaperController { ...@@ -134,6 +132,17 @@ interface WallpaperController {
mojo.common.mojom.FilePath file_path, mojo.common.mojom.FilePath file_path,
mojo.common.mojom.FilePath resized_directory); mojo.common.mojom.FilePath resized_directory);
// Sets wallpaper from policy. If the user has logged in, show the policy
// wallpaper immediately, otherwise, the policy wallpaper will be shown the
// next time |ShowUserWallpaper| is called. Note: it is different from device
// policy.
// |user_info|: The user's information related to wallpaper.
// |wallpaper_files_id|: The file id for user_info.account_id.
// |data|: The data used to decode the image.
SetPolicyWallpaper(WallpaperUserInfo user_info,
string wallpaper_files_id,
string data);
// Sets whether device wallpaper policy is enforced on this device. Updates/ // Sets whether device wallpaper policy is enforced on this device. Updates/
// clears the device policy controlled wallpaper if applicable. // clears the device policy controlled wallpaper if applicable.
SetDeviceWallpaperPolicyEnforced(bool enforced); SetDeviceWallpaperPolicyEnforced(bool enforced);
...@@ -161,6 +170,15 @@ interface WallpaperController { ...@@ -161,6 +170,15 @@ interface WallpaperController {
// |wallpaper_files_id|: The file id for user_info.account_id. // |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);
// Removes all of the user's saved wallpapers and related info if the
// wallpaper was set by |SetPolicyWallpaper|. In addition, sets the user's
// wallpaper to be the default. If the user has logged in, show the default
// wallpaper immediately, otherwise, the default wallpaper will be shown the
// next time |ShowUserWallpaper| is called.
// |user_info|: The user's information related to wallpaper.
// |wallpaper_files_id|: The file id for user_info.account_id.
RemovePolicyWallpaper(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
// after WallpaperManager is removed. // after WallpaperManager is removed.
// //
......
...@@ -72,6 +72,9 @@ const char kNewWallpaperTypeNodeName[] = "type"; ...@@ -72,6 +72,9 @@ const char kNewWallpaperTypeNodeName[] = "type";
const char kDeviceWallpaperDir[] = "device_wallpaper"; const char kDeviceWallpaperDir[] = "device_wallpaper";
const char kDeviceWallpaperFile[] = "device_wallpaper_image.jpg"; const char kDeviceWallpaperFile[] = "device_wallpaper_image.jpg";
// The file name of the policy wallpaper.
const char kPolicyWallpaperFile[] = "policy-controlled.jpeg";
// How long to wait reloading the wallpaper after the display size has changed. // How long to wait reloading the wallpaper after the display size has changed.
constexpr int kWallpaperReloadDelayMs = 100; constexpr int kWallpaperReloadDelayMs = 100;
...@@ -179,6 +182,21 @@ ColorProfileType GetColorProfileType(ColorProfile color_profile) { ...@@ -179,6 +182,21 @@ ColorProfileType GetColorProfileType(ColorProfile color_profile) {
return ColorProfileType::DARK_MUTED; return ColorProfileType::DARK_MUTED;
} }
// If |read_is_successful| is true, start decoding the image, which will run
// |callback| upon completion; if it's false, run |callback| directly with an
// empty image.
void OnWallpaperDataRead(LoadedCallback callback,
std::unique_ptr<std::string> data,
bool read_is_successful) {
if (!read_is_successful) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), base::Passed(gfx::ImageSkia())));
} else {
DecodeWallpaper(*data, std::move(callback));
}
}
// Deletes a list of wallpaper files in |file_list|. // Deletes a list of wallpaper files in |file_list|.
void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list) { void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list) {
for (const base::FilePath& path : file_list) { for (const base::FilePath& path : file_list) {
...@@ -524,21 +542,6 @@ void WallpaperController::SetWallpaperFromPath( ...@@ -524,21 +542,6 @@ void WallpaperController::SetWallpaperFromPath(
} }
} }
// static
void WallpaperController::DecodeWallpaperIfApplicable(
LoadedCallback callback,
std::unique_ptr<std::string> data,
bool data_is_ready) {
// The connector for the mojo service manager is null in unit tests.
if (!data_is_ready || !Shell::Get()->shell_delegate()->GetShellConnector()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), base::Passed(gfx::ImageSkia())));
} else {
DecodeWallpaper(std::move(data), std::move(callback));
}
}
// static // static
gfx::ImageSkia WallpaperController::CreateSolidColorWallpaper() { gfx::ImageSkia WallpaperController::CreateSolidColorWallpaper() {
SkBitmap bitmap; SkBitmap bitmap;
...@@ -722,6 +725,7 @@ void WallpaperController::SetCustomizedDefaultWallpaperPaths( ...@@ -722,6 +725,7 @@ void WallpaperController::SetCustomizedDefaultWallpaperPaths(
void WallpaperController::SetWallpaperImage(const gfx::ImageSkia& image, void WallpaperController::SetWallpaperImage(const gfx::ImageSkia& image,
const WallpaperInfo& info) { const WallpaperInfo& info) {
wallpaper::WallpaperLayout layout = info.layout; wallpaper::WallpaperLayout layout = info.layout;
VLOG(1) << "SetWallpaper: image_id=" VLOG(1) << "SetWallpaper: image_id="
<< wallpaper::WallpaperResizer::GetImageId(image) << wallpaper::WallpaperResizer::GetImageId(image)
<< " layout=" << layout; << " layout=" << layout;
...@@ -893,11 +897,15 @@ void WallpaperController::ReadAndDecodeWallpaper( ...@@ -893,11 +897,15 @@ void WallpaperController::ReadAndDecodeWallpaper(
scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<base::SequencedTaskRunner> task_runner,
const base::FilePath& file_path) { const base::FilePath& file_path) {
decode_requests_for_testing_.push_back(file_path); decode_requests_for_testing_.push_back(file_path);
if (bypass_decode_for_testing_) {
std::move(callback).Run(CreateSolidColorWallpaper());
return;
}
std::string* data = new std::string; std::string* data = new std::string;
base::PostTaskAndReplyWithResult( base::PostTaskAndReplyWithResult(
task_runner.get(), FROM_HERE, task_runner.get(), FROM_HERE,
base::Bind(&base::ReadFileToString, file_path, data), base::Bind(&base::ReadFileToString, file_path, data),
base::Bind(&DecodeWallpaperIfApplicable, std::move(callback), base::Bind(&OnWallpaperDataRead, callback,
base::Passed(base::WrapUnique(data)))); base::Passed(base::WrapUnique(data))));
} }
...@@ -1031,7 +1039,7 @@ void WallpaperController::SetArcWallpaper( ...@@ -1031,7 +1039,7 @@ void WallpaperController::SetArcWallpaper(
// |has_gaia_account| is unused. // |has_gaia_account| is unused.
user_info->has_gaia_account = true; user_info->has_gaia_account = true;
SaveAndSetWallpaper(std::move(user_info), wallpaper_files_id, file_name, SaveAndSetWallpaper(std::move(user_info), wallpaper_files_id, file_name,
image, wallpaper::CUSTOMIZED, layout, show_wallpaper); wallpaper::CUSTOMIZED, layout, show_wallpaper, image);
} }
bool WallpaperController::GetWallpaperFromCache(const AccountId& account_id, bool WallpaperController::GetWallpaperFromCache(const AccountId& account_id,
...@@ -1073,22 +1081,13 @@ void WallpaperController::SetCustomWallpaper( ...@@ -1073,22 +1081,13 @@ void WallpaperController::SetCustomWallpaper(
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const SkBitmap& image, const SkBitmap& image,
bool show_wallpaper) { bool show_wallpaper) {
// TODO(crbug.com/776464): Currently |SetCustomWallpaper| is used by both if (!CanSetUserWallpaper(user_info->account_id, !user_info->is_ephemeral))
// CUSTOMIZED and POLICY types, but it's better to separate them: a new
// |SetPolicyWallpaper| will be created so that the type parameter can be
// removed, and only a single |CanSetUserWallpaper| check is needed here.
if ((type != wallpaper::POLICY &&
IsPolicyControlled(user_info->account_id, !user_info->is_ephemeral)) ||
IsInKioskMode()) {
return; return;
}
SaveAndSetWallpaper(std::move(user_info), wallpaper_files_id, file_name, SaveAndSetWallpaper(std::move(user_info), wallpaper_files_id, file_name,
gfx::ImageSkia::CreateFrom1xBitmap(image), type, layout, wallpaper::CUSTOMIZED, layout, show_wallpaper,
show_wallpaper); gfx::ImageSkia::CreateFrom1xBitmap(image));
} }
void WallpaperController::SetOnlineWallpaper( void WallpaperController::SetOnlineWallpaper(
...@@ -1147,6 +1146,29 @@ void WallpaperController::SetCustomizedDefaultWallpaper( ...@@ -1147,6 +1146,29 @@ void WallpaperController::SetCustomizedDefaultWallpaper(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void WallpaperController::SetPolicyWallpaper(
mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
const std::string& data) {
// There is no visible wallpaper in kiosk mode.
if (IsInKioskMode())
return;
// Updates the screen only when the user has logged in.
const bool show_wallpaper =
Shell::Get()->session_controller()->IsActiveUserSessionStarted();
LoadedCallback callback =
base::Bind(&WallpaperController::SaveAndSetWallpaper,
weak_factory_.GetWeakPtr(), base::Passed(&user_info),
wallpaper_files_id, kPolicyWallpaperFile, wallpaper::POLICY,
wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, show_wallpaper);
if (bypass_decode_for_testing_)
std::move(callback).Run(CreateSolidColorWallpaper());
else
DecodeWallpaper(data, std::move(callback));
}
void WallpaperController::SetDeviceWallpaperPolicyEnforced(bool enforced) { void WallpaperController::SetDeviceWallpaperPolicyEnforced(bool enforced) {
bool previous_enforced = is_device_wallpaper_policy_enforced_; bool previous_enforced = is_device_wallpaper_policy_enforced_;
is_device_wallpaper_policy_enforced_ = enforced; is_device_wallpaper_policy_enforced_ = enforced;
...@@ -1285,6 +1307,19 @@ void WallpaperController::RemoveUserWallpaper( ...@@ -1285,6 +1307,19 @@ void WallpaperController::RemoveUserWallpaper(
RemoveUserWallpaperImpl(user_info->account_id, wallpaper_files_id); RemoveUserWallpaperImpl(user_info->account_id, wallpaper_files_id);
} }
void WallpaperController::RemovePolicyWallpaper(
mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) {
DCHECK(IsPolicyControlled(user_info->account_id, !user_info->is_ephemeral));
// Updates the screen only when the user has logged in.
const bool show_wallpaper =
Shell::Get()->session_controller()->IsActiveUserSessionStarted();
// Removes the wallpaper info so that the user is no longer policy controlled,
// otherwise setting default wallpaper is not allowed.
RemoveUserWallpaperInfo(user_info->account_id, !user_info->is_ephemeral);
SetDefaultWallpaper(std::move(user_info), wallpaper_files_id, show_wallpaper);
}
void WallpaperController::SetWallpaper(const SkBitmap& wallpaper, void WallpaperController::SetWallpaper(const SkBitmap& wallpaper,
const WallpaperInfo& info) { const WallpaperInfo& info) {
if (wallpaper.isNull()) if (wallpaper.isNull())
...@@ -1563,7 +1598,7 @@ void WallpaperController::OnDefaultWallpaperDecoded( ...@@ -1563,7 +1598,7 @@ void WallpaperController::OnDefaultWallpaperDecoded(
} }
if (show_wallpaper) { if (show_wallpaper) {
// 1x1 wallpaper is actually solid color, so it should be stretched. // 1x1 wallpaper should be stretched.
if (cached_default_wallpaper_.image.width() == 1 && if (cached_default_wallpaper_.image.width() == 1 &&
cached_default_wallpaper_.image.height() == 1) { cached_default_wallpaper_.image.height() == 1) {
layout = wallpaper::WALLPAPER_LAYOUT_STRETCH; layout = wallpaper::WALLPAPER_LAYOUT_STRETCH;
...@@ -1578,14 +1613,15 @@ void WallpaperController::SaveAndSetWallpaper( ...@@ -1578,14 +1613,15 @@ void WallpaperController::SaveAndSetWallpaper(
mojom::WallpaperUserInfoPtr user_info, mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
const gfx::ImageSkia& image,
wallpaper::WallpaperType type, wallpaper::WallpaperType type,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
bool show_wallpaper) { bool show_wallpaper,
// Empty image indicates decode failure. Use default wallpaper in this case. const gfx::ImageSkia& image) {
// If the image of the new wallpaper is empty, the current wallpaper is still
// kept instead of reverting to the default.
if (image.isNull()) { if (image.isNull()) {
SetDefaultWallpaperImpl(user_info->account_id, user_info->type, LOG(ERROR) << "The wallpaper image is empty due to a decoding failure, or "
show_wallpaper); "the client provided an empty image.";
return; return;
} }
......
...@@ -182,16 +182,6 @@ class ASH_EXPORT WallpaperController ...@@ -182,16 +182,6 @@ class ASH_EXPORT WallpaperController
const scoped_refptr<base::SingleThreadTaskRunner>& reply_task_runner, const scoped_refptr<base::SingleThreadTaskRunner>& reply_task_runner,
base::WeakPtr<WallpaperController> weak_ptr); base::WeakPtr<WallpaperController> weak_ptr);
// If |data_is_ready| is true, start decoding the image, which will run
// |callback| upon completion; if it's false, run |callback| immediately with
// an empty image.
// TODO(crbug.com/776464): Mash and some unit tests can't use this decoder
// because it depends on the Shell instance. Make it work after all the
// decoding code is moved to //ash.
static void DecodeWallpaperIfApplicable(LoadedCallback callback,
std::unique_ptr<std::string> data,
bool data_is_ready);
// Creates a 1x1 solid color image to be used as the backup default wallpaper. // Creates a 1x1 solid color image to be used as the backup default wallpaper.
static gfx::ImageSkia CreateSolidColorWallpaper(); static gfx::ImageSkia CreateSolidColorWallpaper();
...@@ -306,8 +296,8 @@ class ASH_EXPORT WallpaperController ...@@ -306,8 +296,8 @@ class ASH_EXPORT WallpaperController
bool compare_layouts, bool compare_layouts,
wallpaper::WallpaperLayout layout) const; wallpaper::WallpaperLayout layout) const;
// Reads image from |file_path| on disk, and calls // Reads image from |file_path| on disk, and calls |OnWallpaperDataRead|
// |DecodeWallpaperIfApplicable| with the result of |ReadFileToString|. // with the result of |ReadFileToString|.
void ReadAndDecodeWallpaper( void ReadAndDecodeWallpaper(
LoadedCallback callback, LoadedCallback callback,
scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<base::SequencedTaskRunner> task_runner,
...@@ -380,7 +370,6 @@ class ASH_EXPORT WallpaperController ...@@ -380,7 +370,6 @@ class ASH_EXPORT WallpaperController
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const SkBitmap& image, const SkBitmap& image,
bool show_wallpaper) override; bool show_wallpaper) override;
void SetOnlineWallpaper(mojom::WallpaperUserInfoPtr user_info, void SetOnlineWallpaper(mojom::WallpaperUserInfoPtr user_info,
...@@ -395,6 +384,9 @@ class ASH_EXPORT WallpaperController ...@@ -395,6 +384,9 @@ class ASH_EXPORT WallpaperController
const GURL& wallpaper_url, const GURL& wallpaper_url,
const base::FilePath& file_path, const base::FilePath& file_path,
const base::FilePath& resized_directory) override; const base::FilePath& resized_directory) override;
void SetPolicyWallpaper(mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
const std::string& data) override;
void SetDeviceWallpaperPolicyEnforced(bool enforced) override; void SetDeviceWallpaperPolicyEnforced(bool enforced) override;
void UpdateCustomWallpaperLayout(mojom::WallpaperUserInfoPtr user_info, void UpdateCustomWallpaperLayout(mojom::WallpaperUserInfoPtr user_info,
wallpaper::WallpaperLayout layout) override; wallpaper::WallpaperLayout layout) override;
...@@ -406,6 +398,8 @@ class ASH_EXPORT WallpaperController ...@@ -406,6 +398,8 @@ class ASH_EXPORT WallpaperController
void ShowSigninWallpaper() override; void ShowSigninWallpaper() override;
void RemoveUserWallpaper(mojom::WallpaperUserInfoPtr user_info, void RemoveUserWallpaper(mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override; const std::string& wallpaper_files_id) override;
void RemovePolicyWallpaper(mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override;
void SetWallpaper(const SkBitmap& wallpaper, void SetWallpaper(const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) override; const wallpaper::WallpaperInfo& wallpaper_info) override;
void AddObserver(mojom::WallpaperObserverAssociatedPtrInfo observer) override; void AddObserver(mojom::WallpaperObserverAssociatedPtrInfo observer) override;
...@@ -486,10 +480,10 @@ class ASH_EXPORT WallpaperController ...@@ -486,10 +480,10 @@ class ASH_EXPORT WallpaperController
void SaveAndSetWallpaper(mojom::WallpaperUserInfoPtr user_info, void SaveAndSetWallpaper(mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
const gfx::ImageSkia& image,
wallpaper::WallpaperType type, wallpaper::WallpaperType type,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
bool show_wallpaper); bool show_wallpaper,
const gfx::ImageSkia& image);
// A wrapper of |ReadAndDecodeWallpaper| used in |SetWallpaperFromPath|. // A wrapper of |ReadAndDecodeWallpaper| used in |SetWallpaperFromPath|.
void StartDecodeFromPath(const AccountId& account_id, void StartDecodeFromPath(const AccountId& account_id,
...@@ -622,6 +616,9 @@ class ASH_EXPORT WallpaperController ...@@ -622,6 +616,9 @@ class ASH_EXPORT WallpaperController
std::unique_ptr<ui::CompositorLock> compositor_lock_; std::unique_ptr<ui::CompositorLock> compositor_lock_;
// If true, use a solid color wallpaper as if it is the decoded image.
bool bypass_decode_for_testing_ = false;
// Tracks how many wallpapers have been set. // Tracks how many wallpapers have been set.
int wallpaper_count_for_testing_ = 0; int wallpaper_count_for_testing_ = 0;
......
...@@ -465,6 +465,8 @@ class WallpaperControllerTest : public AshTestBase { ...@@ -465,6 +465,8 @@ class WallpaperControllerTest : public AshTestBase {
int GetWallpaperCount() { return controller_->wallpaper_count_for_testing_; } int GetWallpaperCount() { return controller_->wallpaper_count_for_testing_; }
void SetBypassDecode() { controller_->bypass_decode_for_testing_ = true; }
void ClearWallpaperCount() { controller_->wallpaper_count_for_testing_ = 0; } void ClearWallpaperCount() { controller_->wallpaper_count_for_testing_ = 0; }
void ClearDecodeFilePaths() { void ClearDecodeFilePaths() {
...@@ -829,14 +831,13 @@ TEST_F(WallpaperControllerTest, MojoWallpaperObserverTest) { ...@@ -829,14 +831,13 @@ TEST_F(WallpaperControllerTest, MojoWallpaperObserverTest) {
TEST_F(WallpaperControllerTest, SetCustomWallpaper) { TEST_F(WallpaperControllerTest, SetCustomWallpaper) {
gfx::ImageSkia image = CreateImage(640, 480, kWallpaperColor); gfx::ImageSkia image = CreateImage(640, 480, kWallpaperColor);
WallpaperLayout layout = WALLPAPER_LAYOUT_CENTER; WallpaperLayout layout = WALLPAPER_LAYOUT_CENTER;
wallpaper::WallpaperType type = wallpaper::CUSTOMIZED;
SimulateUserLogin(user_1); SimulateUserLogin(user_1);
// Verify the wallpaper is set successfully and wallpaper info is updated. // Verify the wallpaper is set successfully and wallpaper info is updated.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(InitializeUser(account_id_1),
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, layout, wallpaper_files_id_1, file_name_1, layout,
type, *image.bitmap(), true /*show_wallpaper=*/); *image.bitmap(), true /*show_wallpaper=*/);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_EQ(1, GetWallpaperCount()); EXPECT_EQ(1, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::CUSTOMIZED); EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::CUSTOMIZED);
...@@ -845,14 +846,14 @@ TEST_F(WallpaperControllerTest, SetCustomWallpaper) { ...@@ -845,14 +846,14 @@ TEST_F(WallpaperControllerTest, SetCustomWallpaper) {
true /* is_persistent */)); true /* is_persistent */));
wallpaper::WallpaperInfo expected_wallpaper_info( wallpaper::WallpaperInfo expected_wallpaper_info(
base::FilePath(wallpaper_files_id_1).Append(file_name_1).value(), layout, base::FilePath(wallpaper_files_id_1).Append(file_name_1).value(), layout,
type, base::Time::Now().LocalMidnight()); wallpaper::CUSTOMIZED, base::Time::Now().LocalMidnight());
EXPECT_EQ(wallpaper_info, expected_wallpaper_info); EXPECT_EQ(wallpaper_info, expected_wallpaper_info);
// Verify that the wallpaper is not set when |show_wallpaper| is false, but // Verify that the wallpaper is not set when |show_wallpaper| is false, but
// wallpaper info is updated properly. // wallpaper info is updated properly.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(InitializeUser(account_id_1),
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, layout, wallpaper_files_id_1, file_name_1, layout,
type, *image.bitmap(), true /*show_wallpaper=*/); *image.bitmap(), true /*show_wallpaper=*/);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_EQ(0, GetWallpaperCount()); EXPECT_EQ(0, GetWallpaperCount());
EXPECT_TRUE(controller_->GetUserWallpaperInfo(account_id_1, &wallpaper_info, EXPECT_TRUE(controller_->GetUserWallpaperInfo(account_id_1, &wallpaper_info,
...@@ -891,6 +892,73 @@ TEST_F(WallpaperControllerTest, SetOnlineWallpaper) { ...@@ -891,6 +892,73 @@ TEST_F(WallpaperControllerTest, SetOnlineWallpaper) {
EXPECT_EQ(wallpaper_info, expected_wallpaper_info); EXPECT_EQ(wallpaper_info, expected_wallpaper_info);
} }
TEST_F(WallpaperControllerTest, SetAndRemovePolicyWallpaper) {
SetBypassDecode();
// Simulate the login screen.
ClearLogin();
// The user starts with no wallpaper info and is not controlled by policy.
wallpaper::WallpaperInfo wallpaper_info;
EXPECT_FALSE(controller_->GetUserWallpaperInfo(account_id_1, &wallpaper_info,
true /*is_persistent=*/));
EXPECT_FALSE(
controller_->IsPolicyControlled(account_id_1, true /*is_persistent=*/));
// A default wallpaper is shown for the user.
controller_->ShowUserWallpaper(InitializeUser(account_id_1));
EXPECT_EQ(1, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::DEFAULT);
// Set a policy wallpaper. Verify that the user becomes policy controlled and
// the wallpaper info is updated.
controller_->SetPolicyWallpaper(InitializeUser(account_id_1),
wallpaper_files_id_1,
std::string() /*data=*/);
RunAllTasksUntilIdle();
EXPECT_TRUE(controller_->GetUserWallpaperInfo(account_id_1, &wallpaper_info,
true /*is_persistent=*/));
wallpaper::WallpaperInfo policy_wallpaper_info(
base::FilePath(wallpaper_files_id_1)
.Append("policy-controlled.jpeg")
.value(),
wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper::POLICY,
base::Time::Now().LocalMidnight());
EXPECT_EQ(wallpaper_info, policy_wallpaper_info);
EXPECT_TRUE(
controller_->IsPolicyControlled(account_id_1, true /*is_persistent=*/));
// Verify the wallpaper is not updated since the user hasn't logged in.
EXPECT_EQ(0, GetWallpaperCount());
// Log in the user. Verify the policy wallpaper is now being shown.
SimulateUserLogin(user_1);
controller_->ShowUserWallpaper(InitializeUser(account_id_1));
EXPECT_EQ(1, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::POLICY);
// Log out the user and remove the policy wallpaper. Verify the wallpaper
// info is reset to default and the user is no longer policy controlled.
ClearLogin();
controller_->RemovePolicyWallpaper(InitializeUser(account_id_1),
wallpaper_files_id_1);
WaitUntilCustomWallpapersDeleted(account_id_1);
EXPECT_TRUE(controller_->GetUserWallpaperInfo(account_id_1, &wallpaper_info,
true /*is_persistent=*/));
wallpaper::WallpaperInfo default_wallpaper_info(
std::string(), wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED,
wallpaper::DEFAULT, base::Time::Now().LocalMidnight());
EXPECT_EQ(wallpaper_info, default_wallpaper_info);
EXPECT_FALSE(
controller_->IsPolicyControlled(account_id_1, true /*is_persistent=*/));
// Verify the wallpaper is not updated since the user hasn't logged in.
EXPECT_EQ(0, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::POLICY);
// Log in the user. Verify the default wallpaper is now being shown.
SimulateUserLogin(user_1);
controller_->ShowUserWallpaper(InitializeUser(account_id_1));
EXPECT_EQ(1, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperType(), wallpaper::DEFAULT);
}
TEST_F(WallpaperControllerTest, SetDefaultWallpaperForRegularAccount) { TEST_F(WallpaperControllerTest, SetDefaultWallpaperForRegularAccount) {
CreateDefaultWallpapers(); CreateDefaultWallpapers();
SimulateUserLogin(user_1); SimulateUserLogin(user_1);
...@@ -1064,8 +1132,7 @@ TEST_F(WallpaperControllerTest, IgnoreWallpaperRequestInKioskMode) { ...@@ -1064,8 +1132,7 @@ TEST_F(WallpaperControllerTest, IgnoreWallpaperRequestInKioskMode) {
// |account_id|'s wallpaper info is not updated. // |account_id|'s wallpaper info is not updated.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1,
WALLPAPER_LAYOUT_CENTER, wallpaper::CUSTOMIZED, *image.bitmap(), WALLPAPER_LAYOUT_CENTER, *image.bitmap(), true /*show_wallpaper=*/);
true /* show_wallpaper */);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_EQ(0, GetWallpaperCount()); EXPECT_EQ(0, GetWallpaperCount());
wallpaper::WallpaperInfo wallpaper_info; wallpaper::WallpaperInfo wallpaper_info;
...@@ -1111,8 +1178,7 @@ TEST_F(WallpaperControllerTest, IgnoreWallpaperRequestWhenPolicyIsEnforced) { ...@@ -1111,8 +1178,7 @@ TEST_F(WallpaperControllerTest, IgnoreWallpaperRequestWhenPolicyIsEnforced) {
// enforced, and |account_id|'s wallpaper info is not updated. // enforced, and |account_id|'s wallpaper info is not updated.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1,
WALLPAPER_LAYOUT_CENTER, wallpaper::CUSTOMIZED, *image.bitmap(), WALLPAPER_LAYOUT_CENTER, *image.bitmap(), true /*show_wallpaper=*/);
true /*show_wallpaper=*/);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_EQ(0, GetWallpaperCount()); EXPECT_EQ(0, GetWallpaperCount());
wallpaper::WallpaperInfo wallpaper_info; wallpaper::WallpaperInfo wallpaper_info;
...@@ -1182,8 +1248,7 @@ TEST_F(WallpaperControllerTest, VerifyWallpaperCache) { ...@@ -1182,8 +1248,7 @@ TEST_F(WallpaperControllerTest, VerifyWallpaperCache) {
// Verify |SetCustomWallpaper| updates wallpaper cache for |user1|. // Verify |SetCustomWallpaper| updates wallpaper cache for |user1|.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1,
WALLPAPER_LAYOUT_CENTER, wallpaper::CUSTOMIZED, *image.bitmap(), WALLPAPER_LAYOUT_CENTER, *image.bitmap(), true /*show_wallpaper=*/);
true /*show_wallpaper=*/);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_TRUE( EXPECT_TRUE(
controller_->GetWallpaperFromCache(account_id_1, &cached_wallpaper)); controller_->GetWallpaperFromCache(account_id_1, &cached_wallpaper));
...@@ -1302,14 +1367,13 @@ TEST_F(WallpaperControllerTest, PreventReloadingSameWallpaper) { ...@@ -1302,14 +1367,13 @@ TEST_F(WallpaperControllerTest, PreventReloadingSameWallpaper) {
TEST_F(WallpaperControllerTest, UpdateCustomWallpaperLayout) { TEST_F(WallpaperControllerTest, UpdateCustomWallpaperLayout) {
gfx::ImageSkia image = CreateImage(640, 480, kSmallCustomWallpaperColor); gfx::ImageSkia image = CreateImage(640, 480, kSmallCustomWallpaperColor);
WallpaperLayout layout = WALLPAPER_LAYOUT_CENTER; WallpaperLayout layout = WALLPAPER_LAYOUT_CENTER;
wallpaper::WallpaperType type = wallpaper::CUSTOMIZED;
SimulateUserLogin(user_1); SimulateUserLogin(user_1);
// Set a custom wallpaper for the user. Verify that it's set successfully // Set a custom wallpaper for the user. Verify that it's set successfully
// and the wallpaper info is updated. // and the wallpaper info is updated.
controller_->SetCustomWallpaper( controller_->SetCustomWallpaper(InitializeUser(account_id_1),
InitializeUser(account_id_1), wallpaper_files_id_1, file_name_1, layout, wallpaper_files_id_1, file_name_1, layout,
type, *image.bitmap(), true /*show_wallpaper=*/); *image.bitmap(), true /*show_wallpaper=*/);
RunAllTasksUntilIdle(); RunAllTasksUntilIdle();
EXPECT_EQ(1, GetWallpaperCount()); EXPECT_EQ(1, GetWallpaperCount());
EXPECT_EQ(controller_->GetWallpaperLayout(), layout); EXPECT_EQ(controller_->GetWallpaperLayout(), layout);
...@@ -1318,7 +1382,7 @@ TEST_F(WallpaperControllerTest, UpdateCustomWallpaperLayout) { ...@@ -1318,7 +1382,7 @@ TEST_F(WallpaperControllerTest, UpdateCustomWallpaperLayout) {
true /* is_persistent */)); true /* is_persistent */));
wallpaper::WallpaperInfo expected_wallpaper_info( wallpaper::WallpaperInfo expected_wallpaper_info(
base::FilePath(wallpaper_files_id_1).Append(file_name_1).value(), layout, base::FilePath(wallpaper_files_id_1).Append(file_name_1).value(), layout,
type, base::Time::Now().LocalMidnight()); wallpaper::CUSTOMIZED, base::Time::Now().LocalMidnight());
EXPECT_EQ(wallpaper_info, expected_wallpaper_info); EXPECT_EQ(wallpaper_info, expected_wallpaper_info);
// Now change to a different layout. Verify that the layout is updated for // Now change to a different layout. Verify that the layout is updated for
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "base/sequenced_task_runner.h"
#include "ipc/ipc_channel.h" #include "ipc/ipc_channel.h"
#include "services/data_decoder/public/cpp/decode_image.h" #include "services/data_decoder/public/cpp/decode_image.h"
...@@ -31,10 +30,14 @@ void ConvertToImageSkia(OnWallpaperDecoded callback, const SkBitmap& image) { ...@@ -31,10 +30,14 @@ void ConvertToImageSkia(OnWallpaperDecoded callback, const SkBitmap& image) {
} // namespace } // namespace
void DecodeWallpaper(std::unique_ptr<std::string> image_data, void DecodeWallpaper(const std::string& image_data,
OnWallpaperDecoded callback) { OnWallpaperDecoded callback) {
std::vector<uint8_t> image_bytes(image_data.get()->begin(), // The connector for the mojo service manager is null in unit tests.
image_data.get()->end()); if (!Shell::Get()->shell_delegate()->GetShellConnector()) {
std::move(callback).Run(gfx::ImageSkia());
return;
}
std::vector<uint8_t> image_bytes(image_data.begin(), image_data.end());
data_decoder::DecodeImage( data_decoder::DecodeImage(
Shell::Get()->shell_delegate()->GetShellConnector(), Shell::Get()->shell_delegate()->GetShellConnector(),
std::move(image_bytes), data_decoder::mojom::ImageCodec::ROBUST_JPEG, std::move(image_bytes), data_decoder::mojom::ImageCodec::ROBUST_JPEG,
......
...@@ -20,7 +20,7 @@ using OnWallpaperDecoded = ...@@ -20,7 +20,7 @@ using OnWallpaperDecoded =
// Do an async wallpaper decode; |on_decoded| is run on the calling thread when // Do an async wallpaper decode; |on_decoded| is run on the calling thread when
// the decode has finished. // the decode has finished.
ASH_EXPORT void DecodeWallpaper(std::unique_ptr<std::string> image_data, ASH_EXPORT void DecodeWallpaper(const std::string& image_data,
OnWallpaperDecoded callback); OnWallpaperDecoded callback);
} // namespace ash } // namespace ash
......
...@@ -158,12 +158,12 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded( ...@@ -158,12 +158,12 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded(
extensions::api::wallpaper::ToString(params_->details.layout)); extensions::api::wallpaper::ToString(params_->details.layout));
wallpaper_api_util::RecordCustomWallpaperLayout(layout); wallpaper_api_util::RecordCustomWallpaperLayout(layout);
bool update_wallpaper = bool show_wallpaper =
account_id_ == account_id_ ==
user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); user_manager::UserManager::Get()->GetActiveUser()->GetAccountId();
WallpaperControllerClient::Get()->SetCustomWallpaper( WallpaperControllerClient::Get()->SetCustomWallpaper(
account_id_, wallpaper_files_id_, params_->details.filename, layout, account_id_, wallpaper_files_id_, params_->details.filename, layout,
wallpaper::CUSTOMIZED, image, update_wallpaper); image, show_wallpaper);
unsafe_wallpaper_decoder_ = NULL; unsafe_wallpaper_decoder_ = NULL;
// Save current extension name. It will be displayed in the component // Save current extension name. It will be displayed in the component
......
...@@ -513,12 +513,12 @@ void WallpaperPrivateSetCustomWallpaperFunction::OnWallpaperDecoded( ...@@ -513,12 +513,12 @@ void WallpaperPrivateSetCustomWallpaperFunction::OnWallpaperDecoded(
wallpaper_base::ToString(params->layout)); wallpaper_base::ToString(params->layout));
wallpaper_api_util::RecordCustomWallpaperLayout(layout); wallpaper_api_util::RecordCustomWallpaperLayout(layout);
bool update_wallpaper = bool show_wallpaper =
account_id_ == account_id_ ==
user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); user_manager::UserManager::Get()->GetActiveUser()->GetAccountId();
WallpaperControllerClient::Get()->SetCustomWallpaper( WallpaperControllerClient::Get()->SetCustomWallpaper(
account_id_, wallpaper_files_id_, params->file_name, layout, account_id_, wallpaper_files_id_, params->file_name, layout, image,
wallpaper::CUSTOMIZED, image, update_wallpaper); show_wallpaper);
unsafe_wallpaper_decoder_ = NULL; unsafe_wallpaper_decoder_ = NULL;
Profile* profile = Profile::FromBrowserContext(browser_context()); Profile* profile = Profile::FromBrowserContext(browser_context());
......
...@@ -581,11 +581,9 @@ void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, ...@@ -581,11 +581,9 @@ void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy,
user_id, std::string() /* id */, AccountType::UNKNOWN); user_id, std::string() /* id */, AccountType::UNKNOWN);
if (policy == policy::key::kUserAvatarImage) if (policy == policy::key::kUserAvatarImage)
GetUserImageManager(account_id)->OnExternalDataSet(policy); GetUserImageManager(account_id)->OnExternalDataSet(policy);
else if (policy == policy::key::kWallpaperImage)
WallpaperManager::Get()->OnPolicySet(policy, account_id);
else if (policy == policy::key::kNativePrintersBulkConfiguration) else if (policy == policy::key::kNativePrintersBulkConfiguration)
GetExternalPrinters(account_id)->ClearData(); GetExternalPrinters(account_id)->ClearData();
else else if (policy != policy::key::kWallpaperImage)
NOTREACHED(); NOTREACHED();
} }
...@@ -595,10 +593,10 @@ void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, ...@@ -595,10 +593,10 @@ void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy,
user_id, std::string() /* id */, AccountType::UNKNOWN); user_id, std::string() /* id */, AccountType::UNKNOWN);
if (policy == policy::key::kUserAvatarImage) if (policy == policy::key::kUserAvatarImage)
GetUserImageManager(account_id)->OnExternalDataCleared(policy); GetUserImageManager(account_id)->OnExternalDataCleared(policy);
else if (policy == policy::key::kWallpaperImage)
WallpaperManager::Get()->OnPolicyCleared(policy, account_id);
else if (policy == policy::key::kNativePrintersBulkConfiguration) else if (policy == policy::key::kNativePrintersBulkConfiguration)
GetExternalPrinters(account_id)->ClearData(); GetExternalPrinters(account_id)->ClearData();
else if (policy == policy::key::kWallpaperImage)
WallpaperControllerClient::Get()->RemovePolicyWallpaper(account_id);
else else
NOTREACHED(); NOTREACHED();
} }
...@@ -609,16 +607,17 @@ void ChromeUserManagerImpl::OnExternalDataFetched( ...@@ -609,16 +607,17 @@ void ChromeUserManagerImpl::OnExternalDataFetched(
std::unique_ptr<std::string> data) { std::unique_ptr<std::string> data) {
const AccountId account_id = user_manager::known_user::GetAccountId( const AccountId account_id = user_manager::known_user::GetAccountId(
user_id, std::string() /* id */, AccountType::UNKNOWN); user_id, std::string() /* id */, AccountType::UNKNOWN);
if (policy == policy::key::kUserAvatarImage) if (policy == policy::key::kUserAvatarImage) {
GetUserImageManager(account_id) GetUserImageManager(account_id)
->OnExternalDataFetched(policy, std::move(data)); ->OnExternalDataFetched(policy, std::move(data));
else if (policy == policy::key::kWallpaperImage) } else if (policy == policy::key::kNativePrintersBulkConfiguration) {
WallpaperManager::Get()->OnPolicyFetched(policy, account_id,
std::move(data));
else if (policy == policy::key::kNativePrintersBulkConfiguration)
GetExternalPrinters(account_id)->SetData(std::move(data)); GetExternalPrinters(account_id)->SetData(std::move(data));
else } else if (policy == policy::key::kWallpaperImage) {
WallpaperControllerClient::Get()->SetPolicyWallpaper(account_id,
std::move(data));
} else {
NOTREACHED(); NOTREACHED();
}
} }
void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/cryptohome/system_salt_getter.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/settings/cros_settings_names.h" #include "chromeos/settings/cros_settings_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -182,6 +183,11 @@ TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) { ...@@ -182,6 +183,11 @@ TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) {
} }
TEST_F(UserManagerTest, RemoveAllExceptOwnerFromList) { TEST_F(UserManagerTest, RemoveAllExceptOwnerFromList) {
// System salt is needed to remove user wallpaper.
SystemSaltGetter::Initialize();
SystemSaltGetter::Get()->SetRawSaltForTesting(
SystemSaltGetter::RawSalt({1, 2, 3, 4, 5, 6, 7, 8}));
user_manager::UserManager::Get()->UserLoggedIn( user_manager::UserManager::Get()->UserLoggedIn(
owner_account_id_at_invalid_domain_, owner_account_id_at_invalid_domain_,
owner_account_id_at_invalid_domain_.GetUserEmail(), owner_account_id_at_invalid_domain_.GetUserEmail(),
......
...@@ -99,11 +99,6 @@ bool HasNonDeviceLocalAccounts(const user_manager::UserList& users) { ...@@ -99,11 +99,6 @@ bool HasNonDeviceLocalAccounts(const user_manager::UserList& users) {
return false; return false;
} }
// Call |closure| when HashWallpaperFilesIdStr will not assert().
void CallWhenCanGetFilesId(const base::Closure& closure) {
SystemSaltGetter::Get()->AddOnSystemSaltReady(closure);
}
// A helper to set the wallpaper image for Classic Ash and Mash. // A helper to set the wallpaper image for Classic Ash and Mash.
void SetWallpaper(const gfx::ImageSkia& image, wallpaper::WallpaperInfo info) { void SetWallpaper(const gfx::ImageSkia& image, wallpaper::WallpaperInfo info) {
if (ash_util::IsRunningInMash()) { if (ash_util::IsRunningInMash()) {
...@@ -257,19 +252,6 @@ void WallpaperManager::AddObservers() { ...@@ -257,19 +252,6 @@ void WallpaperManager::AddObservers() {
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
} }
void WallpaperManager::OnPolicyFetched(const std::string& policy,
const AccountId& account_id,
std::unique_ptr<std::string> data) {
if (!data)
return;
user_image_loader::StartWithData(
task_runner_, std::move(data), ImageDecoder::ROBUST_JPEG_CODEC,
0, // Do not crop.
base::Bind(&WallpaperManager::SetPolicyControlledWallpaper,
weak_factory_.GetWeakPtr(), account_id));
}
bool WallpaperManager::IsPolicyControlled(const AccountId& account_id) const { bool WallpaperManager::IsPolicyControlled(const AccountId& account_id) const {
if (!ash::Shell::HasInstance() || ash_util::IsRunningInMash()) { if (!ash::Shell::HasInstance() || ash_util::IsRunningInMash()) {
// Some unit tests come here without a Shell instance. // Some unit tests come here without a Shell instance.
...@@ -284,28 +266,6 @@ bool WallpaperManager::IsPolicyControlled(const AccountId& account_id) const { ...@@ -284,28 +266,6 @@ bool WallpaperManager::IsPolicyControlled(const AccountId& account_id) const {
account_id, is_persistent); account_id, is_persistent);
} }
void WallpaperManager::OnPolicySet(const std::string& policy,
const AccountId& account_id) {
WallpaperInfo info;
GetUserWallpaperInfo(account_id, &info);
info.type = wallpaper::POLICY;
SetUserWallpaperInfo(account_id, info, true /*is_persistent=*/);
}
void WallpaperManager::OnPolicyCleared(const std::string& policy,
const AccountId& account_id) {
WallpaperInfo info;
GetUserWallpaperInfo(account_id, &info);
info.type = wallpaper::DEFAULT;
SetUserWallpaperInfo(account_id, info, true /*is_persistent=*/);
// If we're at the login screen, do not change the wallpaper but defer it
// until the user logs in to the system.
if (user_manager::UserManager::Get()->IsUserLoggedIn()) {
SetDefaultWallpaperImpl(account_id, true /*show_wallpaper=*/);
}
}
void WallpaperManager::OpenWallpaperPicker() { void WallpaperManager::OpenWallpaperPicker() {
if (wallpaper_manager_util::ShouldUseAndroidWallpapersApp( if (wallpaper_manager_util::ShouldUseAndroidWallpapersApp(
ProfileHelper::Get()->GetProfileByUser( ProfileHelper::Get()->GetProfileByUser(
...@@ -465,32 +425,4 @@ void WallpaperManager::SetDefaultWallpaperImpl(const AccountId& account_id, ...@@ -465,32 +425,4 @@ void WallpaperManager::SetDefaultWallpaperImpl(const AccountId& account_id,
account_id, user->GetType(), show_wallpaper); account_id, user->GetType(), show_wallpaper);
} }
void WallpaperManager::SetPolicyControlledWallpaper(
const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image) {
if (!WallpaperControllerClient::Get()->CanGetWallpaperFilesId()) {
CallWhenCanGetFilesId(
base::Bind(&WallpaperManager::SetPolicyControlledWallpaper,
weak_factory_.GetWeakPtr(), account_id,
base::Passed(std::move(user_image))));
return;
}
const wallpaper::WallpaperFilesId wallpaper_files_id =
WallpaperControllerClient::Get()->GetFilesId(account_id);
if (!wallpaper_files_id.is_valid())
LOG(FATAL) << "Wallpaper flies id if invalid!";
// If we're at the login screen, do not change the wallpaper to the user
// policy controlled wallpaper but only update the cache. It will be later
// updated after the user logs in.
WallpaperControllerClient::Get()->SetCustomWallpaper(
account_id, wallpaper_files_id, "policy-controlled.jpeg",
wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper::POLICY,
user_image->image(),
user_manager::UserManager::Get()
->IsUserLoggedIn() /* update wallpaper */);
}
} // namespace chromeos } // namespace chromeos
...@@ -39,10 +39,6 @@ class CommandLine; ...@@ -39,10 +39,6 @@ class CommandLine;
class SequencedTaskRunner; class SequencedTaskRunner;
} // namespace base } // namespace base
namespace user_manager {
class UserImage;
} // namespace user_manager
namespace chromeos { namespace chromeos {
// Asserts that the current task is sequenced with any other task that calls // Asserts that the current task is sequenced with any other task that calls
...@@ -96,22 +92,9 @@ class WallpaperManager : public wm::ActivationChangeObserver, ...@@ -96,22 +92,9 @@ class WallpaperManager : public wm::ActivationChangeObserver,
// Adds |this| as an observer to various settings. // Adds |this| as an observer to various settings.
void AddObservers(); void AddObservers();
// Called when the policy-set wallpaper has been fetched. Initiates decoding
// of the JPEG |data| with a callback to SetPolicyControlledWallpaper().
void OnPolicyFetched(const std::string& policy,
const AccountId& account_id,
std::unique_ptr<std::string> data);
// A wrapper of |WallpaperController::IsPolicyControlled|. // A wrapper of |WallpaperController::IsPolicyControlled|.
bool IsPolicyControlled(const AccountId& account_id) const; bool IsPolicyControlled(const AccountId& account_id) const;
// Called when a wallpaper policy has been set for |account_id|. Blocks user
// from changing the wallpaper.
void OnPolicySet(const std::string& policy, const AccountId& account_id);
// Called when the wallpaper policy has been cleared for |account_id|.
void OnPolicyCleared(const std::string& policy, const AccountId& account_id);
// Opens the wallpaper picker window. // Opens the wallpaper picker window.
void OpenWallpaperPicker(); void OpenWallpaperPicker();
...@@ -154,12 +137,6 @@ class WallpaperManager : public wm::ActivationChangeObserver, ...@@ -154,12 +137,6 @@ class WallpaperManager : public wm::ActivationChangeObserver,
void SetDefaultWallpaperImpl(const AccountId& account_id, void SetDefaultWallpaperImpl(const AccountId& account_id,
bool show_wallpaper); bool show_wallpaper);
// Set wallpaper to |user_image| controlled by policy. (Takes a UserImage
// because that's the callback interface provided by UserImageLoader.)
void SetPolicyControlledWallpaper(
const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image);
// Returns the cached logged-in user wallpaper info, or a dummy value under // Returns the cached logged-in user wallpaper info, or a dummy value under
// mash. // mash.
wallpaper::WallpaperInfo* GetCachedWallpaperInfo(); wallpaper::WallpaperInfo* GetCachedWallpaperInfo();
......
...@@ -33,7 +33,6 @@ void TestWallpaperController::SetCustomWallpaper( ...@@ -33,7 +33,6 @@ void TestWallpaperController::SetCustomWallpaper(
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const SkBitmap& image, const SkBitmap& image,
bool show_wallpaper) { bool show_wallpaper) {
set_custom_wallpaper_count_++; set_custom_wallpaper_count_++;
...@@ -62,6 +61,13 @@ void TestWallpaperController::SetCustomizedDefaultWallpaper( ...@@ -62,6 +61,13 @@ void TestWallpaperController::SetCustomizedDefaultWallpaper(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void TestWallpaperController::SetPolicyWallpaper(
ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
const std::string& data) {
NOTIMPLEMENTED();
}
void TestWallpaperController::SetDeviceWallpaperPolicyEnforced(bool enforced) { void TestWallpaperController::SetDeviceWallpaperPolicyEnforced(bool enforced) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
...@@ -87,6 +93,12 @@ void TestWallpaperController::RemoveUserWallpaper( ...@@ -87,6 +93,12 @@ void TestWallpaperController::RemoveUserWallpaper(
remove_user_wallpaper_count_++; remove_user_wallpaper_count_++;
} }
void TestWallpaperController::RemovePolicyWallpaper(
ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) {
NOTIMPLEMENTED();
}
void TestWallpaperController::SetWallpaper( void TestWallpaperController::SetWallpaper(
const SkBitmap& wallpaper, const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) { const wallpaper::WallpaperInfo& wallpaper_info) {
......
...@@ -41,7 +41,6 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -41,7 +41,6 @@ class TestWallpaperController : ash::mojom::WallpaperController {
const std::string& wallpaper_files_id, const std::string& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const SkBitmap& image, const SkBitmap& image,
bool show_wallpaper) override; bool show_wallpaper) override;
void SetOnlineWallpaper(ash::mojom::WallpaperUserInfoPtr user_info, void SetOnlineWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
...@@ -56,6 +55,9 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -56,6 +55,9 @@ class TestWallpaperController : ash::mojom::WallpaperController {
const GURL& wallpaper_url, const GURL& wallpaper_url,
const base::FilePath& file_path, const base::FilePath& file_path,
const base::FilePath& resized_directory) override; const base::FilePath& resized_directory) override;
void SetPolicyWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id,
const std::string& data) override;
void SetDeviceWallpaperPolicyEnforced(bool enforced) override; void SetDeviceWallpaperPolicyEnforced(bool enforced) override;
void UpdateCustomWallpaperLayout(ash::mojom::WallpaperUserInfoPtr user_info, void UpdateCustomWallpaperLayout(ash::mojom::WallpaperUserInfoPtr user_info,
wallpaper::WallpaperLayout layout) override; wallpaper::WallpaperLayout layout) override;
...@@ -63,6 +65,8 @@ class TestWallpaperController : ash::mojom::WallpaperController { ...@@ -63,6 +65,8 @@ class TestWallpaperController : ash::mojom::WallpaperController {
void ShowSigninWallpaper() override; void ShowSigninWallpaper() override;
void RemoveUserWallpaper(ash::mojom::WallpaperUserInfoPtr user_info, void RemoveUserWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override; const std::string& wallpaper_files_id) override;
void RemovePolicyWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override;
void SetWallpaper(const SkBitmap& wallpaper, void SetWallpaper(const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) override; const wallpaper::WallpaperInfo& wallpaper_info) override;
void AddObserver( void AddObserver(
......
...@@ -84,15 +84,29 @@ wallpaper::WallpaperFilesId HashWallpaperFilesIdStr( ...@@ -84,15 +84,29 @@ wallpaper::WallpaperFilesId HashWallpaperFilesIdStr(
return wallpaper::WallpaperFilesId::FromString(result); return wallpaper::WallpaperFilesId::FromString(result);
} }
// Returns true if wallpaper files id can be returned successfully.
bool CanGetFilesId() {
return chromeos::SystemSaltGetter::IsInitialized() &&
chromeos::SystemSaltGetter::Get()->GetRawSalt();
}
// Calls |callback| when system salt is ready. (|CanGetFilesId| returns true.)
void AddCanGetFilesIdCallback(const base::Closure& callback) {
// System salt may not be initialized in tests.
if (chromeos::SystemSaltGetter::IsInitialized())
chromeos::SystemSaltGetter::Get()->AddOnSystemSaltReady(callback);
}
} // namespace } // namespace
WallpaperControllerClient::WallpaperControllerClient() WallpaperControllerClient::WallpaperControllerClient()
: policy_handler_(this), binding_(this) { : policy_handler_(this), binding_(this), weak_factory_(this) {
DCHECK(!g_wallpaper_controller_client_instance); DCHECK(!g_wallpaper_controller_client_instance);
g_wallpaper_controller_client_instance = this; g_wallpaper_controller_client_instance = this;
} }
WallpaperControllerClient::~WallpaperControllerClient() { WallpaperControllerClient::~WallpaperControllerClient() {
weak_factory_.InvalidateWeakPtrs();
DCHECK_EQ(this, g_wallpaper_controller_client_instance); DCHECK_EQ(this, g_wallpaper_controller_client_instance);
g_wallpaper_controller_client_instance = nullptr; g_wallpaper_controller_client_instance = nullptr;
} }
...@@ -115,28 +129,17 @@ WallpaperControllerClient* WallpaperControllerClient::Get() { ...@@ -115,28 +129,17 @@ WallpaperControllerClient* WallpaperControllerClient::Get() {
return g_wallpaper_controller_client_instance; return g_wallpaper_controller_client_instance;
} }
bool WallpaperControllerClient::CanGetWallpaperFilesId() const {
return chromeos::SystemSaltGetter::IsInitialized() &&
chromeos::SystemSaltGetter::Get()->GetRawSalt();
}
wallpaper::WallpaperFilesId WallpaperControllerClient::GetFilesId( wallpaper::WallpaperFilesId WallpaperControllerClient::GetFilesId(
const AccountId& account_id) const { const AccountId& account_id) const {
// System salt might not be ready in tests. Thus we don't have a valid DCHECK(CanGetFilesId());
// wallpaper files id here.
if (!CanGetWallpaperFilesId())
return wallpaper::WallpaperFilesId();
std::string stored_value; std::string stored_value;
if (user_manager::known_user::GetStringPref(account_id, kWallpaperFilesId, if (user_manager::known_user::GetStringPref(account_id, kWallpaperFilesId,
&stored_value)) { &stored_value)) {
return wallpaper::WallpaperFilesId::FromString(stored_value); return wallpaper::WallpaperFilesId::FromString(stored_value);
} }
// Migrated.
const std::string& old_id = account_id.GetUserEmail();
const wallpaper::WallpaperFilesId wallpaper_files_id = const wallpaper::WallpaperFilesId wallpaper_files_id =
HashWallpaperFilesIdStr(old_id); HashWallpaperFilesIdStr(account_id.GetUserEmail());
user_manager::known_user::SetStringPref(account_id, kWallpaperFilesId, user_manager::known_user::SetStringPref(account_id, kWallpaperFilesId,
wallpaper_files_id.id()); wallpaper_files_id.id());
return wallpaper_files_id; return wallpaper_files_id;
...@@ -147,7 +150,6 @@ void WallpaperControllerClient::SetCustomWallpaper( ...@@ -147,7 +150,6 @@ void WallpaperControllerClient::SetCustomWallpaper(
const wallpaper::WallpaperFilesId& wallpaper_files_id, const wallpaper::WallpaperFilesId& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
bool show_wallpaper) { bool show_wallpaper) {
ash::mojom::WallpaperUserInfoPtr user_info = ash::mojom::WallpaperUserInfoPtr user_info =
...@@ -155,7 +157,7 @@ void WallpaperControllerClient::SetCustomWallpaper( ...@@ -155,7 +157,7 @@ void WallpaperControllerClient::SetCustomWallpaper(
if (!user_info) if (!user_info)
return; return;
wallpaper_controller_->SetCustomWallpaper( wallpaper_controller_->SetCustomWallpaper(
std::move(user_info), wallpaper_files_id.id(), file_name, layout, type, std::move(user_info), wallpaper_files_id.id(), file_name, layout,
*image.bitmap(), show_wallpaper); *image.bitmap(), show_wallpaper);
} }
...@@ -179,6 +181,18 @@ void WallpaperControllerClient::SetDefaultWallpaper(const AccountId& account_id, ...@@ -179,6 +181,18 @@ void WallpaperControllerClient::SetDefaultWallpaper(const AccountId& account_id,
AccountIdToWallpaperUserInfo(account_id); AccountIdToWallpaperUserInfo(account_id);
if (!user_info) if (!user_info)
return; return;
// Postpone setting the wallpaper until we can get files id.
if (!CanGetFilesId()) {
LOG(WARNING)
<< "Cannot get wallpaper files id in SetDefaultWallpaper. This "
"should never happen under normal circumstances.";
AddCanGetFilesIdCallback(
base::Bind(&WallpaperControllerClient::SetDefaultWallpaper,
weak_factory_.GetWeakPtr(), account_id, show_wallpaper));
return;
}
wallpaper_controller_->SetDefaultWallpaper( wallpaper_controller_->SetDefaultWallpaper(
std::move(user_info), GetFilesId(account_id).id(), show_wallpaper); std::move(user_info), GetFilesId(account_id).id(), show_wallpaper);
} }
...@@ -191,6 +205,30 @@ void WallpaperControllerClient::SetCustomizedDefaultWallpaper( ...@@ -191,6 +205,30 @@ void WallpaperControllerClient::SetCustomizedDefaultWallpaper(
resized_directory); resized_directory);
} }
void WallpaperControllerClient::SetPolicyWallpaper(
const AccountId& account_id,
std::unique_ptr<std::string> data) {
if (!data)
return;
ash::mojom::WallpaperUserInfoPtr user_info =
AccountIdToWallpaperUserInfo(account_id);
if (!user_info)
return;
// Postpone setting the wallpaper until we can get files id. See
// https://crbug.com/615239.
if (!CanGetFilesId()) {
AddCanGetFilesIdCallback(base::Bind(
&WallpaperControllerClient::SetPolicyWallpaper,
weak_factory_.GetWeakPtr(), account_id, base::Passed(std::move(data))));
return;
}
wallpaper_controller_->SetPolicyWallpaper(std::move(user_info),
GetFilesId(account_id).id(), *data);
}
void WallpaperControllerClient::UpdateCustomWallpaperLayout( void WallpaperControllerClient::UpdateCustomWallpaperLayout(
const AccountId& account_id, const AccountId& account_id,
wallpaper::WallpaperLayout layout) { wallpaper::WallpaperLayout layout) {
...@@ -220,10 +258,44 @@ void WallpaperControllerClient::RemoveUserWallpaper( ...@@ -220,10 +258,44 @@ void WallpaperControllerClient::RemoveUserWallpaper(
AccountIdToWallpaperUserInfo(account_id); AccountIdToWallpaperUserInfo(account_id);
if (!user_info) if (!user_info)
return; return;
// Postpone removing the wallpaper until we can get files id.
if (!CanGetFilesId()) {
LOG(WARNING)
<< "Cannot get wallpaper files id in RemoveUserWallpaper. This "
"should never happen under normal circumstances.";
AddCanGetFilesIdCallback(
base::Bind(&WallpaperControllerClient::RemoveUserWallpaper,
weak_factory_.GetWeakPtr(), account_id));
return;
}
wallpaper_controller_->RemoveUserWallpaper(std::move(user_info), wallpaper_controller_->RemoveUserWallpaper(std::move(user_info),
GetFilesId(account_id).id()); GetFilesId(account_id).id());
} }
void WallpaperControllerClient::RemovePolicyWallpaper(
const AccountId& account_id) {
ash::mojom::WallpaperUserInfoPtr user_info =
AccountIdToWallpaperUserInfo(account_id);
if (!user_info)
return;
// Postpone removing the wallpaper until we can get files id.
if (!CanGetFilesId()) {
LOG(WARNING)
<< "Cannot get wallpaper files id in RemovePolicyWallpaper. This "
"should never happen under normal circumstances.";
AddCanGetFilesIdCallback(
base::Bind(&WallpaperControllerClient::RemovePolicyWallpaper,
weak_factory_.GetWeakPtr(), account_id));
return;
}
wallpaper_controller_->RemovePolicyWallpaper(std::move(user_info),
GetFilesId(account_id).id());
}
void WallpaperControllerClient::OpenWallpaperPicker() { void WallpaperControllerClient::OpenWallpaperPicker() {
// TODO(crbug.com/776464): Inline the implementation after WallpaperManager // TODO(crbug.com/776464): Inline the implementation after WallpaperManager
// is removed. // is removed.
......
...@@ -32,10 +32,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient, ...@@ -32,10 +32,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient,
static WallpaperControllerClient* Get(); static WallpaperControllerClient* Get();
// TODO(crbug.com/776464): Move this to anonymous namesapce.
// Returns true if wallpaper files id can be returned successfully.
bool CanGetWallpaperFilesId() const;
// Returns files identifier for the |account_id|. // Returns files identifier for the |account_id|.
wallpaper::WallpaperFilesId GetFilesId(const AccountId& account_id) const; wallpaper::WallpaperFilesId GetFilesId(const AccountId& account_id) const;
...@@ -44,7 +40,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient, ...@@ -44,7 +40,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient,
const wallpaper::WallpaperFilesId& wallpaper_files_id, const wallpaper::WallpaperFilesId& wallpaper_files_id,
const std::string& file_name, const std::string& file_name,
wallpaper::WallpaperLayout layout, wallpaper::WallpaperLayout layout,
wallpaper::WallpaperType type,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
bool show_wallpaper); bool show_wallpaper);
void SetOnlineWallpaper(const AccountId& account_id, void SetOnlineWallpaper(const AccountId& account_id,
...@@ -56,11 +51,14 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient, ...@@ -56,11 +51,14 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient,
void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url,
const base::FilePath& file_path, const base::FilePath& file_path,
const base::FilePath& resized_directory); const base::FilePath& resized_directory);
void SetPolicyWallpaper(const AccountId& account_id,
std::unique_ptr<std::string> data);
void UpdateCustomWallpaperLayout(const AccountId& account_id, void UpdateCustomWallpaperLayout(const AccountId& account_id,
wallpaper::WallpaperLayout layout); wallpaper::WallpaperLayout layout);
void ShowUserWallpaper(const AccountId& account_id); void ShowUserWallpaper(const AccountId& account_id);
void ShowSigninWallpaper(); void ShowSigninWallpaper();
void RemoveUserWallpaper(const AccountId& account_id); void RemoveUserWallpaper(const AccountId& account_id);
void RemovePolicyWallpaper(const AccountId& account_id);
// ash::mojom::WallpaperControllerClient: // ash::mojom::WallpaperControllerClient:
void OpenWallpaperPicker() override; void OpenWallpaperPicker() override;
...@@ -84,6 +82,8 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient, ...@@ -84,6 +82,8 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient,
// Binds to the client interface. // Binds to the client interface.
mojo::Binding<ash::mojom::WallpaperControllerClient> binding_; mojo::Binding<ash::mojom::WallpaperControllerClient> binding_;
base::WeakPtrFactory<WallpaperControllerClient> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WallpaperControllerClient); DISALLOW_COPY_AND_ASSIGN(WallpaperControllerClient);
}; };
......
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