OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ash/ash_export.h" |
| 10 #include "base/basictypes.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 |
| 13 namespace ash { |
| 14 |
| 15 // A class to listen for login and desktop background change events and set the |
| 16 // corresponding default wallpaper in Aura shell. |
| 17 class ASH_EXPORT DesktopBackgroundController { |
| 18 public: |
| 19 enum BackgroundMode { |
| 20 BACKGROUND_IMAGE, |
| 21 BACKGROUND_SOLID_COLOR |
| 22 }; |
| 23 |
| 24 DesktopBackgroundController(); |
| 25 virtual ~DesktopBackgroundController(); |
| 26 |
| 27 // Get the desktop background mode. |
| 28 BackgroundMode desktop_background_mode() const { |
| 29 return desktop_background_mode_; |
| 30 } |
| 31 |
| 32 // Change the desktop background image to wallpaper with |index|. |
| 33 void OnDesktopBackgroundChanged(int index); |
| 34 |
| 35 // Sets the desktop background to image mode and create a new background |
| 36 // widget with |wallpaper|. |
| 37 void SetDesktopBackgroundImageMode(const SkBitmap& wallpaper); |
| 38 |
| 39 // Sets the desktop background to image mode and create a new background |
| 40 // widget with default wallpaper. |
| 41 void SetDefaultDesktopBackgroundImage(); |
| 42 |
| 43 // Sets the desktop background to image mode and create a new background |
| 44 // widget with previous selected wallpaper at run time. |
| 45 void SetPreviousDesktopBackgroundImage(); |
| 46 |
| 47 // Sets the desktop background to solid color mode and create a solid color |
| 48 // layout. |
| 49 void SetDesktopBackgroundSolidColorMode(); |
| 50 |
| 51 private: |
| 52 // We need to cache the previously used wallpaper index. So when users switch |
| 53 // desktop background color mode at run time, we can directly switch back to |
| 54 // the user selected wallpaper in image mode. |
| 55 int previous_wallpaper_index_; |
| 56 |
| 57 // Can change at runtime. |
| 58 BackgroundMode desktop_background_mode_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
| 61 }; |
| 62 |
| 63 } // namespace ash |
| 64 |
| 65 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
OLD | NEW |