cc: Initialize wait_for_beginframe_interval in tests.
[chromium-blink-merge.git] / ash / wm / resize_shadow_controller.h
blob04afefef573749793419408644e26439809b8719
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.
5 #ifndef ASH_WM_RESIZE_SHADOW_CONTROLLER_H_
6 #define ASH_WM_RESIZE_SHADOW_CONTROLLER_H_
8 #include <map>
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 "ui/aura/window_observer.h"
16 namespace aura {
17 class Window;
20 namespace ash {
21 class ResizeShadow;
23 // ResizeShadowController observes changes to resizable windows and shows
24 // a resize handle visual effect when the cursor is near the edges.
25 class ASH_EXPORT ResizeShadowController : public aura::WindowObserver {
26 public:
27 ResizeShadowController();
28 ~ResizeShadowController() override;
30 // Shows the appropriate shadow for a given |window| and |hit_test| location.
31 void ShowShadow(aura::Window* window, int hit_test);
33 // Hides the shadow for a |window|, if it has one.
34 void HideShadow(aura::Window* window);
36 ResizeShadow* GetShadowForWindowForTest(aura::Window* window);
38 // aura::WindowObserver overrides:
39 void OnWindowBoundsChanged(aura::Window* window,
40 const gfx::Rect& old_bounds,
41 const gfx::Rect& new_bounds) override;
42 void OnWindowDestroyed(aura::Window* window) override;
44 private:
45 typedef std::map<aura::Window*, linked_ptr<ResizeShadow> > WindowShadowMap;
47 // Creates a shadow for a given window and returns it. |window_shadows_|
48 // owns the memory.
49 ResizeShadow* CreateShadow(aura::Window* window);
51 // Returns the resize shadow for |window| or NULL if no shadow exists.
52 ResizeShadow* GetShadowForWindow(aura::Window* window);
54 WindowShadowMap window_shadows_;
56 DISALLOW_COPY_AND_ASSIGN(ResizeShadowController);
59 } // namespace ash
61 #endif // ASH_WM_RESIZE_SHADOW_CONTROLLER_H_