Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: ash/wm/workspace/workspace_cycler.h

Issue 11417150: Implement workspace scrubbing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
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 OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
44 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
45 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
46 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
47 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
48
49 WorkspaceManager* workspace_manager_;
50
51 enum ScrubState {
52 SCRUBBING,
53 CANCELLED_SCRUBBING,
54 NOT_SCRUBBING
55 };
56
57 ScrubState scrub_state_;
58
59 // The position of the event which most recently switched the active
60 // workspace. If scrubbing has just begun, |last_transition_position_| is set
61 // to the position of the event which initiated scrubbing.
62 gfx::Point last_transition_position_;
63
64 // The window of the active workspace when workspace scrubbing was initiated.
65 aura::Window* initial_workspace_window_;
66
67 DISALLOW_COPY_AND_ASSIGN(WorkspaceCycler);
68 };
69
70 } // namespace internal
71 } // namespace ash
72
73 #endif // ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698