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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge. 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>
21 23
22 24
23 namespace blink { 25 namespace blink {
24 26
25 namespace { 27 namespace {
26 28
27 bool hasTouchHandlers(const EventHandlerRegistry& registry) 29 bool hasTouchHandlers(const EventHandlerRegistry& registry)
28 { 30 {
29 return registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Blocking) 31 return registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Blocking)
30 || registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Passive) 32 || registry.hasEventHandlers(EventHandlerRegistry::TouchStartOrMoveEvent Passive)
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // For now, disallow dragging as a user gesture when the events are being se nt to a 473 // For now, disallow dragging as a user gesture when the events are being se nt to a
472 // cross-origin iframe (crbug.com/582140). 474 // cross-origin iframe (crbug.com/582140).
473 bool isSameOrigin = false; 475 bool isSameOrigin = false;
474 if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) { 476 if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) {
475 SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()->secur ityContext()->getSecurityOrigin(); 477 SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()->secur ityContext()->getSecurityOrigin();
476 Frame* top = m_frame->tree().top(); 478 Frame* top = m_frame->tree().top();
477 if (top && securityOrigin->canAccess(top->securityContext()->getSecurity Origin())) 479 if (top && securityOrigin->canAccess(top->securityContext()->getSecurity Origin()))
478 isSameOrigin = true; 480 isSameOrigin = true;
479 } 481 }
480 482
481 OwnPtr<UserGestureIndicator> gestureIndicator; 483 std::unique_ptr<UserGestureIndicator> gestureIndicator;
482 if (isTap || isSameOrigin) { 484 if (isTap || isSameOrigin) {
483 UserGestureUtilizedCallback* callback = 0; 485 UserGestureUtilizedCallback* callback = 0;
484 // These are cases we'd like to migrate to not hold a user gesture. 486 // These are cases we'd like to migrate to not hold a user gesture.
485 if (event.type() == PlatformEvent::TouchStart 487 if (event.type() == PlatformEvent::TouchStart
486 || event.type() == PlatformEvent::TouchMove 488 || event.type() == PlatformEvent::TouchMove
487 || (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted) ) { 489 || (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted) ) {
488 // Collect metrics in userGestureUtilized(). 490 // Collect metrics in userGestureUtilized().
489 callback = this; 491 callback = this;
490 } 492 }
491 if (m_touchSequenceUserGestureToken) 493 if (m_touchSequenceUserGestureToken)
492 gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequence UserGestureToken.release(), callback)); 494 gestureIndicator = wrapUnique(new UserGestureIndicator(m_touchSequen ceUserGestureToken.release(), callback));
493 else 495 else
494 gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProce ssingUserGesture, callback)); 496 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyPro cessingUserGesture, callback));
495 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken(); 497 m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
496 } 498 }
497 499
498 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 500 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
499 } 501 }
500 502
501 void TouchEventManager::clear() 503 void TouchEventManager::clear()
502 { 504 {
503 m_touchSequenceDocument.clear(); 505 m_touchSequenceDocument.clear();
504 m_touchSequenceUserGestureToken.clear(); 506 m_touchSequenceUserGestureToken.clear();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; 542 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized;
541 break; 543 break;
542 default: 544 default:
543 NOTREACHED(); 545 NOTREACHED();
544 return; 546 return;
545 } 547 }
546 Deprecation::countDeprecation(m_frame, feature); 548 Deprecation::countDeprecation(m_frame, feature);
547 } 549 }
548 550
549 } // namespace blink 551 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698