OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_ | |
6 #define ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "ui/aura/window_observer.h" | |
12 #include "ui/base/events/event_handler.h" | |
13 #include "ui/gfx/point.h" | |
14 | |
15 namespace ash { | |
16 namespace internal { | |
17 | |
18 class WorkspaceManager; | |
19 | |
20 // Class to enable quick workspace switching (scrubbing) via ctrl-up-drag / | |
21 // ctrl-down-drag. | |
22 // Note: this is experimental and disables ctrl-clicks. It should not be | |
23 // enabled other than through flags until we implement 3 finger drag as the | |
24 // mechanism to invoke it. At that point we will add test coverage. | |
25 class ASH_EXPORT WorkspaceCycler : public aura::WindowObserver, | |
26 public ui::EventHandler { | |
27 public: | |
28 explicit WorkspaceCycler(WorkspaceManager* workspace_manager); | |
29 virtual ~WorkspaceCycler(); | |
30 | |
31 private: | |
32 | |
sky
2012/11/28 15:15:34
nit: no newline.
| |
33 // Initiates scrubbing. | |
34 void StartScrubbing(); | |
35 | |
36 // Stops scrubbing. | |
37 void StopScrubbing(); | |
38 | |
39 // aura::WindowObserver overrides: | |
40 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | |
41 | |
42 // ui::EventHandler overrides: | |
43 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | |
44 | |
45 WorkspaceManager* workspace_manager_; | |
46 | |
47 enum ScrubState { | |
sky
2012/11/28 15:15:34
Style guide says enums are typically first in a se
| |
48 SCRUBBING, | |
49 CANCELLED_SCRUBBING, | |
50 NOT_SCRUBBING | |
51 }; | |
52 | |
53 ScrubState scrub_state_; | |
54 | |
55 // The position of the event which most recently switched the active | |
56 // workspace. If scrubbing has just begun, |last_transition_position_| is set | |
57 // to the position of the event which initiated scrubbing. | |
58 gfx::Point last_transition_position_; | |
sky
2012/11/28 15:15:34
Document coordinates, in fact I think you should n
| |
59 | |
60 // The window of the active workspace when workspace scrubbing was initiated. | |
61 aura::Window* initial_workspace_window_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(WorkspaceCycler); | |
64 }; | |
65 | |
66 } // namespace internal | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_ | |
OLD | NEW |