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/desktop_background/desktop_background_widget_controller.h" | 8 #include "ash/desktop_background/desktop_background_widget_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_factory.h" | 10 #include "ash/shell_factory.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void DesktopBackgroundController::OnWallpaperLoadCompleted( | 253 void DesktopBackgroundController::OnWallpaperLoadCompleted( |
254 scoped_refptr<WallpaperOperation> wo) { | 254 scoped_refptr<WallpaperOperation> wo) { |
255 current_wallpaper_.reset(wo->ReleaseWallpaperData()); | 255 current_wallpaper_.reset(wo->ReleaseWallpaperData()); |
256 | 256 |
257 SetDesktopBackgroundImageMode(); | 257 SetDesktopBackgroundImageMode(); |
258 | 258 |
259 DCHECK(wo.get() == wallpaper_op_.get()); | 259 DCHECK(wo.get() == wallpaper_op_.get()); |
260 wallpaper_op_ = NULL; | 260 wallpaper_op_ = NULL; |
261 } | 261 } |
262 | 262 |
| 263 void DesktopBackgroundController::NotifyAnimationFinished() { |
| 264 Shell* shell = Shell::GetInstance(); |
| 265 shell->user_wallpaper_delegate()->OnWallpaperAnimationFinished(); |
| 266 } |
| 267 |
263 ui::Layer* DesktopBackgroundController::SetColorLayerForContainer( | 268 ui::Layer* DesktopBackgroundController::SetColorLayerForContainer( |
264 SkColor color, | 269 SkColor color, |
265 aura::RootWindow* root_window, | 270 aura::RootWindow* root_window, |
266 int container_id) { | 271 int container_id) { |
267 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); | 272 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); |
268 background_layer->SetColor(color); | 273 background_layer->SetColor(color); |
269 | 274 |
270 Shell::GetContainer(root_window,container_id)-> | 275 Shell::GetContainer(root_window,container_id)-> |
271 layer()->Add(background_layer); | 276 layer()->Add(background_layer); |
| 277 |
| 278 MessageLoop::current()->PostTask(FROM_HERE, |
| 279 base::Bind(&DesktopBackgroundController::NotifyAnimationFinished, |
| 280 weak_ptr_factory_.GetWeakPtr())); |
| 281 |
272 return background_layer; | 282 return background_layer; |
273 } | 283 } |
274 | 284 |
275 void DesktopBackgroundController::InstallComponent( | 285 void DesktopBackgroundController::InstallComponent( |
276 aura::RootWindow* root_window) { | 286 aura::RootWindow* root_window) { |
277 internal::DesktopBackgroundWidgetController* component = NULL; | 287 internal::DesktopBackgroundWidgetController* component = NULL; |
278 int container_id = GetBackgroundContainerId(locked_); | 288 int container_id = GetBackgroundContainerId(locked_); |
279 | 289 |
280 switch (desktop_background_mode_) { | 290 switch (desktop_background_mode_) { |
281 case BACKGROUND_IMAGE: { | 291 case BACKGROUND_IMAGE: { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 iter != root_windows.end(); ++iter) { | 356 iter != root_windows.end(); ++iter) { |
347 gfx::Size root_window_size = (*iter)->GetHostSize(); | 357 gfx::Size root_window_size = (*iter)->GetHostSize(); |
348 if (root_window_size.width() > kSmallWallpaperMaximalWidth || | 358 if (root_window_size.width() > kSmallWallpaperMaximalWidth || |
349 root_window_size.height() > kSmallWallpaperMaximalHeight) | 359 root_window_size.height() > kSmallWallpaperMaximalHeight) |
350 resolution = LARGE; | 360 resolution = LARGE; |
351 } | 361 } |
352 return resolution; | 362 return resolution; |
353 } | 363 } |
354 | 364 |
355 } // namespace ash | 365 } // namespace ash |
OLD | NEW |