| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ash/desktop_background/desktop_background_resources.h" | 10 #include "ash/desktop_background/desktop_background_resources.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Loads selected desktop wallpaper from file system asynchronously and updates | 40 // Loads selected desktop wallpaper from file system asynchronously and updates |
| 41 // background layer if loaded successfully. | 41 // background layer if loaded successfully. |
| 42 class ASH_EXPORT DesktopBackgroundController { | 42 class ASH_EXPORT DesktopBackgroundController { |
| 43 public: | 43 public: |
| 44 enum BackgroundMode { | 44 enum BackgroundMode { |
| 45 BACKGROUND_IMAGE, | 45 BACKGROUND_IMAGE, |
| 46 BACKGROUND_SOLID_COLOR | 46 BACKGROUND_SOLID_COLOR |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 explicit DesktopBackgroundController(aura::RootWindow* root_window); | 49 DesktopBackgroundController(); |
| 50 virtual ~DesktopBackgroundController(); | 50 virtual ~DesktopBackgroundController(); |
| 51 | 51 |
| 52 // Gets the desktop background mode. | 52 // Gets the desktop background mode. |
| 53 BackgroundMode desktop_background_mode() const { | 53 BackgroundMode desktop_background_mode() const { |
| 54 return desktop_background_mode_; | 54 return desktop_background_mode_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Loads default wallpaper at |index| asynchronously and sets to current | 57 // Loads default wallpaper at |index| asynchronously and sets to current |
| 58 // wallpaper after loaded. | 58 // wallpaper after loaded. |
| 59 void SetDefaultWallpaper(int index); | 59 void SetDefaultWallpaper(int index); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 // Sets the desktop background to image mode and creates a new background | 85 // Sets the desktop background to image mode and creates a new background |
| 86 // widget with user selected wallpaper or default wallpaper. Deletes the old | 86 // widget with user selected wallpaper or default wallpaper. Deletes the old |
| 87 // widget if any. | 87 // widget if any. |
| 88 void SetDesktopBackgroundImageMode(scoped_refptr<WallpaperOperation> wo); | 88 void SetDesktopBackgroundImageMode(scoped_refptr<WallpaperOperation> wo); |
| 89 | 89 |
| 90 // Creates a new background widget and sets the background mode to image mode. | 90 // Creates a new background widget and sets the background mode to image mode. |
| 91 // Called after wallpaper loaded successfully. | 91 // Called after wallpaper loaded successfully. |
| 92 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo); | 92 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo); |
| 93 | 93 |
| 94 aura::RootWindow* root_window_; | |
| 95 | |
| 96 // Can change at runtime. | 94 // Can change at runtime. |
| 97 BackgroundMode desktop_background_mode_; | 95 BackgroundMode desktop_background_mode_; |
| 98 | 96 |
| 99 // The previous successfully loaded wallpaper. | 97 // The previous successfully loaded wallpaper. |
| 100 int previous_index_; | 98 int previous_index_; |
| 101 | 99 |
| 102 scoped_refptr<WallpaperOperation> wallpaper_op_; | 100 scoped_refptr<WallpaperOperation> wallpaper_op_; |
| 103 | 101 |
| 104 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; | 102 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
| 105 | 103 |
| 106 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 104 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 } // namespace ash | 107 } // namespace ash |
| 110 | 108 |
| 111 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 109 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| OLD | NEW |