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 // TODO(japhet): This doesn't work if an ancestor is remote. | |
31 // See http://crbug.com/658800 | |
Charlie Reis
2016/10/24 21:38:16
What are the consequences of leaving this as a TOD
| |
32 for (; document; document = document->parentDocument()) { | |
33 if (document) | |
34 document->setHasReceivedUserGesture(); | |
35 } | |
36 } | |
37 }; | |
38 | |
39 } // namespace blink | |
40 | |
41 #endif // DocumentUserGestureToken_h | |
OLD | NEW |