OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | 5 #ifndef ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ |
6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | 6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
11 namespace aura { | 11 namespace ash { |
12 class Window; | |
13 } | |
14 | 12 |
15 namespace ash { | 13 class WindowSelectorDelegate; |
| 14 |
| 15 class ASH_EXPORT DelayedAnimationObserver { |
| 16 public: |
| 17 virtual ~DelayedAnimationObserver() {} |
| 18 |
| 19 // Sets an |owner| that can be notified when the animation that |this| |
| 20 // observes completes. |
| 21 virtual void SetOwner(WindowSelectorDelegate* owner) = 0; |
| 22 |
| 23 // Can be called by the |owner| to delete the owned widget. The |owner| is |
| 24 // then responsible for deleting |this| instance of the |
| 25 // DelayedAnimationObserver. |
| 26 virtual void Shutdown() = 0; |
| 27 }; |
16 | 28 |
17 // Implement this class to handle the selection event from WindowSelector. | 29 // Implement this class to handle the selection event from WindowSelector. |
18 class ASH_EXPORT WindowSelectorDelegate { | 30 class ASH_EXPORT WindowSelectorDelegate { |
19 public: | 31 public: |
20 // Invoked if selection is ended. | 32 // Invoked if selection is ended. |
21 virtual void OnSelectionEnded() = 0; | 33 virtual void OnSelectionEnded() = 0; |
22 | 34 |
| 35 // Passes ownership of |animation_observer| to |this| delegate. |
| 36 virtual void AddDelayedAnimationObserver( |
| 37 std::unique_ptr<DelayedAnimationObserver> animation_observer) = 0; |
| 38 |
| 39 // Finds and erases |animation_observer| from the list deleting the widget |
| 40 // owned by the |animation_observer|. |
| 41 // This method should be called when a scheduled animation completes. |
| 42 // If the animation completion callback is a result of a window getting |
| 43 // destroyed then the DelayedAnimationObserver::Shutdown() should be called |
| 44 // first before destroying the window. |
| 45 virtual void RemoveAndDestroyAnimationObserver( |
| 46 DelayedAnimationObserver* animation_observer) = 0; |
| 47 |
23 protected: | 48 protected: |
24 virtual ~WindowSelectorDelegate() {} | 49 virtual ~WindowSelectorDelegate() {} |
25 }; | 50 }; |
26 | 51 |
27 } // namespace ash | 52 } // namespace ash |
28 | 53 |
29 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | 54 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ |
OLD | NEW |