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 UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
6 #define UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ | 6 #define UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "ui/aura/client/activation_change_observer.h" | |
15 #include "ui/aura/env_observer.h" | 14 #include "ui/aura/env_observer.h" |
16 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
| 16 #include "ui/views/corewm/activation_change_shim.h" |
17 #include "ui/views/views_export.h" | 17 #include "ui/views/views_export.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class RootWindow; | 20 class RootWindow; |
21 class Window; | 21 class Window; |
22 } | 22 } |
23 namespace gfx { | 23 namespace gfx { |
24 class Rect; | 24 class Rect; |
25 } | 25 } |
26 | 26 |
27 namespace views { | 27 namespace views { |
28 namespace corewm { | 28 namespace corewm { |
29 | 29 |
30 class Shadow; | 30 class Shadow; |
31 | 31 |
32 // ShadowController observes changes to windows and creates and updates drop | 32 // ShadowController observes changes to windows and creates and updates drop |
33 // shadows as needed. | 33 // shadows as needed. |
34 class VIEWS_EXPORT ShadowController : | 34 class VIEWS_EXPORT ShadowController : |
35 public aura::EnvObserver, | 35 public aura::EnvObserver, |
36 public aura::WindowObserver, | 36 public aura::WindowObserver, |
37 public aura::client::ActivationChangeObserver { | 37 public ActivationChangeShim { |
38 public: | 38 public: |
39 class TestApi { | 39 class TestApi { |
40 public: | 40 public: |
41 explicit TestApi(ShadowController* controller) : controller_(controller) {} | 41 explicit TestApi(ShadowController* controller) : controller_(controller) {} |
42 ~TestApi() {} | 42 ~TestApi() {} |
43 | 43 |
44 Shadow* GetShadowForWindow(aura::Window* window) { | 44 Shadow* GetShadowForWindow(aura::Window* window) { |
45 return controller_->GetShadowForWindow(window); | 45 return controller_->GetShadowForWindow(window); |
46 } | 46 } |
47 | 47 |
(...skipping 11 matching lines...) Expand all Loading... |
59 | 59 |
60 // aura::WindowObserver overrides: | 60 // aura::WindowObserver overrides: |
61 virtual void OnWindowPropertyChanged( | 61 virtual void OnWindowPropertyChanged( |
62 aura::Window* window, const void* key, intptr_t old) OVERRIDE; | 62 aura::Window* window, const void* key, intptr_t old) OVERRIDE; |
63 virtual void OnWindowBoundsChanged( | 63 virtual void OnWindowBoundsChanged( |
64 aura::Window* window, | 64 aura::Window* window, |
65 const gfx::Rect& old_bounds, | 65 const gfx::Rect& old_bounds, |
66 const gfx::Rect& new_bounds) OVERRIDE; | 66 const gfx::Rect& new_bounds) OVERRIDE; |
67 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 67 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
68 | 68 |
69 // aura::client::ActivationChangeObserver overrides: | 69 // ActivationChangeShim overrides: |
70 virtual void OnWindowActivated(aura::Window* active, | 70 virtual void OnWindowActivated(aura::Window* active, |
71 aura::Window* old_active) OVERRIDE; | 71 aura::Window* old_active) OVERRIDE; |
72 | 72 |
73 private: | 73 private: |
74 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap; | 74 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap; |
75 | 75 |
76 // Checks if |window| is visible and contains a property requesting a shadow. | 76 // Checks if |window| is visible and contains a property requesting a shadow. |
77 bool ShouldShowShadowForWindow(aura::Window* window) const; | 77 bool ShouldShowShadowForWindow(aura::Window* window) const; |
78 | 78 |
79 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow | 79 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow |
(...skipping 18 matching lines...) Expand all Loading... |
98 | 98 |
99 aura::RootWindow* root_window_; | 99 aura::RootWindow* root_window_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(ShadowController); | 101 DISALLOW_COPY_AND_ASSIGN(ShadowController); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace corewm | 104 } // namespace corewm |
105 } // namespace views | 105 } // namespace views |
106 | 106 |
107 #endif // UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ | 107 #endif // UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
OLD | NEW |