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" | |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/layout_manager.h" | 11 #include "ui/aura/layout_manager.h" |
13 | 12 |
14 namespace aura { | 13 namespace aura { |
15 class Window; | 14 class Window; |
16 } | 15 } |
17 namespace gfx { | 16 namespace gfx { |
18 class Rect; | 17 class Rect; |
19 } | 18 } |
20 namespace ui { | 19 namespace ui { |
21 class Layer; | 20 class Layer; |
22 } | 21 } |
23 namespace views { | 22 namespace views { |
24 class Widget; | 23 class Widget; |
25 } | 24 } |
26 | 25 |
27 namespace ash { | 26 namespace ash { |
28 namespace internal { | 27 namespace internal { |
29 | 28 |
30 // A layout manager for the root window. | 29 // A layout manager for the root window. |
31 // Resizes all of its immediate children to fill the bounds of the root window. | 30 // Resizes all of its immediate children to fill the bounds of the root window. |
32 class RootWindowLayoutManager : public aura::LayoutManager { | 31 class RootWindowLayoutManager : public aura::LayoutManager { |
33 public: | 32 public: |
34 explicit RootWindowLayoutManager(aura::Window* owner); | 33 explicit RootWindowLayoutManager(aura::Window* owner); |
35 virtual ~RootWindowLayoutManager(); | 34 virtual ~RootWindowLayoutManager(); |
36 | 35 |
| 36 views::Widget* background_widget() { return background_widget_; } |
| 37 ui::Layer* background_layer() { return background_layer_.get(); } |
| 38 |
| 39 // Sets the background to |widget|. Closes and destroys the old widget if it |
| 40 // exists and differs from the new widget. |
| 41 void SetBackgroundWidget(views::Widget* widget); |
| 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 |
37 // Overridden from aura::LayoutManager: | 48 // Overridden from aura::LayoutManager: |
38 virtual void OnWindowResized() OVERRIDE; | 49 virtual void OnWindowResized() OVERRIDE; |
39 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 50 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
40 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 51 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
41 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 52 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
42 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 53 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
43 bool visible) OVERRIDE; | 54 bool visible) OVERRIDE; |
44 virtual void SetChildBounds(aura::Window* child, | 55 virtual void SetChildBounds(aura::Window* child, |
45 const gfx::Rect& requested_bounds) OVERRIDE; | 56 const gfx::Rect& requested_bounds) OVERRIDE; |
46 | 57 |
47 private: | 58 private: |
48 aura::Window* owner_; | 59 aura::Window* owner_; |
49 | 60 |
| 61 // May be NULL if we're not painting a background. |
| 62 views::Widget* background_widget_; |
| 63 scoped_ptr<ui::Layer> background_layer_; |
| 64 |
50 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); | 65 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); |
51 }; | 66 }; |
52 | 67 |
53 } // namespace internal | 68 } // namespace internal |
54 } // namespace ash | 69 } // namespace ash |
55 | 70 |
56 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 71 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |