Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: ash/desktop_background/desktop_background_controller.cc

Issue 11016030: cros: Fix missing windows/launcher after resume/screen unlock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_factory.h" 11 #include "ash/shell_factory.h"
12 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
13 #include "ash/wm/root_window_layout_manager.h" 13 #include "ash/wm/root_window_layout_manager.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/synchronization/cancellation_flag.h" 16 #include "base/synchronization/cancellation_flag.h"
17 #include "base/threading/worker_pool.h" 17 #include "base/threading/worker_pool.h"
18 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
19 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
22 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
25 25
26 using ash::internal::DesktopBackgroundWidgetController;
27 using ash::internal::kComponentWrapper;
28 using ash::internal::kWindowDesktopComponent;
29
26 namespace ash { 30 namespace ash {
27 namespace { 31 namespace {
28 32
29 const SkColor kTransparentColor = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); 33 const SkColor kTransparentColor = SkColorSetARGB(0x00, 0x00, 0x00, 0x00);
30 34
31 internal::RootWindowLayoutManager* GetRootWindowLayoutManager( 35 internal::RootWindowLayoutManager* GetRootWindowLayoutManager(
32 aura::RootWindow* root_window) { 36 aura::RootWindow* root_window) {
33 return static_cast<internal::RootWindowLayoutManager*>( 37 return static_cast<internal::RootWindowLayoutManager*>(
34 root_window->layout_manager()); 38 root_window->layout_manager());
35 } 39 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 342 }
339 } 343 }
340 344
341 bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container, 345 bool DesktopBackgroundController::ReparentBackgroundWidgets(int src_container,
342 int dst_container) { 346 int dst_container) {
343 bool moved = false; 347 bool moved = false;
344 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 348 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
345 for (Shell::RootWindowList::iterator iter = root_windows.begin(); 349 for (Shell::RootWindowList::iterator iter = root_windows.begin();
346 iter != root_windows.end(); ++iter) { 350 iter != root_windows.end(); ++iter) {
347 aura::RootWindow* root_window = *iter; 351 aura::RootWindow* root_window = *iter;
348 if (root_window->GetProperty(internal::kComponentWrapper)) { 352 // In the steady state (no animation playing) the background widget
349 internal::DesktopBackgroundWidgetController* component = root_window-> 353 // controller exists in the kWindowDesktopComponent property.
350 GetProperty(internal::kWindowDesktopComponent); 354 DesktopBackgroundWidgetController* desktop_component = root_window->
351 // Wallpaper animation may not finish at this point. Try to get component 355 GetProperty(kWindowDesktopComponent);
352 // from kComponentWrapper instead. 356 if (desktop_component) {
353 if (!component) { 357 moved |= desktop_component->Reparent(root_window,
354 component = root_window->GetProperty(internal::kComponentWrapper)->
355 GetComponent(false);
356 }
357 DCHECK(component);
358 moved = moved || component->Reparent(root_window,
359 src_container, 358 src_container,
360 dst_container); 359 dst_container);
361 } 360 }
361 // During desktop show animations the controller lives in kComponentWrapper.
362 // NOTE: If a wallpaper load happens during a desktop show animation there
363 // can temporarily be two desktop background widgets. We must reparent
364 // both of them - one above and one here.
365 DesktopBackgroundWidgetController* wrapped_component =
366 root_window->GetProperty(kComponentWrapper) ?
367 root_window->GetProperty(kComponentWrapper)->GetComponent(false) :
368 NULL;
369 if (wrapped_component) {
370 moved |= wrapped_component->Reparent(root_window,
371 src_container,
372 dst_container);
373 }
362 } 374 }
363 return moved; 375 return moved;
364 } 376 }
365 377
366 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { 378 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) {
367 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : 379 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer :
368 internal::kShellWindowId_DesktopBackgroundContainer; 380 internal::kShellWindowId_DesktopBackgroundContainer;
369 } 381 }
370 382
371 } // namespace ash 383 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698