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

Side by Side Diff: ash/wm/window_cycle_controller.cc

Issue 9221014: aura: Gesture event plumbing (skeleton). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "ash/wm/window_cycle_controller.h" 5 #include "ash/wm/window_cycle_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "ui/aura/event.h" 10 #include "ui/aura/event.h"
11 #include "ui/aura/event_filter.h" 11 #include "ui/aura/event_filter.h"
12 #include "ui/aura/root_window.h" 12 #include "ui/aura/root_window.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 // Filter to watch for the termination of a keyboard gesture to cycle through 16 // Filter to watch for the termination of a keyboard gesture to cycle through
17 // multiple windows. 17 // multiple windows.
18 class WindowCycleEventFilter : public aura::EventFilter { 18 class WindowCycleEventFilter : public aura::EventFilter {
19 public: 19 public:
20 WindowCycleEventFilter(); 20 WindowCycleEventFilter();
21 virtual ~WindowCycleEventFilter(); 21 virtual ~WindowCycleEventFilter();
22 22
23 // Overridden from aura::EventFilter: 23 // Overridden from aura::EventFilter:
24 virtual bool PreHandleKeyEvent(aura::Window* target, 24 virtual bool PreHandleKeyEvent(aura::Window* target,
25 aura::KeyEvent* event) OVERRIDE; 25 aura::KeyEvent* event) OVERRIDE;
26 virtual bool PreHandleMouseEvent(aura::Window* target, 26 virtual bool PreHandleMouseEvent(aura::Window* target,
27 aura::MouseEvent* event) OVERRIDE; 27 aura::MouseEvent* event) OVERRIDE;
28 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, 28 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target,
29 aura::TouchEvent* event) OVERRIDE; 29 aura::TouchEvent* event) OVERRIDE;
30 virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target,
sky 2012/01/17 17:18:35 nit: put param on next line.
sadrul 2012/01/17 17:25:36 Done.
31 aura::GestureEvent* event) OVERRIDE;
30 private: 32 private:
31 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); 33 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter);
32 }; 34 };
33 35
34 // Watch for all keyboard events by filtering the root window. 36 // Watch for all keyboard events by filtering the root window.
35 WindowCycleEventFilter::WindowCycleEventFilter() 37 WindowCycleEventFilter::WindowCycleEventFilter()
36 : aura::EventFilter(aura::RootWindow::GetInstance()) { 38 : aura::EventFilter(aura::RootWindow::GetInstance()) {
37 } 39 }
38 40
39 WindowCycleEventFilter::~WindowCycleEventFilter() { 41 WindowCycleEventFilter::~WindowCycleEventFilter() {
(...skipping 16 matching lines...) Expand all
56 aura::MouseEvent* event) { 58 aura::MouseEvent* event) {
57 return false; // Not handled. 59 return false; // Not handled.
58 } 60 }
59 61
60 ui::TouchStatus WindowCycleEventFilter::PreHandleTouchEvent( 62 ui::TouchStatus WindowCycleEventFilter::PreHandleTouchEvent(
61 aura::Window* target, 63 aura::Window* target,
62 aura::TouchEvent* event) { 64 aura::TouchEvent* event) {
63 return ui::TOUCH_STATUS_UNKNOWN; // Not handled. 65 return ui::TOUCH_STATUS_UNKNOWN; // Not handled.
64 } 66 }
65 67
68 ui::GestureStatus WindowCycleEventFilter::PreHandleGestureEvent(
69 aura::Window* target,
70 aura::GestureEvent* event) {
71 return ui::GESTURE_STATUS_UNKNOWN; // Not handled.
72 }
73
66 ////////////////////////////////////////////////////////////////////////////// 74 //////////////////////////////////////////////////////////////////////////////
67 // WindowCycleController, public: 75 // WindowCycleController, public:
68 76
69 WindowCycleController::WindowCycleController() : current_index_(-1) { 77 WindowCycleController::WindowCycleController() : current_index_(-1) {
70 } 78 }
71 79
72 WindowCycleController::~WindowCycleController() { 80 WindowCycleController::~WindowCycleController() {
73 StopCycling(); 81 StopCycling();
74 } 82 }
75 83
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 170
163 int WindowCycleController::GetWindowIndex(aura::Window* window) { 171 int WindowCycleController::GetWindowIndex(aura::Window* window) {
164 WindowList::const_iterator it = 172 WindowList::const_iterator it =
165 std::find(windows_.begin(), windows_.end(), window); 173 std::find(windows_.begin(), windows_.end(), window);
166 if (it == windows_.end()) 174 if (it == windows_.end())
167 return -1; // Not found. 175 return -1; // Not found.
168 return it - windows_.begin(); 176 return it - windows_.begin();
169 } 177 }
170 178
171 } // namespace ash 179 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698