Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/root_window_layout_manager.h" | 5 #include "ash/wm/root_window_layout_manager.h" |
| 6 #include "ash/desktop_background/desktop_background_component.h" | |
|
Nikita (slow)
2012/07/25 20:45:24
nit: This header should go with the next group.
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Done.
| |
| 6 | 7 |
| 7 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 8 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 9 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| 10 | 11 |
| 11 namespace ash { | 12 namespace ash { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 15 // RootWindowLayoutManager, public: | 16 // RootWindowLayoutManager, public: |
| 16 | 17 |
| 17 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner) | 18 RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner) |
| 18 : owner_(owner), | 19 : owner_(owner) { |
| 19 background_widget_(NULL) { | |
| 20 } | 20 } |
| 21 | 21 |
| 22 RootWindowLayoutManager::~RootWindowLayoutManager() { | 22 RootWindowLayoutManager::~RootWindowLayoutManager() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void RootWindowLayoutManager::SetBackgroundWidget(views::Widget* widget) { | |
| 26 if (widget == background_widget_) | |
| 27 return; | |
| 28 // Close now so that the focus manager will be deleted before shutdown. | |
| 29 if (background_widget_) | |
| 30 background_widget_->CloseNow(); | |
| 31 background_widget_ = widget; | |
| 32 } | |
| 33 | |
| 34 void RootWindowLayoutManager::SetBackgroundLayer(ui::Layer* layer) { | |
| 35 background_layer_.reset(layer); | |
| 36 } | |
| 37 | 25 |
| 38 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
| 39 // RootWindowLayoutManager, aura::LayoutManager implementation: | 27 // RootWindowLayoutManager, aura::LayoutManager implementation: |
| 40 | 28 |
| 41 void RootWindowLayoutManager::OnWindowResized() { | 29 void RootWindowLayoutManager::OnWindowResized() { |
| 42 gfx::Rect fullscreen_bounds = | 30 gfx::Rect fullscreen_bounds = |
| 43 gfx::Rect(owner_->bounds().width(), owner_->bounds().height()); | 31 gfx::Rect(owner_->bounds().width(), owner_->bounds().height()); |
| 44 | 32 |
| 45 // Resize both our immediate children (the containers-of-containers animated | 33 // Resize both our immediate children (the containers-of-containers animated |
| 46 // by PowerButtonController) and their children (the actual containers). | 34 // by PowerButtonController) and their children (the actual containers). |
| 47 aura::Window::Windows::const_iterator i; | 35 aura::Window::Windows::const_iterator i; |
| 48 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { | 36 for (i = owner_->children().begin(); i != owner_->children().end(); ++i) { |
| 49 (*i)->SetBounds(fullscreen_bounds); | 37 (*i)->SetBounds(fullscreen_bounds); |
| 50 aura::Window::Windows::const_iterator j; | 38 aura::Window::Windows::const_iterator j; |
| 51 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j) | 39 for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j) |
| 52 (*j)->SetBounds(fullscreen_bounds); | 40 (*j)->SetBounds(fullscreen_bounds); |
| 53 } | 41 } |
| 54 | 42 internal::DesktopBackgroundComponent* component = owner_-> |
|
Nikita (slow)
2012/07/25 20:45:24
nit: Place owner_->GetProperty() on the same line.
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Done.
| |
| 55 if (background_widget_) | 43 GetProperty(internal::kWindowDesktopComponent); |
| 56 background_widget_->SetBounds(fullscreen_bounds); | 44 if (component) |
| 57 if (background_layer_.get()) | 45 component->SetBounds(fullscreen_bounds); |
| 58 background_layer_->SetBounds(fullscreen_bounds); | |
| 59 } | 46 } |
| 60 | 47 |
| 61 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 48 void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| 62 } | 49 } |
| 63 | 50 |
| 64 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout( | 51 void RootWindowLayoutManager::OnWillRemoveWindowFromLayout( |
| 65 aura::Window* child) { | 52 aura::Window* child) { |
| 66 } | 53 } |
| 67 | 54 |
| 68 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { | 55 void RootWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { |
| 69 } | 56 } |
| 70 | 57 |
| 71 void RootWindowLayoutManager::OnChildWindowVisibilityChanged( | 58 void RootWindowLayoutManager::OnChildWindowVisibilityChanged( |
| 72 aura::Window* child, | 59 aura::Window* child, |
| 73 bool visible) { | 60 bool visible) { |
| 74 } | 61 } |
| 75 | 62 |
| 76 void RootWindowLayoutManager::SetChildBounds( | 63 void RootWindowLayoutManager::SetChildBounds( |
| 77 aura::Window* child, | 64 aura::Window* child, |
| 78 const gfx::Rect& requested_bounds) { | 65 const gfx::Rect& requested_bounds) { |
| 79 SetChildBoundsDirect(child, requested_bounds); | 66 SetChildBoundsDirect(child, requested_bounds); |
| 80 } | 67 } |
| 81 | 68 |
| 82 } // namespace internal | 69 } // namespace internal |
| 83 } // namespace ash | 70 } // namespace ash |
| OLD | NEW |