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 for (; document; document = document->parentDocument()) { | |
Rick Byers
2016/10/24 18:30:47
Any thoughts about what should be done for OOPIF?
Nate Chapin
2016/10/24 18:45:18
Added TODO, filed https://bugs.chromium.org/p/chro
| |
31 if (document) | |
ojan
2016/10/21 21:33:06
This can early return if the document->hasReceived
Nate Chapin
2016/10/21 21:36:49
Technically it's not guaranteed that, if a Documen
Rick Byers
2016/10/24 18:30:46
If there's no good way to avoid this then I'm not
| |
32 document->setHasReceivedUserGesture(); | |
33 } | |
34 } | |
35 }; | |
36 | |
37 } // namespace blink | |
38 | |
39 #endif // DocumentUserGestureToken_h | |
OLD | NEW |