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