Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: ash/wm/shadow_controller.h

Issue 11275296: Move shadow code to views\corewm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/shadow.cc ('k') | ash/wm/shadow_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_SHADOW_CONTROLLER_H_
6 #define ASH_WM_SHADOW_CONTROLLER_H_
7
8 #include <map>
9
10 #include "ash/ash_export.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/scoped_observer.h"
15 #include "ui/aura/client/activation_change_observer.h"
16 #include "ui/aura/env_observer.h"
17 #include "ui/aura/window_observer.h"
18
19 namespace aura {
20 class Window;
21 }
22 namespace gfx {
23 class Rect;
24 }
25
26 namespace ash {
27 namespace internal {
28
29 class Shadow;
30
31 // ShadowController observes changes to windows and creates and updates drop
32 // shadows as needed.
33 class ASH_EXPORT ShadowController :
34 public aura::EnvObserver,
35 public aura::WindowObserver,
36 public aura::client::ActivationChangeObserver {
37 public:
38 class TestApi {
39 public:
40 explicit TestApi(ShadowController* controller) : controller_(controller) {}
41 ~TestApi() {}
42
43 Shadow* GetShadowForWindow(aura::Window* window) {
44 return controller_->GetShadowForWindow(window);
45 }
46
47 private:
48 ShadowController* controller_; // not owned
49
50 DISALLOW_COPY_AND_ASSIGN(TestApi);
51 };
52
53 explicit ShadowController();
54 virtual ~ShadowController();
55
56 // aura::EnvObserver override:
57 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
58
59 // aura::WindowObserver overrides:
60 virtual void OnWindowPropertyChanged(
61 aura::Window* window, const void* key, intptr_t old) OVERRIDE;
62 virtual void OnWindowBoundsChanged(
63 aura::Window* window,
64 const gfx::Rect& old_bounds,
65 const gfx::Rect& new_bounds) OVERRIDE;
66 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
67
68 // aura::client::ActivationChangeObserver overrides:
69 virtual void OnWindowActivated(aura::Window* active,
70 aura::Window* old_active) OVERRIDE;
71
72 private:
73 typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap;
74
75 // Checks if |window| is visible and contains a property requesting a shadow.
76 bool ShouldShowShadowForWindow(aura::Window* window) const;
77
78 // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow
79 // exists.
80 Shadow* GetShadowForWindow(aura::Window* window);
81
82 // Updates the shadow styles for windows when activation changes.
83 void HandleWindowActivationChange(aura::Window* gaining_active,
84 aura::Window* losing_active);
85
86 // Shows or hides |window|'s shadow as needed (creating the shadow if
87 // necessary).
88 void HandlePossibleShadowVisibilityChange(aura::Window* window);
89
90 // 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 void CreateShadowForWindow(aura::Window* window);
93
94 WindowShadowMap window_shadows_;
95
96 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
97
98 DISALLOW_COPY_AND_ASSIGN(ShadowController);
99 };
100
101 } // namespace internal
102 } // namespace ash
103
104 #endif // ASH_WM_SHADOW_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/wm/shadow.cc ('k') | ash/wm/shadow_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698