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/dom/DocumentUserGestureToken.h" |
8 #include "core/events/TouchEvent.h" | 9 #include "core/events/TouchEvent.h" |
9 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
10 #include "core/frame/EventHandlerRegistry.h" | 11 #include "core/frame/EventHandlerRegistry.h" |
11 #include "core/frame/FrameHost.h" | 12 #include "core/frame/FrameHost.h" |
12 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
13 #include "core/html/HTMLCanvasElement.h" | 14 #include "core/html/HTMLCanvasElement.h" |
14 #include "core/input/EventHandlingUtil.h" | 15 #include "core/input/EventHandlingUtil.h" |
15 #include "core/input/TouchActionUtil.h" | 16 #include "core/input/TouchActionUtil.h" |
16 #include "core/layout/HitTestCanvasResult.h" | 17 #include "core/layout/HitTestCanvasResult.h" |
17 #include "core/page/ChromeClient.h" | 18 #include "core/page/ChromeClient.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 ->securityContext() | 518 ->securityContext() |
518 ->getSecurityOrigin(); | 519 ->getSecurityOrigin(); |
519 Frame* top = m_frame->tree().top(); | 520 Frame* top = m_frame->tree().top(); |
520 if (top && | 521 if (top && |
521 securityOrigin->canAccess(top->securityContext()->getSecurityOrigin())) | 522 securityOrigin->canAccess(top->securityContext()->getSecurityOrigin())) |
522 isSameOrigin = true; | 523 isSameOrigin = true; |
523 } | 524 } |
524 | 525 |
525 std::unique_ptr<UserGestureIndicator> gestureIndicator; | 526 std::unique_ptr<UserGestureIndicator> gestureIndicator; |
526 if (isTap || isSameOrigin) { | 527 if (isTap || isSameOrigin) { |
527 gestureIndicator = wrapUnique( | 528 gestureIndicator = wrapUnique(new UserGestureIndicator( |
528 new UserGestureIndicator(m_touchSequenceUserGestureToken | 529 m_touchSequenceUserGestureToken |
529 ? m_touchSequenceUserGestureToken.release() | 530 ? m_touchSequenceUserGestureToken.release() |
530 : UserGestureToken::create())); | 531 : DocumentUserGestureToken::create(m_touchSequenceDocument))); |
531 | 532 |
532 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); | 533 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); |
533 // These are cases we'd like to migrate to not hold a user gesture. | 534 // These are cases we'd like to migrate to not hold a user gesture. |
534 if (event.type() == PlatformEvent::TouchStart || | 535 if (event.type() == PlatformEvent::TouchStart || |
535 event.type() == PlatformEvent::TouchMove || | 536 event.type() == PlatformEvent::TouchMove || |
536 (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) { | 537 (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) { |
537 // Collect metrics in userGestureUtilized(). | 538 // Collect metrics in userGestureUtilized(). |
538 m_touchSequenceUserGestureToken->setUserGestureUtilizedCallback(this); | 539 m_touchSequenceUserGestureToken->setUserGestureUtilizedCallback(this); |
539 } | 540 } |
540 } | 541 } |
(...skipping 23 matching lines...) Expand all Loading... |
564 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 565 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
565 break; | 566 break; |
566 default: | 567 default: |
567 NOTREACHED(); | 568 NOTREACHED(); |
568 return; | 569 return; |
569 } | 570 } |
570 Deprecation::countDeprecation(m_frame, feature); | 571 Deprecation::countDeprecation(m_frame, feature); |
571 } | 572 } |
572 | 573 |
573 } // namespace blink | 574 } // namespace blink |
OLD | NEW |