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

Side by Side Diff: ui/aura/root_window.cc

Issue 9363037: aura: Fix setting touch-handler and gesture-handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool handled = false; 209 bool handled = false;
210 Window* target = 210 Window* target =
211 touch_event_handler_ ? touch_event_handler_ : capture_window_; 211 touch_event_handler_ ? touch_event_handler_ : capture_window_;
212 if (!target) 212 if (!target)
213 target = GetEventHandlerForPoint(event->location()); 213 target = GetEventHandlerForPoint(event->location());
214 214
215 ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN; 215 ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN;
216 if (target) { 216 if (target) {
217 TouchEvent translated_event(*event, this, target); 217 TouchEvent translated_event(*event, this, target);
218 status = ProcessTouchEvent(target, &translated_event); 218 status = ProcessTouchEvent(target, &translated_event);
219 if (status == ui::TOUCH_STATUS_START) 219 if (status == ui::TOUCH_STATUS_START ||
220 status == ui::TOUCH_STATUS_QUEUED)
220 touch_event_handler_ = target; 221 touch_event_handler_ = target;
221 else if (status == ui::TOUCH_STATUS_END || 222 else if (status == ui::TOUCH_STATUS_END ||
222 status == ui::TOUCH_STATUS_CANCEL) 223 status == ui::TOUCH_STATUS_CANCEL)
223 touch_event_handler_ = NULL; 224 touch_event_handler_ = NULL;
224 handled = status != ui::TOUCH_STATUS_UNKNOWN; 225 handled = status != ui::TOUCH_STATUS_UNKNOWN;
225 226
226 if (status == ui::TOUCH_STATUS_QUEUED) 227 if (status == ui::TOUCH_STATUS_QUEUED)
227 gesture_recognizer_->QueueTouchEventForGesture(target, *event); 228 gesture_recognizer_->QueueTouchEventForGesture(target, *event);
228 } 229 }
229 230
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 386 }
386 387
387 void RootWindow::ReleaseCapture(Window* window) { 388 void RootWindow::ReleaseCapture(Window* window) {
388 if (capture_window_ != window) 389 if (capture_window_ != window)
389 return; 390 return;
390 SetCapture(NULL); 391 SetCapture(NULL);
391 } 392 }
392 393
393 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { 394 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) {
394 scoped_ptr<GestureRecognizer::Gestures> gestures; 395 scoped_ptr<GestureRecognizer::Gestures> gestures;
396 Window* old_gesture_handler = gesture_handler_;
397 gesture_handler_ = window;
395 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); 398 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed));
396 ProcessGestures(gestures.get()); 399 ProcessGestures(gestures.get());
400 gesture_handler_ = old_gesture_handler;
397 } 401 }
398 402
399 void RootWindow::SetGestureRecognizerForTesting(GestureRecognizer* gr) { 403 void RootWindow::SetGestureRecognizerForTesting(GestureRecognizer* gr) {
400 gesture_recognizer_.reset(gr); 404 gesture_recognizer_.reset(gr);
401 } 405 }
402 406
403 #if !defined(NDEBUG) 407 #if !defined(NDEBUG)
404 void RootWindow::ToggleFullScreen() { 408 void RootWindow::ToggleFullScreen() {
405 host_->ToggleFullScreen(); 409 host_->ToggleFullScreen();
406 } 410 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // is currently broken. See/ crbug.com/107931. 768 // is currently broken. See/ crbug.com/107931.
765 MouseEvent event(ui::ET_MOUSE_MOVED, 769 MouseEvent event(ui::ET_MOUSE_MOVED,
766 orig_mouse_location, 770 orig_mouse_location,
767 orig_mouse_location, 771 orig_mouse_location,
768 0); 772 0);
769 DispatchMouseEvent(&event); 773 DispatchMouseEvent(&event);
770 #endif 774 #endif
771 } 775 }
772 776
773 } // namespace aura 777 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698