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]; |
39 } | |
40 ui::Layer* background_layer() { | |
41 return background_layer_[kShellWindowId_DesktopBackgroundContainer].get(); | |
42 } | |
38 | 43 |
39 // Sets the background to |widget|. Closes and destroys the old widget if it | 44 // Sets the background in container |container_id| to |widget|. |
40 // exists and differs from the new widget. | 45 // Closes and destroys the old widget for that container if it exists and |
41 void SetBackgroundWidget(views::Widget* widget); | 46 // differs from the new widget. |
47 void SetBackgroundWidget(views::Widget* widget, int container_id); | |
42 | 48 |
43 // Sets a background layer, taking ownership of |layer|. This is provided as | 49 // Sets a background layer for container |container_id|, taking ownership of |
44 // a lightweight alternative to SetBackgroundWidget(); layers can be simple | 50 // |layer|. This is provided as a lightweight alternative to |
45 // colored quads instead of being textured. | 51 // SetBackgroundWidget(); layers can be simple colored quads instead of being |
46 void SetBackgroundLayer(ui::Layer* layer); | 52 // textured. |
53 void SetBackgroundLayer(ui::Layer* layer, int container_id); | |
54 | |
55 void DropBackgroundForContainer(int container_id); | |
47 | 56 |
48 // Overridden from aura::LayoutManager: | 57 // Overridden from aura::LayoutManager: |
49 virtual void OnWindowResized() OVERRIDE; | 58 virtual void OnWindowResized() OVERRIDE; |
50 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 59 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
51 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 60 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
52 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 61 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
53 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 62 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
54 bool visible) OVERRIDE; | 63 bool visible) OVERRIDE; |
55 virtual void SetChildBounds(aura::Window* child, | 64 virtual void SetChildBounds(aura::Window* child, |
56 const gfx::Rect& requested_bounds) OVERRIDE; | 65 const gfx::Rect& requested_bounds) OVERRIDE; |
57 | 66 |
58 private: | 67 private: |
59 aura::Window* owner_; | 68 aura::Window* owner_; |
60 | 69 |
61 // May be NULL if we're not painting a background. | 70 // May be NULL if we're not painting a background for that container. |
62 views::Widget* background_widget_; | 71 views::Widget* background_widget_[kShellWindowCount]; |
sky
2012/07/20 23:57:04
I don't understand this. Why do we need a backgrou
Denis Kuznetsov (DE-MUC)
2012/07/23 14:01:09
I'd say we have a kind of technical debt here: it
| |
63 scoped_ptr<ui::Layer> background_layer_; | 72 scoped_ptr<ui::Layer> background_layer_[kShellWindowCount]; |
64 | 73 |
65 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); | 74 DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager); |
66 }; | 75 }; |
67 | 76 |
68 } // namespace internal | 77 } // namespace internal |
69 } // namespace ash | 78 } // namespace ash |
70 | 79 |
71 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ | 80 #endif // ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |