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
3 // found in the LICENSE file.
5 #include "ash/wm/root_window_layout_manager.h"
7 #include "ash/desktop_background/desktop_background_widget_controller.h"
8 #include "ash/root_window_controller.h"
9 #include "ash/root_window_settings.h"
10 #include "ui/aura/window_event_dispatcher.h"
11 #include "ui/compositor/layer.h"
12 #include "ui/views/widget/widget.h"
16 ////////////////////////////////////////////////////////////////////////////////
17 // RootWindowLayoutManager, public:
19 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window
* owner
)
23 RootWindowLayoutManager::~RootWindowLayoutManager() {
27 ////////////////////////////////////////////////////////////////////////////////
28 // RootWindowLayoutManager, aura::LayoutManager implementation:
30 void RootWindowLayoutManager::OnWindowResized() {
31 // X event may arrive during shutdown.
32 if (GetRootWindowSettings(owner_
->GetRootWindow())->shutdown
)
35 gfx::Rect fullscreen_bounds
=
36 gfx::Rect(owner_
->bounds().width(), owner_
->bounds().height());
38 // Resize both our immediate children (the containers-of-containers animated
39 // by PowerButtonController) and their children (the actual containers).
40 aura::Window::Windows::const_iterator i
;
41 for (i
= owner_
->children().begin(); i
!= owner_
->children().end(); ++i
) {
42 (*i
)->SetBounds(fullscreen_bounds
);
43 aura::Window::Windows::const_iterator j
;
44 for (j
= (*i
)->children().begin(); j
!= (*i
)->children().end(); ++j
)
45 (*j
)->SetBounds(fullscreen_bounds
);
47 RootWindowController
* root_window_controller
=
48 GetRootWindowController(owner_
);
49 DesktopBackgroundWidgetController
* background
=
50 root_window_controller
->wallpaper_controller();
52 if (!background
&& root_window_controller
->animating_wallpaper_controller()) {
53 background
= root_window_controller
->animating_wallpaper_controller()->
57 background
->SetBounds(fullscreen_bounds
);
60 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window
* child
) {
63 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
64 aura::Window
* child
) {
67 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window
* child
) {
70 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
75 void RootWindowLayoutManager::SetChildBounds(
77 const gfx::Rect
& requested_bounds
) {
78 SetChildBoundsDirect(child
, requested_bounds
);