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_SHADOW_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
6 #define ASH_WM_SHADOW_CONTROLLER_H_ | 6 #define UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | |
11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
14 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
15 #include "ui/aura/client/activation_change_observer.h" | 14 #include "ui/aura/client/activation_change_observer.h" |
16 #include "ui/aura/env_observer.h" | 15 #include "ui/aura/env_observer.h" |
17 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
| 17 #include "ui/views/views_export.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
| 20 class RootWindow; |
20 class Window; | 21 class Window; |
21 } | 22 } |
22 namespace gfx { | 23 namespace gfx { |
23 class Rect; | 24 class Rect; |
24 } | 25 } |
25 | 26 |
26 namespace ash { | 27 namespace views { |
27 namespace internal { | 28 namespace corewm { |
28 | 29 |
29 class Shadow; | 30 class Shadow; |
30 | 31 |
31 // ShadowController observes changes to windows and creates and updates drop | 32 // ShadowController observes changes to windows and creates and updates drop |
32 // shadows as needed. | 33 // shadows as needed. |
33 class ASH_EXPORT ShadowController : | 34 class VIEWS_EXPORT ShadowController : |
34 public aura::EnvObserver, | 35 public aura::EnvObserver, |
35 public aura::WindowObserver, | 36 public aura::WindowObserver, |
36 public aura::client::ActivationChangeObserver { | 37 public aura::client::ActivationChangeObserver { |
37 public: | 38 public: |
38 class TestApi { | 39 class TestApi { |
39 public: | 40 public: |
40 explicit TestApi(ShadowController* controller) : controller_(controller) {} | 41 explicit TestApi(ShadowController* controller) : controller_(controller) {} |
41 ~TestApi() {} | 42 ~TestApi() {} |
42 | 43 |
43 Shadow* GetShadowForWindow(aura::Window* window) { | 44 Shadow* GetShadowForWindow(aura::Window* window) { |
44 return controller_->GetShadowForWindow(window); | 45 return controller_->GetShadowForWindow(window); |
45 } | 46 } |
46 | 47 |
47 private: | 48 private: |
48 ShadowController* controller_; // not owned | 49 ShadowController* controller_; // not owned |
49 | 50 |
50 DISALLOW_COPY_AND_ASSIGN(TestApi); | 51 DISALLOW_COPY_AND_ASSIGN(TestApi); |
51 }; | 52 }; |
52 | 53 |
53 explicit ShadowController(); | 54 explicit ShadowController(aura::RootWindow* root_window); |
54 virtual ~ShadowController(); | 55 virtual ~ShadowController(); |
55 | 56 |
56 // aura::EnvObserver override: | 57 // aura::EnvObserver override: |
57 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; | 58 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; |
58 | 59 |
59 // aura::WindowObserver overrides: | 60 // aura::WindowObserver overrides: |
60 virtual void OnWindowPropertyChanged( | 61 virtual void OnWindowPropertyChanged( |
61 aura::Window* window, const void* key, intptr_t old) OVERRIDE; | 62 aura::Window* window, const void* key, intptr_t old) OVERRIDE; |
62 virtual void OnWindowBoundsChanged( | 63 virtual void OnWindowBoundsChanged( |
63 aura::Window* window, | 64 aura::Window* window, |
(...skipping 24 matching lines...) Expand all Loading... |
88 void HandlePossibleShadowVisibilityChange(aura::Window* window); | 89 void HandlePossibleShadowVisibilityChange(aura::Window* window); |
89 | 90 |
90 // Creates a new shadow for |window| and stores it in |window_shadows_|. The | 91 // Creates a new shadow for |window| and stores it in |window_shadows_|. The |
91 // shadow's bounds are initialized and it is added to the window's layer. | 92 // shadow's bounds are initialized and it is added to the window's layer. |
92 void CreateShadowForWindow(aura::Window* window); | 93 void CreateShadowForWindow(aura::Window* window); |
93 | 94 |
94 WindowShadowMap window_shadows_; | 95 WindowShadowMap window_shadows_; |
95 | 96 |
96 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; | 97 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; |
97 | 98 |
| 99 aura::RootWindow* root_window_; |
| 100 |
98 DISALLOW_COPY_AND_ASSIGN(ShadowController); | 101 DISALLOW_COPY_AND_ASSIGN(ShadowController); |
99 }; | 102 }; |
100 | 103 |
101 } // namespace internal | 104 } // namespace corewm |
102 } // namespace ash | 105 } // namespace views |
103 | 106 |
104 #endif // ASH_WM_SHADOW_CONTROLLER_H_ | 107 #endif // UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ |
OLD | NEW |