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