Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/sysui/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 "ui/views/mus/window_manager_connection.h" | |
| 12 #include "ui/wm/core/window_animations.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 namespace sysui { | |
| 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 mojom::WallpaperManagerPtr wallpaper_manager; | |
| 48 auto* connector = views::WindowManagerConnection::Get()->connector(); | |
| 49 connector->ConnectToInterface("exe:chrome", &wallpaper_manager); | |
| 50 wallpaper_manager->Open(); | |
| 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(const SkBitmap& wallpaper, | |
| 63 mojom::WallpaperLayout layout) { | |
| 64 if (wallpaper.isNull()) | |
| 65 return; | |
| 66 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(wallpaper); | |
| 67 Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage( | |
| 68 image, static_cast<wallpaper::WallpaperLayout>(layout)); | |
|
dcheng
2016/06/02 21:36:51
=/
What guarantees that the enums line up?
msw
2016/06/02 22:19:15
I added explicit conversion functions.
| |
| 69 } | |
| 70 | |
| 71 } // namespace sysui | |
| 72 } // namespace ash | |
| OLD | NEW |