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

Unified Diff: ash/common/wallpaper/wallpaper_controller.cc

Issue 2413503002: Cleanup mojo Wallpaper interfaces for mash. (Closed)
Patch Set: Sync and rebase; do *not* use mojo in classic ash. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/wallpaper/wallpaper_controller.cc
diff --git a/ash/common/wallpaper/wallpaper_controller.cc b/ash/common/wallpaper/wallpaper_controller.cc
index 76864c6e04b3de1c6a3b1327fbf7f783a713ca59..4ba94b1ecf12c31261d642d52f5398a9f6220137 100644
--- a/ash/common/wallpaper/wallpaper_controller.cc
+++ b/ash/common/wallpaper/wallpaper_controller.cc
@@ -4,6 +4,7 @@
#include "ash/common/wallpaper/wallpaper_controller.h"
+#include "ash/common/shell_delegate.h"
#include "ash/common/shell_window_ids.h"
#include "ash/common/wallpaper/wallpaper_controller_observer.h"
#include "ash/common/wallpaper/wallpaper_delegate.h"
@@ -16,6 +17,7 @@
#include "base/logging.h"
#include "base/task_runner.h"
#include "components/wallpaper/wallpaper_resizer.h"
+#include "services/shell/public/cpp/connector.h"
#include "ui/display/manager/managed_display_info.h"
#include "ui/display/screen.h"
#include "ui/views/widget/widget.h"
@@ -43,6 +45,11 @@ WallpaperController::~WallpaperController() {
WmShell::Get()->RemoveShellObserver(this);
}
+void WallpaperController::BindRequest(
+ mojom::WallpaperControllerRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
gfx::ImageSkia WallpaperController::GetWallpaper() const {
if (current_wallpaper_)
return current_wallpaper_->image();
@@ -182,6 +189,29 @@ bool WallpaperController::WallpaperIsAlreadyLoaded(
current_wallpaper_->original_image_id();
}
+void WallpaperController::OpenSetWallpaperPage() {
+ WmShell* shell = WmShell::Get();
+ auto* connector = shell->delegate()->GetShellConnector();
+ if (!connector || !shell->wallpaper_delegate()->CanOpenSetWallpaperPage())
+ return;
+
+ mojom::WallpaperManagerPtr wallpaper_manager;
+ connector->ConnectToInterface("service:content_browser", &wallpaper_manager);
+ wallpaper_manager->Open();
+}
+
+void WallpaperController::SetWallpaper(const SkBitmap& wallpaper,
+ wallpaper::WallpaperLayout layout) {
+ if (wallpaper.isNull())
+ return;
+
+ SetWallpaperImage(gfx::ImageSkia::CreateFrom1xBitmap(wallpaper), layout);
+}
+
+void WallpaperController::GetWallpaper(const GetWallpaperCallback& callback) {
+ callback.Run(*GetWallpaper().bitmap(), GetWallpaperLayout());
James Cook 2016/10/14 21:58:02 nit: maybe comment here also that this can be slow
msw 2016/10/17 22:22:47 Moot; removed.
+}
+
void WallpaperController::InstallDesktopController(WmWindow* root_window) {
WallpaperWidgetController* component = nullptr;
int container_id = GetWallpaperContainerId(locked_);

Powered by Google App Engine
This is Rietveld 408576698