Skip to content

Commit

Permalink
cros: Clean up legacy code in wallpaper.mojom
Browse files Browse the repository at this point in the history
Deletes the dead code after wallpaper refactoring.

TBR=jamescook@chromium.org, xdai@chromium.org

Bug: 810535
Change-Id: I7ef7124c825131810b13cf6e50aa93971fec5b4c
Reviewed-on: https://chromium-review.googlesource.com/909849
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535876}
  • Loading branch information
Wenzhao Zang authored and Commit Bot committed Feb 9, 2018
1 parent 8a846d0 commit ed75201
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 155 deletions.
18 changes: 0 additions & 18 deletions ash/public/cpp/wallpaper_struct_traits.cc

This file was deleted.

80 changes: 0 additions & 80 deletions ash/public/cpp/wallpaper_struct_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#include "ash/public/interfaces/wallpaper.mojom.h"
#include "components/wallpaper/wallpaper_info.h"

namespace base {
class Time;
} // namespace base

namespace mojo {

template <>
Expand Down Expand Up @@ -54,82 +50,6 @@ struct EnumTraits<ash::mojom::WallpaperLayout, wallpaper::WallpaperLayout> {
}
};

template <>
struct EnumTraits<ash::mojom::WallpaperType, wallpaper::WallpaperType> {
static ash::mojom::WallpaperType ToMojom(wallpaper::WallpaperType input) {
switch (input) {
case wallpaper::DAILY:
return ash::mojom::WallpaperType::DAILY;
case wallpaper::CUSTOMIZED:
return ash::mojom::WallpaperType::CUSTOMIZED;
case wallpaper::DEFAULT:
return ash::mojom::WallpaperType::DEFAULT;
case wallpaper::ONLINE:
return ash::mojom::WallpaperType::ONLINE;
case wallpaper::POLICY:
return ash::mojom::WallpaperType::POLICY;
case wallpaper::THIRDPARTY:
return ash::mojom::WallpaperType::THIRDPARTY;
case wallpaper::DEVICE:
return ash::mojom::WallpaperType::DEVICE;
case wallpaper::WALLPAPER_TYPE_COUNT:
break;
}
NOTREACHED();
return ash::mojom::WallpaperType::DAILY;
}

static bool FromMojom(ash::mojom::WallpaperType input,
wallpaper::WallpaperType* out) {
switch (input) {
case ash::mojom::WallpaperType::DAILY:
*out = wallpaper::DAILY;
return true;
case ash::mojom::WallpaperType::CUSTOMIZED:
*out = wallpaper::CUSTOMIZED;
return true;
case ash::mojom::WallpaperType::DEFAULT:
*out = wallpaper::DEFAULT;
return true;
case ash::mojom::WallpaperType::ONLINE:
*out = wallpaper::ONLINE;
return true;
case ash::mojom::WallpaperType::POLICY:
*out = wallpaper::POLICY;
return true;
case ash::mojom::WallpaperType::THIRDPARTY:
*out = wallpaper::THIRDPARTY;
return true;
case ash::mojom::WallpaperType::DEVICE:
*out = wallpaper::DEVICE;
return true;
}
NOTREACHED();
return false;
}
};

template <>
struct ASH_PUBLIC_EXPORT
StructTraits<ash::mojom::WallpaperInfoDataView, wallpaper::WallpaperInfo> {
static const std::string& location(const wallpaper::WallpaperInfo& i) {
return i.location;
}
static const wallpaper::WallpaperLayout& layout(
const wallpaper::WallpaperInfo& i) {
return i.layout;
}
static const wallpaper::WallpaperType& type(
const wallpaper::WallpaperInfo& i) {
return i.type;
}
static const base::Time& date(const wallpaper::WallpaperInfo& i) {
return i.date;
}
static bool Read(ash::mojom::WallpaperInfoDataView data,
wallpaper::WallpaperInfo* out);
};

} // namespace mojo

#endif // ASH_PUBLIC_CPP_WALLPAPER_STRUCT_TRAITS_H_
32 changes: 0 additions & 32 deletions ash/public/interfaces/wallpaper.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module ash.mojom;
import "ash/public/interfaces/user_info.mojom";
import "components/signin/public/interfaces/account_id.mojom";
import "mojo/common/file_path.mojom";
import "mojo/common/time.mojom";
import "skia/public/interfaces/bitmap.mojom";
import "url/mojom/url.mojom";

Expand All @@ -19,28 +18,6 @@ enum WallpaperLayout {
TILE,
};

// These values match wallpaper::WallpaperType.
enum WallpaperType {
DAILY,
CUSTOMIZED,
DEFAULT,
ONLINE,
POLICY,
THIRDPARTY,
DEVICE,
};

