Port Android relocation packer to chromium build
[chromium-blink-merge.git] / ash / wm / root_window_layout_manager.cc
blob65b71f44b9bd692ac5d99b298c92a279af889724
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/window_event_dispatcher.h"
10 #include "ui/compositor/layer.h"
11 #include "ui/views/widget/widget.h"
13 namespace ash {
15 ////////////////////////////////////////////////////////////////////////////////
16 // RootWindowLayoutManager, public:
18 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
19 : owner_(owner) {
22 RootWindowLayoutManager::~RootWindowLayoutManager() {
26 ////////////////////////////////////////////////////////////////////////////////
27 // RootWindowLayoutManager, aura::LayoutManager implementation:
29 void RootWindowLayoutManager::OnWindowResized() {
30 gfx::Rect fullscreen_bounds =
31 gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
33 // Resize both our immediate children (the containers-of-containers animated
34 // by PowerButtonController) and their children (the actual containers).
35 aura::Window::Windows::const_iterator i;
36 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) {
37 (*i)->SetBounds(fullscreen_bounds);
38 aura::Window::Windows::const_iterator j;
39 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j)
40 (*j)->SetBounds(fullscreen_bounds);
42 RootWindowController* root_window_controller =
43 GetRootWindowController(owner_);
44 DesktopBackgroundWidgetController* background =
45 root_window_controller->wallpaper_controller();
47 if (!background && root_window_controller->animating_wallpaper_controller()) {
48 background = root_window_controller->animating_wallpaper_controller()->
49 GetController(false);
51 if (background)
52 background->SetBounds(fullscreen_bounds);
55 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
58 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
59 aura::Window* child) {
62 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
65 void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
66 aura::Window* child,
67 bool visible) {
70 void RootWindowLayoutManager::SetChildBounds(
71 aura::Window* child,
72 const gfx::Rect& requested_bounds) {
73 SetChildBoundsDirect(child, requested_bounds);
76 } // namespace ash