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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/workspace_cycler.h
diff --git a/ash/wm/workspace/workspace_cycler.h b/ash/wm/workspace/workspace_cycler.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f8b6b056fb822e99d18f1e3486c44d9fd4d5f87
--- /dev/null
+++ b/ash/wm/workspace/workspace_cycler.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_
+#define ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/aura/window_observer.h"
+#include "ui/base/events/event_handler.h"
+#include "ui/gfx/point.h"
+
+namespace ash {
+namespace internal {
+
+class WorkspaceManager;
+
+// Class to enable quick workspace switching (scrubbing) via ctrl-up-drag /
+// ctrl-down-drag.
+// Note: this is experimental and disables ctrl-clicks. It should not be
+// enabled other than through flags until we implement 3 finger drag as the
+// mechanism to invoke it. At that point we will add test coverage.
+class ASH_EXPORT WorkspaceCycler : public aura::WindowObserver,
+ public ui::EventHandler {
+ public:
+ explicit WorkspaceCycler(WorkspaceManager* workspace_manager);
+ virtual ~WorkspaceCycler();
+
+ private:
+
+ // Initiates scrubbing.
+ void StartScrubbing();
+
+ // Stops scrubbing.
+ void StopScrubbing();
+
+ // aura::WindowObserver overrides:
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
+
+ // ui::EventHandler overrides:
+ virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
+ virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
+ virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+ virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
+
+ WorkspaceManager* workspace_manager_;
+
+ enum ScrubState {
+ SCRUBBING,
+ CANCELLED_SCRUBBING,
+ NOT_SCRUBBING
+ };
+
+ ScrubState scrub_state_;
+
+ // The position of the event which most recently switched the active
+ // workspace. If scrubbing has just begun, |last_transition_position_| is set
+ // to the position of the event which initiated scrubbing.
+ gfx::Point last_transition_position_;
+
+ // The window of the active workspace when workspace scrubbing was initiated.
+ aura::Window* initial_workspace_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkspaceCycler);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_WM_WORKSPACE_WORKSPACE_CYCLER_H_

Powered by Google App Engine
This is Rietveld 408576698