Chromium Code Reviews| 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..1eb6880b4bd98fe48c4ce64bfc74ad63c4811e6e |
| --- /dev/null |
| +++ b/ash/wm/workspace/workspace_cycler.h |
| @@ -0,0 +1,69 @@ |
| +// 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: |
| + |
|
sky
2012/11/28 15:15:34
nit: no newline.
|
| + // Initiates scrubbing. |
| + void StartScrubbing(); |
| + |
| + // Stops scrubbing. |
| + void StopScrubbing(); |
| + |
| + // aura::WindowObserver overrides: |
| + virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| + |
| + // ui::EventHandler overrides: |
| + virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| + |
| + WorkspaceManager* workspace_manager_; |
| + |
| + enum ScrubState { |
|
sky
2012/11/28 15:15:34
Style guide says enums are typically first in a se
|
| + 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_; |
|
sky
2012/11/28 15:15:34
Document coordinates, in fact I think you should n
|
| + |
| + // 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_ |