Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/input/TouchEventManager.h" | 5 #include "core/input/TouchEventManager.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/events/TouchEvent.h" | 8 #include "core/events/TouchEvent.h" |
| 9 #include "core/frame/Deprecation.h" | 9 #include "core/frame/Deprecation.h" |
| 10 #include "core/frame/EventHandlerRegistry.h" | 10 #include "core/frame/EventHandlerRegistry.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 ->securityContext() | 517 ->securityContext() |
| 518 ->getSecurityOrigin(); | 518 ->getSecurityOrigin(); |
| 519 Frame* top = m_frame->tree().top(); | 519 Frame* top = m_frame->tree().top(); |
| 520 if (top && | 520 if (top && |
| 521 securityOrigin->canAccess(top->securityContext()->getSecurityOrigin())) | 521 securityOrigin->canAccess(top->securityContext()->getSecurityOrigin())) |
| 522 isSameOrigin = true; | 522 isSameOrigin = true; |
| 523 } | 523 } |
| 524 | 524 |
| 525 std::unique_ptr<UserGestureIndicator> gestureIndicator; | 525 std::unique_ptr<UserGestureIndicator> gestureIndicator; |
| 526 if (isTap || isSameOrigin) { | 526 if (isTap || isSameOrigin) { |
| 527 UserGestureUtilizedCallback* callback = 0; | 527 gestureIndicator = wrapUnique( |
|
Rick Byers
2016/10/11 19:28:12
I think you can simplify this further now to elimi
| |
| 528 new UserGestureIndicator(m_touchSequenceUserGestureToken | |
| 529 ? m_touchSequenceUserGestureToken.release() | |
| 530 : UserGestureToken::create())); | |
| 531 | |
| 532 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); | |
| 528 // These are cases we'd like to migrate to not hold a user gesture. | 533 // These are cases we'd like to migrate to not hold a user gesture. |
| 529 if (event.type() == PlatformEvent::TouchStart || | 534 if (event.type() == PlatformEvent::TouchStart || |
| 530 event.type() == PlatformEvent::TouchMove || | 535 event.type() == PlatformEvent::TouchMove || |
| 531 (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) { | 536 (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) { |
| 532 // Collect metrics in userGestureUtilized(). | 537 // Collect metrics in userGestureUtilized(). |
| 533 callback = this; | 538 m_touchSequenceUserGestureToken->setUserGestureUtilizedCallback(this); |
| 534 } | 539 } |
| 535 if (m_touchSequenceUserGestureToken) | |
| 536 gestureIndicator = wrapUnique(new UserGestureIndicator( | |
| 537 m_touchSequenceUserGestureToken.release(), callback)); | |
| 538 else | |
| 539 gestureIndicator = wrapUnique( | |
| 540 new UserGestureIndicator(DefinitelyProcessingUserGesture, callback)); | |
| 541 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); | |
| 542 } | 540 } |
| 543 | 541 |
| 544 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); | 542 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); |
| 545 } | 543 } |
| 546 | 544 |
| 547 bool TouchEventManager::isAnyTouchActive() const { | 545 bool TouchEventManager::isAnyTouchActive() const { |
| 548 return m_touchPressed; | 546 return m_touchPressed; |
| 549 } | 547 } |
| 550 | 548 |
| 551 void TouchEventManager::userGestureUtilized() { | 549 void TouchEventManager::userGestureUtilized() { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 566 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 564 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
| 567 break; | 565 break; |
| 568 default: | 566 default: |
| 569 NOTREACHED(); | 567 NOTREACHED(); |
| 570 return; | 568 return; |
| 571 } | 569 } |
| 572 Deprecation::countDeprecation(m_frame, feature); | 570 Deprecation::countDeprecation(m_frame, feature); |
| 573 } | 571 } |
| 574 | 572 |
| 575 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |