| 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 { | |
| 15 | |
| 16 wallpaper::WallpaperLayout WallpaperLayoutFromMojo( | |
| 17 ash::mojom::WallpaperLayout layout) { | |
| 18 switch (layout) { | |
| 19 case ash::mojom::WallpaperLayout::CENTER: | |
| 20 return wallpaper::WALLPAPER_LAYOUT_CENTER; | |
| 21 case ash::mojom::WallpaperLayout::CENTER_CROPPED: | |
| 22 return wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED; | |
| 23 case ash::mojom::WallpaperLayout::STRETCH: | |
| 24 return wallpaper::WALLPAPER_LAYOUT_STRETCH; | |
| 25 case ash::mojom::WallpaperLayout::TILE: | |
| 26 return wallpaper::WALLPAPER_LAYOUT_TILE; | |
| 27 } | |
| 28 NOTREACHED(); | |
| 29 return wallpaper::WALLPAPER_LAYOUT_CENTER; | |
| 30 } | |
| 31 | |
| 32 } // namespace | |
| 33 | |
| 34 namespace ash { | |
| 35 namespace sysui { | |
| 36 | |
| 37 UserWallpaperDelegateMus::UserWallpaperDelegateMus() {} | |
| 38 | |
| 39 UserWallpaperDelegateMus::~UserWallpaperDelegateMus() {} | |
| 40 | |
| 41 int UserWallpaperDelegateMus::GetAnimationType() { | |
| 42 return ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE; | |
| 43 } | |
| 44 | |
| 45 int UserWallpaperDelegateMus::GetAnimationDurationOverride() { | |
| 46 return 0; | |
| 47 } | |
| 48 | |
| 49 void UserWallpaperDelegateMus::SetAnimationDurationOverride( | |
| 50 int animation_duration_in_ms) { | |
| 51 NOTIMPLEMENTED(); | |
| 52 } | |
| 53 | |
| 54 bool UserWallpaperDelegateMus::ShouldShowInitialAnimation() { | |
| 55 return false; | |
| 56 } | |
| 57 | |
| 58 void UserWallpaperDelegateMus::UpdateWallpaper(bool clear_cache) { | |
| 59 NOTIMPLEMENTED(); | |
| 60 } | |
| 61 | |
| 62 void UserWallpaperDelegateMus::InitializeWallpaper() { | |
| 63 // No action required; ChromeBrowserMainPartsChromeos inits WallpaperManager. | |
| 64 } | |
| 65 | |
| 66 void UserWallpaperDelegateMus::OpenSetWallpaperPage() { | |
| 67 mojom::WallpaperManagerPtr wallpaper_manager; | |
| 68 auto* connector = views::WindowManagerConnection::Get()->connector(); | |
| 69 connector->ConnectToInterface("exe:chrome", &wallpaper_manager); | |
| 70 wallpaper_manager->Open(); | |
| 71 } | |
| 72 | |
| 73 bool UserWallpaperDelegateMus::CanOpenSetWallpaperPage() { | |
| 74 // TODO(msw): Restrict this during login, etc. | |
| 75 return true; | |
| 76 } | |
| 77 | |
| 78 void UserWallpaperDelegateMus::OnWallpaperAnimationFinished() {} | |
| 79 | |
| 80 void UserWallpaperDelegateMus::OnWallpaperBootAnimationFinished() {} | |
| 81 | |
| 82 void UserWallpaperDelegateMus::SetWallpaper(const SkBitmap& wallpaper, | |
| 83 mojom::WallpaperLayout layout) { | |
| 84 if (wallpaper.isNull()) | |
| 85 return; | |
| 86 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(wallpaper); | |
| 87 Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage( | |
| 88 image, WallpaperLayoutFromMojo(layout)); | |
| 89 } | |
| 90 | |
| 91 } // namespace sysui | |
| 92 } // namespace ash | |
| OLD | NEW |