OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DocumentUserGestureToken_h |
| 6 #define DocumentUserGestureToken_h |
| 7 |
| 8 #include "core/dom/Document.h" |
| 9 #include "platform/UserGestureIndicator.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 // Associates a UserGestureToken with a Document, if a non-null Document* |
| 14 // is provided in the constructor. |
| 15 class DocumentUserGestureToken final : public UserGestureToken { |
| 16 WTF_MAKE_NONCOPYABLE(DocumentUserGestureToken); |
| 17 |
| 18 public: |
| 19 static PassRefPtr<UserGestureToken> create( |
| 20 Document* document, |
| 21 Status status = PossiblyExistingGesture) { |
| 22 return adoptRef(new DocumentUserGestureToken(document, status)); |
| 23 } |
| 24 |
| 25 ~DocumentUserGestureToken() final {} |
| 26 |
| 27 private: |
| 28 DocumentUserGestureToken(Document* document, Status status) |
| 29 : UserGestureToken(status) { |
| 30 if (document) |
| 31 document->setHasReceivedUserGesture(); |
| 32 } |
| 33 }; |
| 34 |
| 35 } // namespace blink |
| 36 |
| 37 #endif // DocumentUserGestureToken_h |
OLD | NEW |