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_controller_observer.h" | 7 #include "ash/desktop_background/desktop_background_controller_observer.h" |
8 #include "ash/desktop_background/desktop_background_view.h" | 8 #include "ash/desktop_background/desktop_background_view.h" |
9 #include "ash/desktop_background/desktop_background_widget_controller.h" | 9 #include "ash/desktop_background/desktop_background_widget_controller.h" |
10 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return WALLPAPER_LAYOUT_CENTER_CROPPED; | 167 return WALLPAPER_LAYOUT_CENTER_CROPPED; |
168 } | 168 } |
169 | 169 |
170 gfx::ImageSkia DesktopBackgroundController::GetCurrentWallpaperImage() { | 170 gfx::ImageSkia DesktopBackgroundController::GetCurrentWallpaperImage() { |
171 if (desktop_background_mode_ != BACKGROUND_IMAGE) | 171 if (desktop_background_mode_ != BACKGROUND_IMAGE) |
172 return gfx::ImageSkia(); | 172 return gfx::ImageSkia(); |
173 return GetWallpaper(); | 173 return GetWallpaper(); |
174 } | 174 } |
175 | 175 |
176 int DesktopBackgroundController::GetWallpaperIDR() const { | 176 int DesktopBackgroundController::GetWallpaperIDR() const { |
177 if (wallpaper_loader_) | 177 if (wallpaper_loader_.get()) |
178 return wallpaper_loader_->idr(); | 178 return wallpaper_loader_->idr(); |
179 else if (current_wallpaper_) | 179 else if (current_wallpaper_) |
180 return current_wallpaper_->wallpaper_info().idr; | 180 return current_wallpaper_->wallpaper_info().idr; |
181 else | 181 else |
182 return -1; | 182 return -1; |
183 } | 183 } |
184 | 184 |
185 void DesktopBackgroundController::OnRootWindowAdded( | 185 void DesktopBackgroundController::OnRootWindowAdded( |
186 aura::RootWindow* root_window) { | 186 aura::RootWindow* root_window) { |
187 // The background hasn't been set yet. | 187 // The background hasn't been set yet. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 current_wallpaper_.reset(new WallpaperResizer(info, GetRootWindowsSize(), | 235 current_wallpaper_.reset(new WallpaperResizer(info, GetRootWindowsSize(), |
236 wallpaper)); | 236 wallpaper)); |
237 current_wallpaper_->StartResize(); | 237 current_wallpaper_->StartResize(); |
238 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, | 238 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, |
239 OnWallpaperDataChanged()); | 239 OnWallpaperDataChanged()); |
240 SetDesktopBackgroundImageMode(); | 240 SetDesktopBackgroundImageMode(); |
241 } | 241 } |
242 | 242 |
243 void DesktopBackgroundController::CancelPendingWallpaperOperation() { | 243 void DesktopBackgroundController::CancelPendingWallpaperOperation() { |
244 // Set canceled flag of previous request to skip unneeded loading. | 244 // Set canceled flag of previous request to skip unneeded loading. |
245 if (wallpaper_loader_) | 245 if (wallpaper_loader_.get()) |
246 wallpaper_loader_->Cancel(); | 246 wallpaper_loader_->Cancel(); |
247 | 247 |
248 // Cancel reply callback for previous request. | 248 // Cancel reply callback for previous request. |
249 weak_ptr_factory_.InvalidateWeakPtrs(); | 249 weak_ptr_factory_.InvalidateWeakPtrs(); |
250 } | 250 } |
251 | 251 |
252 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode( | 252 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode( |
253 SkColor color) { | 253 SkColor color) { |
254 background_color_ = color; | 254 background_color_ = color; |
255 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; | 255 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 423 } |
424 return moved; | 424 return moved; |
425 } | 425 } |
426 | 426 |
427 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { | 427 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { |
428 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : | 428 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : |
429 internal::kShellWindowId_DesktopBackgroundContainer; | 429 internal::kShellWindowId_DesktopBackgroundContainer; |
430 } | 430 } |
431 | 431 |
432 } // namespace ash | 432 } // namespace ash |
OLD | NEW |