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.
4
5#include "ash/wm/root_window_layout_manager.h"
6
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"
12
13namespace ash {
14
15////////////////////////////////////////////////////////////////////////////////
16// RootWindowLayoutManager, public:
17
18RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
19    : owner_(owner) {
20}
21
22RootWindowLayoutManager::~RootWindowLayoutManager() {
23}
24
25
26////////////////////////////////////////////////////////////////////////////////
27// RootWindowLayoutManager, aura::LayoutManager implementation:
28
29void RootWindowLayoutManager::OnWindowResized() {
30  gfx::Rect fullscreen_bounds =
31      gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
32
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);
41  }
42  RootWindowController* root_window_controller =
43      GetRootWindowController(owner_);
44  DesktopBackgroundWidgetController* background =
45      root_window_controller->wallpaper_controller();
46
47  if (!background && root_window_controller->animating_wallpaper_controller()) {
48    background = root_window_controller->animating_wallpaper_controller()->
49        GetController(false);
50  }
51  if (background)
52    background->SetBounds(fullscreen_bounds);
53}
54
55void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
56}
57
58void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(
59    aura::Window* child) {
60}
61
62void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
63}
64
65void RootWindowLayoutManager::OnChildWindowVisibilityChanged(
66    aura::Window* child,
67    bool visible) {
68}
69
70void RootWindowLayoutManager::SetChildBounds(
71    aura::Window* child,
72    const gfx::Rect& requested_bounds) {
73  SetChildBoundsDirect(child, requested_bounds);
74}
75
76}  // namespace ash
77