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

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: Address comments; test failures. 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 UserWallpaperDelegateMus::UserWallpaperDelegateMus() {}
19
20 UserWallpaperDelegateMus::~UserWallpaperDelegateMus() {}
21
22 int UserWallpaperDelegateMus::GetAnimationType() {
23 return ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
24 }
25
26 int UserWallpaperDelegateMus::GetAnimationDurationOverride() {
27 return 0;
28 }
29
30 void UserWallpaperDelegateMus::SetAnimationDurationOverride(
31 int animation_duration_in_ms) {
32 NOTIMPLEMENTED();
33 }
34
35 bool UserWallpaperDelegateMus::ShouldShowInitialAnimation() {
36 return false;
37 }
38
39 void UserWallpaperDelegateMus::UpdateWallpaper(bool clear_cache) {
40 NOTIMPLEMENTED();
41 }
42
43 void UserWallpaperDelegateMus::InitializeWallpaper() {
44 // No action required; ChromeBrowserMainPartsChromeos inits WallpaperManager.
45 }
46
47 void UserWallpaperDelegateMus::OpenSetWallpaperPage() {
48 mash::mojom::WallpaperHelperPtr wallpaper_helper;
49 auto* connector = views::WindowManagerConnection::Get()->connector();
50 connector->ConnectToInterface("exe:chrome", &wallpaper_helper);
51 wallpaper_helper->OpenWallpaperManager();
52 }
53
54 bool UserWallpaperDelegateMus::CanOpenSetWallpaperPage() {
55 // TODO(msw): Restrict this during login, etc.
56 return true;
57 }
58
59 void UserWallpaperDelegateMus::OnWallpaperAnimationFinished() {}
60
61 void UserWallpaperDelegateMus::OnWallpaperBootAnimationFinished() {}
62
63 void UserWallpaperDelegateMus::SetWallpaper(skia::mojom::BitmapPtr wallpaper,
64 int32_t layout) {
65 const SkBitmap bitmap = wallpaper.To<SkBitmap>();
66 if (bitmap.isNull())
67 return;
68 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
69 ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage(
70 image, static_cast<wallpaper::WallpaperLayout>(layout));
71 }
72
73 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698