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

Side by Side 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: Cleanup 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/mus/user_wallpaper_delegate_mus.h"
6
7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/shell.h"
9 #include "components/wallpaper/wallpaper_layout.h"
10 #include "mash/public/interfaces/wallpaper.mojom.h"
11 #include "services/shell/public/cpp/connector.h"
12 #include "skia/public/type_converters.h"
13 #include "ui/views/mus/window_manager_connection.h"
14 #include "ui/wm/core/window_animations.h"
15
16 namespace ash {
17
18 int UserWallpaperDelegateMus::GetAnimationType() {
19 return ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
20 }
21
22 int UserWallpaperDelegateMus::GetAnimationDurationOverride() {
23 return 0;
24 }
25
26 void UserWallpaperDelegateMus::SetAnimationDurationOverride(
27 int animation_duration_in_ms) {
28 NOTIMPLEMENTED();
29 }
30
31 bool UserWallpaperDelegateMus::ShouldShowInitialAnimation() {
32 return false;
33 }
34
35 void UserWallpaperDelegateMus::UpdateWallpaper(bool clear_cache) {
36 NOTIMPLEMENTED();
37 }
38
39 void UserWallpaperDelegateMus::InitializeWallpaper() {
40 // No action required; ChromeBrowserMainPartsChromeos inits WallpaperManager.
msw 2016/05/19 19:28:51 This is sufficient from my local testing, but I co
41 }
42
43 void UserWallpaperDelegateMus::OpenSetWallpaperPage() {
44 mash::mojom::WallpaperHelperPtr wallpaper_helper;
45 auto* connector = views::WindowManagerConnection::Get()->connector();
46 connector->ConnectToInterface("exe:chrome", &wallpaper_helper);
47 wallpaper_helper->OpenWallpaperManager();
48 }
49
50 bool UserWallpaperDelegateMus::CanOpenSetWallpaperPage() {
51 return true;
52 }
53
54 void UserWallpaperDelegateMus::OnWallpaperAnimationFinished() {}
55
56 void UserWallpaperDelegateMus::OnWallpaperBootAnimationFinished() {}
57
58 void UserWallpaperDelegateMus::SetWallpaper(skia::mojom::BitmapPtr wallpaper,
59 int32_t layout) {
60 const SkBitmap bitmap = wallpaper.To<SkBitmap>();
61 if (bitmap.isNull())
62 return;
63 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
64 ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage(
65 image, static_cast<wallpaper::WallpaperLayout>(layout));
66 }
67
68 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698