| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WINDOW_CYCLE_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_CYCLE_CONTROLLER_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_CYCLE_CONTROLLER_H_ | 6 #define ASH_COMMON_WM_WINDOW_CYCLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Cycles between windows in the given |direction|. | 38 // Cycles between windows in the given |direction|. |
| 39 void HandleCycleWindow(Direction direction); | 39 void HandleCycleWindow(Direction direction); |
| 40 | 40 |
| 41 // Returns true if we are in the middle of a window cycling gesture. | 41 // Returns true if we are in the middle of a window cycling gesture. |
| 42 bool IsCycling() const { return window_cycle_list_.get() != NULL; } | 42 bool IsCycling() const { return window_cycle_list_.get() != NULL; } |
| 43 | 43 |
| 44 // Call to start cycling windows. This funtion adds a pre-target handler to | 44 // Call to start cycling windows. This funtion adds a pre-target handler to |
| 45 // listen to the alt key release. | 45 // listen to the alt key release. |
| 46 void StartCycling(); | 46 void StartCycling(); |
| 47 | 47 |
| 48 // Stops the current window cycle and removes the event filter. | 48 // Both of these functions stop the current window cycle and removes the event |
| 49 void StopCycling(); | 49 // filter. The former indicates success (i.e. the new window should be |
| 50 // activated) and the latter indicates that the interaction was cancelled (and |
| 51 // the originally active window should remain active). |
| 52 void CompleteCycling(); |
| 53 void CancelCycling(); |
| 50 | 54 |
| 51 // Returns the WindowCycleList. Really only useful for testing. | 55 // Returns the WindowCycleList. |
| 52 const WindowCycleList* window_cycle_list() const { | 56 const WindowCycleList* window_cycle_list() const { |
| 53 return window_cycle_list_.get(); | 57 return window_cycle_list_.get(); |
| 54 } | 58 } |
| 55 | 59 |
| 56 private: | 60 private: |
| 57 // Cycles to the next or previous window based on |direction|. | 61 // Cycles to the next or previous window based on |direction|. |
| 58 void Step(Direction direction); | 62 void Step(Direction direction); |
| 59 | 63 |
| 64 void StopCycling(); |
| 65 |
| 60 std::unique_ptr<WindowCycleList> window_cycle_list_; | 66 std::unique_ptr<WindowCycleList> window_cycle_list_; |
| 61 | 67 |
| 62 // Tracks what Window was active when starting to cycle and used to determine | 68 // Tracks what Window was active when starting to cycle and used to determine |
| 63 // if the active Window changed in when ending cycling. | 69 // if the active Window changed in when ending cycling. |
| 64 WmWindow* active_window_before_window_cycle_ = nullptr; | 70 WmWindow* active_window_before_window_cycle_ = nullptr; |
| 65 | 71 |
| 66 // Non-null while actively cycling. | 72 // Non-null while actively cycling. |
| 67 std::unique_ptr<WindowCycleEventFilter> event_filter_; | 73 std::unique_ptr<WindowCycleEventFilter> event_filter_; |
| 68 | 74 |
| 69 base::Time cycle_start_time_; | 75 base::Time cycle_start_time_; |
| 70 | 76 |
| 71 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); | 77 DISALLOW_COPY_AND_ASSIGN(WindowCycleController); |
| 72 }; | 78 }; |
| 73 | 79 |
| 74 } // namespace ash | 80 } // namespace ash |
| 75 | 81 |
| 76 #endif // ASH_COMMON_WM_WINDOW_CYCLE_CONTROLLER_H_ | 82 #endif // ASH_COMMON_WM_WINDOW_CYCLE_CONTROLLER_H_ |
| OLD | NEW |