OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NavigatorBeacon_h | 5 #ifndef NavigatorBeacon_h |
6 #define NavigatorBeacon_h | 6 #define NavigatorBeacon_h |
7 | 7 |
| 8 #include "core/frame/LocalFrameLifecycleObserver.h" |
8 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
9 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class Blob; | 15 class Blob; |
15 class ExceptionState; | 16 class ExceptionState; |
16 class ExecutionContext; | 17 class ExecutionContext; |
17 class KURL; | 18 class KURL; |
18 class ArrayBufferViewOrBlobOrStringOrFormData; | 19 class ArrayBufferViewOrBlobOrStringOrFormData; |
19 | 20 |
20 class NavigatorBeacon final : public NoBaseWillBeGarbageCollected<NavigatorBeaco
n>, public WillBeHeapSupplement<Navigator> { | 21 class NavigatorBeacon final : public GarbageCollectedFinalized<NavigatorBeacon>,
public LocalFrameLifecycleObserver, public HeapSupplement<Navigator> { |
21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorBeacon); | 22 USING_GARBAGE_COLLECTED_MIXIN(NavigatorBeacon); |
22 public: | 23 public: |
23 static NavigatorBeacon& from(Navigator&); | 24 static NavigatorBeacon& from(Navigator&); |
| 25 virtual ~NavigatorBeacon(); |
24 | 26 |
25 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, const A
rrayBufferViewOrBlobOrStringOrFormData&, ExceptionState&); | 27 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, const A
rrayBufferViewOrBlobOrStringOrFormData&, ExceptionState&); |
26 | 28 |
27 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
28 | 30 |
29 private: | 31 private: |
30 explicit NavigatorBeacon(Navigator&); | 32 explicit NavigatorBeacon(Navigator&); |
31 | 33 |
32 static const char* supplementName(); | 34 static const char* supplementName(); |
33 | 35 |
34 bool canSendBeacon(ExecutionContext*, const KURL&, ExceptionState&); | 36 bool canSendBeacon(ExecutionContext*, const KURL&, ExceptionState&); |
35 int maxAllowance() const; | 37 int maxAllowance() const; |
36 bool beaconResult(ExecutionContext*, bool allowed, int sentBytes); | 38 bool beaconResult(ExecutionContext*, bool allowed, int sentBytes); |
37 | 39 |
38 int m_transmittedBytes; | 40 int m_transmittedBytes; |
39 Navigator& m_navigator; | |
40 }; | 41 }; |
41 | 42 |
42 } // namespace blink | 43 } // namespace blink |
43 | 44 |
44 #endif // NavigatorBeacon_h | 45 #endif // NavigatorBeacon_h |
OLD | NEW |