1 // Copyright (c) 2013 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.
5 #include "ash/desktop_background/user_wallpaper_delegate.h"
7 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "ash/wm/window_animations.h"
10 #include "base/basictypes.h"
11 #include "ui/gfx/image/image_skia.h"
15 const char kBackgroundRed = 70;
16 const char kBackgroundGreen = 70;
17 const char kBackgroundBlue = 78;
19 class UserWallpaperDelegate : public ash::UserWallpaperDelegate {
21 UserWallpaperDelegate() {
24 virtual ~UserWallpaperDelegate() {
27 virtual int GetAnimationType() OVERRIDE {
28 return ShouldShowInitialAnimation() ?
29 ash::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE :
30 static_cast<int>(views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
33 virtual bool ShouldShowInitialAnimation() OVERRIDE {
37 virtual void UpdateWallpaper() OVERRIDE {
40 virtual void InitializeWallpaper() OVERRIDE {
42 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
44 bitmap.eraseARGB(255, kBackgroundRed, kBackgroundGreen, kBackgroundBlue);
45 gfx::ImageSkia wallpaper =
46 gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
47 ash::Shell::GetInstance()->desktop_background_controller()->
48 SetCustomWallpaper(wallpaper, ash::WALLPAPER_LAYOUT_TILE);
51 virtual void OpenSetWallpaperPage() OVERRIDE {
54 virtual bool CanOpenSetWallpaperPage() OVERRIDE {
58 virtual void OnWallpaperAnimationFinished() OVERRIDE {
61 virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
65 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate);
70 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() {
71 return new UserWallpaperDelegate();