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