| 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 #include "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_view.h" | 7 #include "ash/desktop_background/desktop_background_view.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_factory.h" | 9 #include "ash/shell_factory.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 const int wallpaper_index; | 46 const int wallpaper_index; |
| 47 const WallpaperLayout wallpaper_layout; | 47 const WallpaperLayout wallpaper_layout; |
| 48 const gfx::ImageSkia wallpaper_image; | 48 const gfx::ImageSkia wallpaper_image; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // DesktopBackgroundController::WallpaperOperation wraps background wallpaper | 51 // DesktopBackgroundController::WallpaperOperation wraps background wallpaper |
| 52 // loading. | 52 // loading. |
| 53 class DesktopBackgroundController::WallpaperOperation | 53 class DesktopBackgroundController::WallpaperOperation |
| 54 : public base::RefCountedThreadSafe< | 54 : public base::RefCountedThreadSafe< |
| 55 DesktopBackgroundController::WallpaperOperation> { | 55 DesktopBackgroundController::WallpaperOperation> { |
| 56 public: | 56 public: |
| 57 explicit WallpaperOperation(int index) : index_(index) { | 57 explicit WallpaperOperation(int index) : index_(index) { |
| 58 } | 58 } |
| 59 | 59 |
| 60 static void Run(scoped_refptr<WallpaperOperation> wo) { | 60 static void Run(scoped_refptr<WallpaperOperation> wo) { |
| 61 wo->LoadingWallpaper(); | 61 wo->LoadingWallpaper(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void LoadingWallpaper() { | 64 void LoadingWallpaper() { |
| 65 if (cancel_flag_.IsSet()) | 65 if (cancel_flag_.IsSet()) |
| 66 return; | 66 return; |
| 67 wallpaper_data_.reset(new WallpaperData(index_)); | 67 wallpaper_data_.reset(new WallpaperData(index_)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void Cancel() { | 70 void Cancel() { |
| 71 cancel_flag_.Set(); | 71 cancel_flag_.Set(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 WallpaperData* ReleaseWallpaperData() { | 74 WallpaperData* ReleaseWallpaperData() { |
| 75 return wallpaper_data_.release(); | 75 return wallpaper_data_.release(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 friend class base::RefCountedThreadSafe< | 79 friend class base::RefCountedThreadSafe< |
| 80 DesktopBackgroundController::WallpaperOperation>; | 80 DesktopBackgroundController::WallpaperOperation>; |
| 81 | 81 |
| 82 ~WallpaperOperation() {} |
| 83 |
| 82 base::CancellationFlag cancel_flag_; | 84 base::CancellationFlag cancel_flag_; |
| 83 | 85 |
| 84 scoped_ptr<WallpaperData> wallpaper_data_; | 86 scoped_ptr<WallpaperData> wallpaper_data_; |
| 85 | 87 |
| 86 int index_; | 88 int index_; |
| 87 | 89 |
| 88 DISALLOW_COPY_AND_ASSIGN(WallpaperOperation); | 90 DISALLOW_COPY_AND_ASSIGN(WallpaperOperation); |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 DesktopBackgroundController::DesktopBackgroundController() | 93 DesktopBackgroundController::DesktopBackgroundController() |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 218 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 217 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 219 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
| 218 iter != root_windows.end(); ++iter) { | 220 iter != root_windows.end(); ++iter) { |
| 219 gfx::ImageSkia dummy; | 221 gfx::ImageSkia dummy; |
| 220 internal::CreateDesktopBackground(dummy, CENTER, *iter); | 222 internal::CreateDesktopBackground(dummy, CENTER, *iter); |
| 221 } | 223 } |
| 222 desktop_background_mode_ = BACKGROUND_IMAGE; | 224 desktop_background_mode_ = BACKGROUND_IMAGE; |
| 223 } | 225 } |
| 224 | 226 |
| 225 } // namespace ash | 227 } // namespace ash |
| OLD | NEW |