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

Side by Side Diff: third_party/WebKit/Source/core/input/TouchEventManager.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 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"
11 #include "core/frame/FrameHost.h" 11 #include "core/frame/FrameHost.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLCanvasElement.h" 13 #include "core/html/HTMLCanvasElement.h"
14 #include "core/input/EventHandler.h" 14 #include "core/input/EventHandler.h"
15 #include "core/input/TouchActionUtil.h" 15 #include "core/input/TouchActionUtil.h"
16 #include "core/page/ChromeClient.h" 16 #include "core/page/ChromeClient.h"
17 #include "core/page/Page.h" 17 #include "core/page/Page.h"
18 #include "platform/Histogram.h" 18 #include "platform/Histogram.h"
19 #include "platform/PlatformTouchEvent.h" 19 #include "platform/PlatformTouchEvent.h"
20 #include "wtf/CurrentTime.h" 20 #include "wtf/CurrentTime.h"
21 #include "wtf/PtrUtil.h"
22 #include <memory>
23 21
24 22
25 namespace blink { 23 namespace blink {
26 24
27 namespace { 25 namespace {
28 26
29 bool hasTouchHandlers(const EventHandlerRegistry& registry) 27 bool hasTouchHandlers(const EventHandlerRegistry& registry)
30 { 28 {
31 return registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Blocking) 29 return registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Blocking)
32 || registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Passive) 30 || registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Passive)
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // For now, disallow dragging as a user gesture when the events are being se nt to a 462 // For now, disallow dragging as a user gesture when the events are being se nt to a
465 // cross-origin iframe (crbug.com/582140). 463 // cross-origin iframe (crbug.com/582140).
466 bool isSameOrigin = false; 464 bool isSameOrigin = false;
467 if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) { 465 if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) {
468 SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()->secur ityContext()->getSecurityOrigin(); 466 SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()->secur ityContext()->getSecurityOrigin();
469 Frame* top = m_frame->tree().top(); 467 Frame* top = m_frame->tree().top();
470 if (top && securityOrigin->canAccess(top->securityContext()->getSecurity Origin())) 468 if (top && securityOrigin->canAccess(top->securityContext()->getSecurity Origin()))
471 isSameOrigin = true; 469 isSameOrigin = true;
472 } 470 }
473 471
474 std::unique_ptr<UserGestureIndicator> gestureIndicator; 472 OwnPtr<UserGestureIndicator> gestureIndicator;
475 if (isTap || isSameOrigin) { 473 if (isTap || isSameOrigin) {
476 UserGestureUtilizedCallback* callback = 0; 474 UserGestureUtilizedCallback* callback = 0;
477 // These are cases we'd like to migrate to not hold a user gesture. 475 // These are cases we'd like to migrate to not hold a user gesture.
478 if (event.type() == PlatformEvent::TouchStart 476 if (event.type() == PlatformEvent::TouchStart
479 || event.type() == PlatformEvent::TouchMove 477 || event.type() == PlatformEvent::TouchMove
480 || (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted) ) { 478 || (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted) ) {
481 // Collect metrics in userGestureUtilized(). 479 // Collect metrics in userGestureUtilized().
482 callback = this; 480 callback = this;
483 } 481 }
484 if (m_touchSequenceUserGestureToken) 482 if (m_touchSequenceUserGestureToken)
485 gestureIndicator = wrapUnique(new UserGestureIndicator(m_touchSequen ceUserGestureToken.release(), callback)); 483 gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequence UserGestureToken.release(), callback));
486 else 484 else
487 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyPro cessingUserGesture, callback)); 485 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProce ssingUserGesture, callback));
488 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); 486 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
489 } 487 }
490 488
491 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 489 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
492 } 490 }
493 491
494 void TouchEventManager::clear() 492 void TouchEventManager::clear()
495 { 493 {
496 m_touchSequenceDocument.clear(); 494 m_touchSequenceDocument.clear();
497 m_touchSequenceUserGestureToken.clear(); 495 m_touchSequenceUserGestureToken.clear();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; 531 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized;
534 break; 532 break;
535 default: 533 default:
536 NOTREACHED(); 534 NOTREACHED();
537 return; 535 return;
538 } 536 }
539 Deprecation::countDeprecation(m_frame, feature); 537 Deprecation::countDeprecation(m_frame, feature);
540 } 538 }
541 539
542 } // namespace blink 540 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/ScrollManager.cpp ('k') | third_party/WebKit/Source/core/inspector/ConsoleMessage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698