OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_AURA_SHELL_SHADOW_CONTROLLER_H_ | 5 #ifndef UI_AURA_SHELL_SHADOW_CONTROLLER_H_ |
6 #define UI_AURA_SHELL_SHADOW_CONTROLLER_H_ | 6 #define UI_AURA_SHELL_SHADOW_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 DISALLOW_COPY_AND_ASSIGN(TestApi); | 47 DISALLOW_COPY_AND_ASSIGN(TestApi); |
48 }; | 48 }; |
49 | 49 |
50 explicit ShadowController(); | 50 explicit ShadowController(); |
51 virtual ~ShadowController(); | 51 virtual ~ShadowController(); |
52 | 52 |
53 // aura::DesktopObserver override: | 53 // aura::DesktopObserver override: |
54 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; | 54 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; |
55 | 55 |
56 // aura::WindowObserver overrides: | 56 // aura::WindowObserver overrides: |
57 virtual void OnWindowParentChanged( | |
58 aura::Window* window, aura::Window* parent) OVERRIDE; | |
59 virtual void OnWindowPropertyChanged( | 57 virtual void OnWindowPropertyChanged( |
60 aura::Window* window, const char* name, void* old) OVERRIDE; | 58 aura::Window* window, const char* name, void* old) OVERRIDE; |
61 virtual void OnWindowVisibilityChanged( | |
62 aura::Window* window, bool visible) OVERRIDE; | |
63 virtual void OnWindowBoundsChanged( | 59 virtual void OnWindowBoundsChanged( |
64 aura::Window* window, const gfx::Rect& bounds) OVERRIDE; | 60 aura::Window* window, const gfx::Rect& bounds) OVERRIDE; |
65 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; | |
66 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 61 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
67 | 62 |
68 private: | 63 private: |
69 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap; | 64 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap; |
70 | 65 |
71 // Checks if |window| is visible and contains a property requesting a shadow. | 66 // Checks if |window| is visible and contains a property requesting a shadow. |
72 bool ShouldShowShadowForWindow(aura::Window* window) const; | 67 bool ShouldShowShadowForWindow(aura::Window* window) const; |
73 | 68 |
74 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow | 69 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow |
75 // exists. | 70 // exists. |
76 Shadow* GetShadowForWindow(aura::Window* window); | 71 Shadow* GetShadowForWindow(aura::Window* window); |
77 | 72 |
78 // Shows or hides |window|'s shadow as needed (creating the shadow if | 73 // Shows or hides |window|'s shadow as needed (creating the shadow if |
79 // necessary). | 74 // necessary). |
80 void HandlePossibleShadowVisibilityChange(aura::Window* window); | 75 void HandlePossibleShadowVisibilityChange(aura::Window* window); |
81 | 76 |
82 // Creates a new shadow for |window| and stores it in |window_shadows_|. The | 77 // Creates a new shadow for |window| and stores it in |window_shadows_|. The |
83 // shadow's visibility, bounds, and stacking are initialized appropriately. | 78 // shadow's bounds are initialized and it is added to the window's layer. |
84 void CreateShadowForWindow(aura::Window* window); | 79 void CreateShadowForWindow(aura::Window* window); |
85 | 80 |
86 // Stacks |shadow|'s layer directly beneath |window|'s layer. | |
87 void StackShadowBelowWindow(Shadow* shadow, aura::Window* window); | |
88 | |
89 WindowShadowMap window_shadows_; | 81 WindowShadowMap window_shadows_; |
90 | 82 |
91 DISALLOW_COPY_AND_ASSIGN(ShadowController); | 83 DISALLOW_COPY_AND_ASSIGN(ShadowController); |
92 }; | 84 }; |
93 | 85 |
94 } // namepsace aura_shell | 86 } // namepsace aura_shell |
95 } // namepsace internal | 87 } // namepsace internal |
96 | 88 |
97 #endif // UI_AURA_SHELL_SHADOW_CONTROLLER_H_ | 89 #endif // UI_AURA_SHELL_SHADOW_CONTROLLER_H_ |
OLD | NEW |