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

Side by Side Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 178193022: [Android] Always insert a TouchCancel if window or tab focus is lost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/events/gesture_detection/gesture_provider.h" 5 #include "ui/events/gesture_detection/gesture_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 636 }
637 637
638 void GestureProvider::ResetGestureDetectors() { 638 void GestureProvider::ResetGestureDetectors() {
639 if (!current_down_event_) 639 if (!current_down_event_)
640 return; 640 return;
641 scoped_ptr<MotionEvent> cancel_event = current_down_event_->Cancel(); 641 scoped_ptr<MotionEvent> cancel_event = current_down_event_->Cancel();
642 gesture_listener_->OnTouchEvent(*cancel_event, false); 642 gesture_listener_->OnTouchEvent(*cancel_event, false);
643 scale_gesture_listener_->OnTouchEvent(*cancel_event); 643 scale_gesture_listener_->OnTouchEvent(*cancel_event);
644 } 644 }
645 645
646 void GestureProvider::CancelActiveTouchSequence() { 646 bool GestureProvider::CancelActiveTouchSequence() {
647 if (!current_down_event_) 647 if (!current_down_event_)
648 return; 648 return false;
649 OnTouchEvent(*current_down_event_->Cancel()); 649 OnTouchEvent(*current_down_event_->Cancel());
650 current_down_event_.reset(); 650 return true;
651 } 651 }
652 652
653 void GestureProvider::SetMultiTouchSupportEnabled(bool enabled) { 653 void GestureProvider::SetMultiTouchSupportEnabled(bool enabled) {
654 scale_gesture_listener_->set_ignore_detector_events(!enabled); 654 scale_gesture_listener_->set_ignore_detector_events(!enabled);
655 } 655 }
656 656
657 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { 657 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) {
658 gesture_listener_->SetDoubleTapSupportForPlatformEnabled(enabled); 658 gesture_listener_->SetDoubleTapSupportForPlatformEnabled(enabled);
659 } 659 }
660 660
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 void GestureProvider::EndTouchScrollIfNecessary(base::TimeTicks time, 805 void GestureProvider::EndTouchScrollIfNecessary(base::TimeTicks time,
806 bool send_scroll_end_event) { 806 bool send_scroll_end_event) {
807 if (!touch_scroll_in_progress_) 807 if (!touch_scroll_in_progress_)
808 return; 808 return;
809 touch_scroll_in_progress_ = false; 809 touch_scroll_in_progress_ = false;
810 if (send_scroll_end_event) 810 if (send_scroll_end_event)
811 Send(CreateGesture(GESTURE_SCROLL_END, time, 0, 0)); 811 Send(CreateGesture(GESTURE_SCROLL_END, time, 0, 0));
812 } 812 }
813 813
814 } // namespace ui 814 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698