| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/dom/UserGestureIndicator.h" | 5 #include "core/dom/UserGestureIndicator.h" |
| 6 | 6 |
| 7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
| 8 #include "platform/wtf/Assertions.h" | 8 #include "platform/wtf/Assertions.h" |
| 9 #include "platform/wtf/CurrentTime.h" | 9 #include "platform/wtf/CurrentTime.h" |
| 10 #include "platform/wtf/StdLibExtras.h" | 10 #include "platform/wtf/StdLibExtras.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // User gestures timeout in 1 second. | 27 // User gestures timeout in 1 second. |
| 28 const double kUserGestureTimeout = 1.0; | 28 const double kUserGestureTimeout = 1.0; |
| 29 | 29 |
| 30 // For out of process tokens we allow a 10 second delay. | 30 // For out of process tokens we allow a 10 second delay. |
| 31 const double kUserGestureOutOfProcessTimeout = 10.0; | 31 const double kUserGestureOutOfProcessTimeout = 10.0; |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 PassRefPtr<UserGestureToken> UserGestureToken::Create(Document* document, | 34 PassRefPtr<UserGestureToken> UserGestureToken::Create(Document* document, |
| 35 Status status) { | 35 Status status) { |
| 36 SetHasReceivedUserGesture(document); | 36 SetHasReceivedUserGesture(document); |
| 37 LOG(ERROR) << "new token"; |
| 37 return AdoptRef(new UserGestureToken(status)); | 38 return AdoptRef(new UserGestureToken(status)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 // static | 41 // static |
| 41 PassRefPtr<UserGestureToken> UserGestureToken::Adopt(Document* document, | 42 PassRefPtr<UserGestureToken> UserGestureToken::Adopt(Document* document, |
| 42 UserGestureToken* token) { | 43 UserGestureToken* token) { |
| 43 if (!token || !token->HasGestures()) | 44 if (!token || !token->HasGestures()) |
| 44 return nullptr; | 45 return nullptr; |
| 45 SetHasReceivedUserGesture(document); | 46 SetHasReceivedUserGesture(document); |
| 46 return token; | 47 return token; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 UserGestureToken* UserGestureIndicator::CurrentToken() { | 161 UserGestureToken* UserGestureIndicator::CurrentToken() { |
| 161 DCHECK(IsMainThread()); | 162 DCHECK(IsMainThread()); |
| 162 return root_token_; | 163 return root_token_; |
| 163 } | 164 } |
| 164 | 165 |
| 165 UserGestureToken* UserGestureIndicator::CurrentTokenThreadSafe() { | 166 UserGestureToken* UserGestureIndicator::CurrentTokenThreadSafe() { |
| 166 return IsMainThread() ? CurrentToken() : nullptr; | 167 return IsMainThread() ? CurrentToken() : nullptr; |
| 167 } | 168 } |
| 168 | 169 |
| 169 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |