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 #ifndef ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ash/shell_window_ids.h" | |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/aura/layout_manager.h" | 12 #include "ui/aura/layout_manager.h" |
| 12 | 13 |
| 13 namespace aura { | 14 namespace aura { |
| 14 class Window; | 15 class Window; |
| 15 } | 16 } |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class Rect; | 18 class Rect; |
| 18 } | 19 } |
| 19 namespace ui { | 20 namespace ui { |
| 20 class Layer; | 21 class Layer; |
| 21 } | 22 } |
| 22 namespace views { | 23 namespace views { |
| 23 class Widget; | 24 class Widget; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace ash { | 27 namespace ash { |
| 27 namespace internal { | 28 namespace internal { |
| 28 | 29 |
| 29 // A layout manager for the root window. | 30 // A layout manager for the root window. |
| 30 // Resizes all of its immediate children to fill the bounds of the root window. | 31 // Resizes all of its immediate children to fill the bounds of the root window. |
| 31 class RootWindowLayoutManager : public aura::LayoutManager { | 32 class RootWindowLayoutManager : public aura::LayoutManager { |
| 32 public: | 33 public: |
| 33 explicit RootWindowLayoutManager(aura::Window* owner); | 34 explicit RootWindowLayoutManager(aura::Window* owner); |
| 34 virtual ~RootWindowLayoutManager(); | 35 virtual ~RootWindowLayoutManager(); |
| 35 | 36 |
| 36 views::Widget* background_widget() { return background_widget_; } | 37 views::Widget* background_widget() { |
| 37 ui::Layer* background_layer() { return background_layer_.get(); } | 38 return background_widget_[kShellWindowId_DesktopBackgroundContainer]; |
|
Nikita (slow)
2012/07/25 20:45:24
nit: fix indentation
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Removed as not needed.
| |
| 38 | 39 } |
| 39 // Sets the background to |widget|. Closes and destroys the old widget if it | 40 ui::Layer* background_layer() { |
|
Nikita (slow)
2012/07/25 20:45:24
nit: fix indentation
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Removed as not needed.
| |
| 40 // exists and differs from the new widget. | 41 return background_layer_[kShellWindowId_DesktopBackgroundContainer].get(); |
|
Nikita (slow)
2012/07/25 20:45:24
Makes sense to move this implementation to .cc
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Removed as not needed.
| |
| 41 void SetBackgroundWidget(views::Widget* widget); | 42 } |
| 42 | |
| 43 // Sets a background layer, taking ownership of |layer|. This is provided as | |
| 44 // a lightweight alternative to SetBackgroundWidget(); layers can be simple | |
| 45 // colored quads instead of being textured. | |
| 46 void SetBackgroundLayer(ui::Layer* layer); | |
| 47 | 43 |
| 48 // Overridden from aura::LayoutManager: | 44 // Overridden from aura::LayoutManager: |
| 49 virtual void OnWindowResized() OVERRIDE; | 45 virtual void OnWindowResized() OVERRIDE; |
| 50 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 46 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 51 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 47 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 52 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 48 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 53 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 49 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 54 bool visible) OVERRIDE; | 50 bool visible) OVERRIDE; |
| 55 virtual void SetChildBounds(aura::Window* child, | 51 virtual void SetChildBounds(aura::Window* child, |
| 56 const gfx::Rect& requested_bounds) OVERRIDE; | 52 const gfx::Rect& requested_bounds) OVERRIDE; |
| 57 | 53 |
| 58 private: | 54 private: |
| 59 aura::Window* owner_; | 55 aura::Window* owner_; |
| 60 | 56 |
| 61 // May be NULL if we're not painting a background. | 57 // May be NULL if we're not painting a background for that container. |
| 62 views::Widget* background_widget_; | 58 views::Widget* background_widget_[kShellWindowCount]; |
|
sky
2012/07/25 20:47:36
Do we need these changes?
Denis Kuznetsov (DE-MUC)
2012/07/26 13:51:13
Done.
| |
| 63 scoped_ptr<ui::Layer> background_layer_; | 59 scoped_ptr<ui::Layer> background_layer_[kShellWindowCount]; |
| 64 | 60 |
| 65 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); | 61 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); |
| 66 }; | 62 }; |
| 67 | 63 |
| 68 } // namespace internal | 64 } // namespace internal |
| 69 } // namespace ash | 65 } // namespace ash |
| 70 | 66 |
| 71 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 67 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
| OLD | NEW |