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 "ui/aura/root_window.h"
10 #include "ui/compositor/layer.h"
11 #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 gfx::Rect fullscreen_bounds
=
32 gfx::Rect(owner_
->bounds().width(), owner_
->bounds().height());
34 // Resize both our immediate children (the containers-of-containers animated
35 // by PowerButtonController) and their children (the actual containers).
36 aura::Window::Windows::const_iterator i
;
37 for (i
= owner_
->children().begin(); i
!= owner_
->children().end(); ++i
) {
38 (*i
)->SetBounds(fullscreen_bounds
);
39 aura::Window::Windows::const_iterator j
;
40 for (j
= (*i
)->children().begin(); j
!= (*i
)->children().end(); ++j
)
41 (*j
)->SetBounds(fullscreen_bounds
);
43 RootWindowController
* root_window_controller
= GetRootWindowController(
44 static_cast<aura::RootWindow
*>(owner_
));
45 DesktopBackgroundWidgetController
* background
=
46 root_window_controller
->wallpaper_controller();
48 if (!background
&& root_window_controller
->animating_wallpaper_controller()) {
49 background
= root_window_controller
->animating_wallpaper_controller()->
53 background
->SetBounds(fullscreen_bounds
);
56 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window
* child
) {
59 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
60 aura::Window
* child
) {
63 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window
* child
) {
66 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
71 void RootWindowLayoutManager::SetChildBounds(
73 const gfx::Rect
& requested_bounds
) {
74 SetChildBoundsDirect(child
, requested_bounds
);
77 } // namespace internal