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

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. 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 "services/shell/public/cpp/connector.h"
11 #include "skia/public/type_converters.h"
12 #include "ui/views/mus/window_manager_connection.h"
13 #include "ui/wm/core/window_animations.h"
14
15 namespace ash {
16
17 UserWallpaperDelegateMus::UserWallpaperDelegateMus() {}
18
19 UserWallpaperDelegateMus::~UserWallpaperDelegateMus() {}
20
21 int UserWallpaperDelegateMus::GetAnimationType() {
22 return ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE;
23 }
24
25 int UserWallpaperDelegateMus::GetAnimationDurationOverride() {
26 return 0;
27 }
28
29 void UserWallpaperDelegateMus::SetAnimationDurationOverride(
30 int animation_duration_in_ms) {
31 NOTIMPLEMENTED();
32 }
33
34 bool UserWallpaperDelegateMus::ShouldShowInitialAnimation() {
35 return false;
36 }
37
38 void UserWallpaperDelegateMus::UpdateWallpaper(bool clear_cache) {
39 NOTIMPLEMENTED();
40 }
41
42 void UserWallpaperDelegateMus::InitializeWallpaper() {
43 // No action required; ChromeBrowserMainPartsChromeos inits WallpaperManager.
44 }
45
46 void UserWallpaperDelegateMus::OpenSetWallpaperPage() {
47 mus::mojom::WallpaperManagerPtr wallpaper_manager;
48 auto* connector = views::WindowManagerConnection::Get()->connector();
49 connector->ConnectToInterface("exe:chrome", &wallpaper_manager);
50 wallpaper_manager->OpenWallpaperManager();
51 }
52
53 bool UserWallpaperDelegateMus::CanOpenSetWallpaperPage() {
54 // TODO(msw): Restrict this during login, etc.
55 return true;
56 }
57
58 void UserWallpaperDelegateMus::OnWallpaperAnimationFinished() {}
59
60 void UserWallpaperDelegateMus::OnWallpaperBootAnimationFinished() {}
61
62 void UserWallpaperDelegateMus::SetWallpaper(
63 skia::mojom::BitmapPtr wallpaper,
64 mus::mojom::WallpaperLayout layout) {
65 const SkBitmap bitmap = wallpaper.To<SkBitmap>();
66 if (bitmap.isNull())
67 return;
68 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
69 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