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

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

Issue 10912063: events: Get rid of GestureStatus in favour of EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 | « ui/aura/root_window.h ('k') | ui/aura/root_window_unittest.cc » ('j') | 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 <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 Window* target = client::GetCaptureWindow(this); 295 Window* target = client::GetCaptureWindow(this);
296 if (!target) { 296 if (!target) {
297 target = ConsumerToWindow( 297 target = ConsumerToWindow(
298 gesture_recognizer_->GetTargetForGestureEvent(event)); 298 gesture_recognizer_->GetTargetForGestureEvent(event));
299 if (!target) 299 if (!target)
300 return false; 300 return false;
301 } 301 }
302 302
303 if (target) { 303 if (target) {
304 event->ConvertLocationToTarget(static_cast<Window*>(this), target); 304 event->ConvertLocationToTarget(static_cast<Window*>(this), target);
305 ui::GestureStatus status = ProcessGestureEvent(target, event); 305 ui::EventResult status = ProcessGestureEvent(target, event);
306 return status != ui::GESTURE_STATUS_UNKNOWN; 306 return status != ui::ER_UNHANDLED;
307 } 307 }
308 308
309 return false; 309 return false;
310 } 310 }
311 311
312 void RootWindow::OnWindowDestroying(Window* window) { 312 void RootWindow::OnWindowDestroying(Window* window) {
313 OnWindowHidden(window, true); 313 OnWindowHidden(window, true);
314 314
315 if (window->IsVisible() && 315 if (window->IsVisible() &&
316 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) { 316 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
666 if (tracker.Contains(target) && target->delegate()) { 666 if (tracker.Contains(target) && target->delegate()) {
667 ui::TouchStatus status = target->delegate()->OnTouchEvent(event); 667 ui::TouchStatus status = target->delegate()->OnTouchEvent(event);
668 if (status != ui::TOUCH_STATUS_UNKNOWN) 668 if (status != ui::TOUCH_STATUS_UNKNOWN)
669 return status; 669 return status;
670 } 670 }
671 671
672 return ui::TOUCH_STATUS_UNKNOWN; 672 return ui::TOUCH_STATUS_UNKNOWN;
673 } 673 }
674 674
675 ui::GestureStatus RootWindow::ProcessGestureEvent(Window* target, 675 ui::EventResult RootWindow::ProcessGestureEvent(Window* target,
676 ui::GestureEvent* event) { 676 ui::GestureEvent* event) {
677 if (!target) 677 if (!target)
678 target = this; 678 target = this;
679 AutoReset<Window*> reset(&event_dispatch_target_, target); 679 AutoReset<Window*> reset(&event_dispatch_target_, target);
680 if (ProcessEvent(target, event) != ui::ER_UNHANDLED) 680 return static_cast<ui::EventResult>(ProcessEvent(target, event));
681 return ui::GESTURE_STATUS_CONSUMED;
682 return ui::GESTURE_STATUS_UNKNOWN;
683 } 681 }
684 682
685 bool RootWindow::ProcessGestures(ui::GestureRecognizer::Gestures* gestures) { 683 bool RootWindow::ProcessGestures(ui::GestureRecognizer::Gestures* gestures) {
686 if (!gestures) 684 if (!gestures)
687 return false; 685 return false;
688 bool handled = false; 686 bool handled = false;
689 for (unsigned int i = 0; i < gestures->size(); i++) { 687 for (unsigned int i = 0; i < gestures->size(); i++) {
690 ui::GestureEvent* gesture = gestures->get().at(i); 688 ui::GestureEvent* gesture = gestures->get().at(i);
691 if (DispatchGestureEvent(gesture) != ui::GESTURE_STATUS_UNKNOWN) 689 if (DispatchGestureEvent(gesture) != ui::ER_UNHANDLED)
692 handled = true; 690 handled = true;
693 } 691 }
694 return handled; 692 return handled;
695 } 693 }
696 694
697 void RootWindow::OnWindowRemovedFromRootWindow(Window* detached) { 695 void RootWindow::OnWindowRemovedFromRootWindow(Window* detached) {
698 DCHECK(aura::client::GetCaptureWindow(this) != this); 696 DCHECK(aura::client::GetCaptureWindow(this) != this);
699 697
700 OnWindowHidden(detached, false); 698 OnWindowHidden(detached, false);
701 699
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 void RootWindow::UnlockCompositor() { 1064 void RootWindow::UnlockCompositor() {
1067 DCHECK(compositor_lock_); 1065 DCHECK(compositor_lock_);
1068 compositor_lock_ = NULL; 1066 compositor_lock_ = NULL;
1069 if (draw_on_compositor_unlock_) { 1067 if (draw_on_compositor_unlock_) {
1070 draw_on_compositor_unlock_ = false; 1068 draw_on_compositor_unlock_ = false;
1071 ScheduleDraw(); 1069 ScheduleDraw();
1072 } 1070 }
1073 } 1071 }
1074 1072
1075 } // namespace aura 1073 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/root_window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698