| 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_RESIZE_SHADOW_CONTROLLER_H_ | 5 #ifndef ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ |
| 6 #define ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ | 6 #define ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/linked_ptr.h" | |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 | 15 |
| 16 namespace aura { | 16 namespace aura { |
| 17 class Window; | 17 class Window; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 class ResizeShadow; | 21 class ResizeShadow; |
| 22 | 22 |
| 23 // ResizeShadowController observes changes to resizable windows and shows | 23 // ResizeShadowController observes changes to resizable windows and shows |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 ResizeShadow* GetShadowForWindowForTest(aura::Window* window); | 36 ResizeShadow* GetShadowForWindowForTest(aura::Window* window); |
| 37 | 37 |
| 38 // aura::WindowObserver overrides: | 38 // aura::WindowObserver overrides: |
| 39 void OnWindowBoundsChanged(aura::Window* window, | 39 void OnWindowBoundsChanged(aura::Window* window, |
| 40 const gfx::Rect& old_bounds, | 40 const gfx::Rect& old_bounds, |
| 41 const gfx::Rect& new_bounds) override; | 41 const gfx::Rect& new_bounds) override; |
| 42 void OnWindowDestroyed(aura::Window* window) override; | 42 void OnWindowDestroyed(aura::Window* window) override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 typedef std::map<aura::Window*, linked_ptr<ResizeShadow>> WindowShadowMap; | |
| 46 | |
| 47 // Creates a shadow for a given window and returns it. |window_shadows_| | 45 // Creates a shadow for a given window and returns it. |window_shadows_| |
| 48 // owns the memory. | 46 // owns the memory. |
| 49 ResizeShadow* CreateShadow(aura::Window* window); | 47 ResizeShadow* CreateShadow(aura::Window* window); |
| 50 | 48 |
| 51 // Returns the resize shadow for |window| or NULL if no shadow exists. | 49 // Returns the resize shadow for |window| or NULL if no shadow exists. |
| 52 ResizeShadow* GetShadowForWindow(aura::Window* window); | 50 ResizeShadow* GetShadowForWindow(aura::Window* window); |
| 53 | 51 |
| 54 WindowShadowMap window_shadows_; | 52 std::map<aura::Window*, std::unique_ptr<ResizeShadow>> window_shadows_; |
| 55 | 53 |
| 56 DISALLOW_COPY_AND_ASSIGN(ResizeShadowController); | 54 DISALLOW_COPY_AND_ASSIGN(ResizeShadowController); |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 } // namespace ash | 57 } // namespace ash |
| 60 | 58 |
| 61 #endif // ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ | 59 #endif // ASH_WM_RESIZE_SHADOW_CONTROLLER_H_ |
| OLD | NEW |