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 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 | |
48 // Overridden from aura::LayoutManager: | 37 // Overridden from aura::LayoutManager: |
49 virtual void OnWindowResized() OVERRIDE; | 38 virtual void OnWindowResized() OVERRIDE; |
50 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 39 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
51 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 40 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
52 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 41 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
53 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 42 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
54 bool visible) OVERRIDE; | 43 bool visible) OVERRIDE; |
55 virtual void SetChildBounds(aura::Window* child, | 44 virtual void SetChildBounds(aura::Window* child, |
56 const gfx::Rect& requested_bounds) OVERRIDE; | 45 const gfx::Rect& requested_bounds) OVERRIDE; |
57 | 46 |
58 private: | 47 private: |
59 aura::Window* owner_; | 48 aura::Window* owner_; |
60 | 49 |
61 // May be NULL if we're not painting a background. | |
62 views::Widget* background_widget_; | |
63 scoped_ptr<ui::Layer> background_layer_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); | 50 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); |
66 }; | 51 }; |
67 | 52 |
68 } // namespace internal | 53 } // namespace internal |
69 } // namespace ash | 54 } // namespace ash |
70 | 55 |
71 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 56 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |