OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | |
6 #define ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/compiler_specific.h" | |
10 | |
11 namespace ash { | |
12 | |
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 }; | |
28 | |
29 // Implement this class to handle the selection event from WindowSelector. | |
30 class ASH_EXPORT WindowSelectorDelegate { | |
31 public: | |
32 // Invoked if selection is ended. | |
33 virtual void OnSelectionEnded() = 0; | |
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 | |
48 protected: | |
49 virtual ~WindowSelectorDelegate() {} | |
50 }; | |
51 | |
52 } // namespace ash | |
53 | |
54 #endif // ASH_COMMON_WM_OVERVIEW_WINDOW_SELECTOR_DELEGATE_H_ | |
OLD | NEW |