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

Unified Diff: ash/mus/user_wallpaper_delegate_mus.cc

Issue 1984433002: Hook up Chrome's wallpaper picker for mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 7 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/mus/user_wallpaper_delegate_mus.cc
diff --git a/ash/mus/user_wallpaper_delegate_mus.cc b/ash/mus/user_wallpaper_delegate_mus.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3ffd15414e15e578002d007dc6f6fb4a18ca309c
--- /dev/null
+++ b/ash/mus/user_wallpaper_delegate_mus.cc
@@ -0,0 +1,73 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/mus/user_wallpaper_delegate_mus.h"
+
+#include "ash/desktop_background/desktop_background_controller.h"
+#include "ash/shell.h"
+#include "components/wallpaper/wallpaper_layout.h"
+#include "services/shell/public/cpp/connector.h"
+#include "skia/public/type_converters.h"
+#include "ui/views/mus/window_manager_connection.h"
+#include "ui/wm/core/window_animations.h"
+
+namespace ash {
+
+UserWallpaperDelegateMus::UserWallpaperDelegateMus() {}
+
+UserWallpaperDelegateMus::~UserWallpaperDelegateMus() {}
+
+int UserWallpaperDelegateMus::GetAnimationType() {
+ return ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
+}
+
+int UserWallpaperDelegateMus::GetAnimationDurationOverride() {
+ return 0;
+}
+
+void UserWallpaperDelegateMus::SetAnimationDurationOverride(
+ int animation_duration_in_ms) {
+ NOTIMPLEMENTED();
+}
+
+bool UserWallpaperDelegateMus::ShouldShowInitialAnimation() {
+ return false;
+}
+
+void UserWallpaperDelegateMus::UpdateWallpaper(bool clear_cache) {
+ NOTIMPLEMENTED();
+}
+
+void UserWallpaperDelegateMus::InitializeWallpaper() {
+ // No action required; ChromeBrowserMainPartsChromeos inits WallpaperManager.
+}
+
+void UserWallpaperDelegateMus::OpenSetWallpaperPage() {
+ mus::mojom::WallpaperManagerPtr wallpaper_manager;
+ auto* connector = views::WindowManagerConnection::Get()->connector();
+ connector->ConnectToInterface("exe:chrome", &wallpaper_manager);
+ wallpaper_manager->OpenWallpaperManager();
+}
+
+bool UserWallpaperDelegateMus::CanOpenSetWallpaperPage() {
+ // TODO(msw): Restrict this during login, etc.
+ return true;
+}
+
+void UserWallpaperDelegateMus::OnWallpaperAnimationFinished() {}
+
+void UserWallpaperDelegateMus::OnWallpaperBootAnimationFinished() {}
+
+void UserWallpaperDelegateMus::SetWallpaper(
+ skia::mojom::BitmapPtr wallpaper,
+ mus::mojom::WallpaperLayout layout) {
+ const SkBitmap bitmap = wallpaper.To<SkBitmap>();
+ if (bitmap.isNull())
+ return;
+ gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
+ Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage(
+ image, static_cast<wallpaper::WallpaperLayout>(layout));
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698