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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
9 #include "ash/desktop_background/desktop_background_view.h" | 9 #include "ash/desktop_background/desktop_background_view.h" |
10 #include "ash/desktop_background/desktop_background_widget_controller.h" | 10 #include "ash/desktop_background/desktop_background_widget_controller.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, | 355 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, |
356 OnWallpaperDataChanged()); | 356 OnWallpaperDataChanged()); |
357 | 357 |
358 SetDesktopBackgroundImageMode(); | 358 SetDesktopBackgroundImageMode(); |
359 | 359 |
360 DCHECK(loader.get() == wallpaper_loader_.get()); | 360 DCHECK(loader.get() == wallpaper_loader_.get()); |
361 wallpaper_loader_ = NULL; | 361 wallpaper_loader_ = NULL; |
362 } | 362 } |
363 | 363 |
364 void DesktopBackgroundController::InstallDesktopController( | 364 void DesktopBackgroundController::InstallDesktopController( |
365 aura::Window* root_window) { | 365 aura::RootWindow* root_window) { |
366 internal::DesktopBackgroundWidgetController* component = NULL; | 366 internal::DesktopBackgroundWidgetController* component = NULL; |
367 int container_id = GetBackgroundContainerId(locked_); | 367 int container_id = GetBackgroundContainerId(locked_); |
368 | 368 |
369 switch (desktop_background_mode_) { | 369 switch (desktop_background_mode_) { |
370 case BACKGROUND_IMAGE: { | 370 case BACKGROUND_IMAGE: { |
371 views::Widget* widget = internal::CreateDesktopBackground(root_window, | 371 views::Widget* widget = internal::CreateDesktopBackground(root_window, |
372 container_id); | 372 container_id); |
373 component = new internal::DesktopBackgroundWidgetController(widget); | 373 component = new internal::DesktopBackgroundWidgetController(widget); |
374 break; | 374 break; |
375 } | 375 } |
376 case BACKGROUND_NONE: | 376 case BACKGROUND_NONE: |
377 NOTREACHED(); | 377 NOTREACHED(); |
378 return; | 378 return; |
379 } | 379 } |
380 internal::GetRootWindowController(root_window)-> | 380 internal::GetRootWindowController(root_window)-> |
381 SetAnimatingWallpaperController( | 381 SetAnimatingWallpaperController( |
382 new internal::AnimatingDesktopController(component)); | 382 new internal::AnimatingDesktopController(component)); |
383 | 383 |
384 component->StartAnimating(internal::GetRootWindowController(root_window)); | 384 component->StartAnimating(internal::GetRootWindowController(root_window)); |
385 } | 385 } |
386 | 386 |
387 void DesktopBackgroundController::InstallDesktopControllerForAllWindows() { | 387 void DesktopBackgroundController::InstallDesktopControllerForAllWindows() { |
388 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 388 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
389 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 389 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
390 iter != root_windows.end(); ++iter) { | 390 iter != root_windows.end(); ++iter) { |
391 InstallDesktopController(*iter); | 391 InstallDesktopController(*iter); |
392 } | 392 } |
393 current_max_display_size_ = GetMaxDisplaySizeInNative(); | 393 current_max_display_size_ = GetMaxDisplaySizeInNative(); |
394 } | 394 } |
395 | 395 |
396 bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container, | 396 bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container, |
397 int dst_container) { | 397 int dst_container) { |
398 bool moved = false; | 398 bool moved = false; |
399 Shell::RootWindowControllerList controllers = | 399 Shell::RootWindowControllerList controllers = |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 iter->rotation() == gfx::Display::ROTATE_270) { | 461 iter->rotation() == gfx::Display::ROTATE_270) { |
462 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); | 462 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); |
463 } | 463 } |
464 width = std::max(size_in_pixel.width(), width); | 464 width = std::max(size_in_pixel.width(), width); |
465 height = std::max(size_in_pixel.height(), height); | 465 height = std::max(size_in_pixel.height(), height); |
466 } | 466 } |
467 return gfx::Size(width, height); | 467 return gfx::Size(width, height); |
468 } | 468 } |
469 | 469 |
470 } // namespace ash | 470 } // namespace ash |
OLD | NEW |