// TODO(crbug.com/776464): Remove this after WallpaperManager is removed.
// WallpaperInfo will be an internal concept within WallpaperController.
//
// This corresponds to wallpaper::WallpaperInfo.
struct WallpaperInfo {
string location;
WallpaperLayout layout;
WallpaperType type;
mojo.common.mojom.Time date;
};

// User info needed to set wallpapers. Clients must specify the user because
// it's not always the same with the active user, e.g., when showing wallpapers
// for different user pods at login screen, or setting wallpapers selectively
Expand Down Expand Up @@ -184,15 +161,6 @@ interface WallpaperController {
// and it's allowed to change wallpaper per the user type and the login state.
OpenWallpaperPickerIfAllowed();

// TODO(crbug.com/776464): This is only used by WallpaperManager. Remove this
// after WallpaperManager is removed.
//
// Set the wallpaper bitmap and info used for the ash desktop background.
// A null or empty |wallpaper| bitmap is treated as a no-op.
// TODO(crbug.com/655875): Optimize ash wallpaper transport; avoid sending
// large bitmaps over Mojo; use shared memory like BitmapUploader, etc.
SetWallpaper(skia.mojom.Bitmap? wallpaper, WallpaperInfo info);

// Calling this method triggers an initial notification of the wallpaper
// state. Observers are automatically removed as their connections are closed.
AddObserver(associated WallpaperObserver observer);
Expand Down
9 changes: 1 addition & 8 deletions ash/public/interfaces/wallpaper.typemap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@
mojom = "//ash/public/interfaces/wallpaper.mojom"
public_headers = [ "//components/wallpaper/wallpaper_info.h" ]
traits_headers = [ "//ash/public/cpp/wallpaper_struct_traits.h" ]
sources = [
"//ash/public/cpp/wallpaper_struct_traits.cc",
]
type_mappings = [
"ash.mojom.WallpaperLayout=wallpaper::WallpaperLayout",
"ash.mojom.WallpaperType=wallpaper::WallpaperType",
"ash.mojom.WallpaperInfo=wallpaper::WallpaperInfo",
]
type_mappings = [ "ash.mojom.WallpaperLayout=wallpaper::WallpaperLayout" ]
7 changes: 0 additions & 7 deletions ash/wallpaper/wallpaper_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1346,13 +1346,6 @@ void WallpaperController::OpenWallpaperPickerIfAllowed() {
}
}

void WallpaperController::SetWallpaper(const SkBitmap& wallpaper,
const WallpaperInfo& info) {
if (wallpaper.isNull())
return;
SetWallpaperImage(gfx::ImageSkia::CreateFrom1xBitmap(wallpaper), info);
}

void WallpaperController::AddObserver(
mojom::WallpaperObserverAssociatedPtrInfo observer) {
mojom::WallpaperObserverAssociatedPtr observer_ptr;
Expand Down
2 changes: 0 additions & 2 deletions ash/wallpaper/wallpaper_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,6 @@ class ASH_EXPORT WallpaperController
void RemovePolicyWallpaper(mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override;
void OpenWallpaperPickerIfAllowed() override;
void SetWallpaper(const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) override;
void AddObserver(mojom::WallpaperObserverAssociatedPtrInfo observer) override;
void GetWallpaperColors(GetWallpaperColorsCallback callback) override;
void IsActiveUserWallpaperControlledByPolicy(
Expand Down
6 changes: 0 additions & 6 deletions chrome/browser/ui/ash/test_wallpaper_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ void TestWallpaperController::OpenWallpaperPickerIfAllowed() {
NOTIMPLEMENTED();
}

void TestWallpaperController::SetWallpaper(
const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) {
NOTIMPLEMENTED();
}

void TestWallpaperController::AddObserver(
ash::mojom::WallpaperObserverAssociatedPtrInfo observer) {
NOTIMPLEMENTED();
Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/ui/ash/test_wallpaper_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class TestWallpaperController : ash::mojom::WallpaperController {
void RemovePolicyWallpaper(ash::mojom::WallpaperUserInfoPtr user_info,
const std::string& wallpaper_files_id) override;
void OpenWallpaperPickerIfAllowed() override;
void SetWallpaper(const SkBitmap& wallpaper,
const wallpaper::WallpaperInfo& wallpaper_info) override;
void AddObserver(
ash::mojom::WallpaperObserverAssociatedPtrInfo observer) override;
void GetWallpaperColors(GetWallpaperColorsCallback callback) override;
Expand Down

0 comments on commit ed75201

Please sign in to comment.