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/Navigator.h" | 8 #include "core/frame/Navigator.h" |
9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class Blob; | 14 class Blob; |
15 class DOMArrayBufferView; | 15 class DOMArrayBufferView; |
16 class DOMFormData; | 16 class DOMFormData; |
17 class ExceptionState; | 17 class ExceptionState; |
18 class ExecutionContext; | 18 class ExecutionContext; |
19 class KURL; | 19 class KURL; |
| 20 class ArrayBufferViewOrBlobOrStringOrFormData; |
20 | 21 |
21 class NavigatorBeacon final : public NoBaseWillBeGarbageCollected<NavigatorBeaco
n>, public WillBeHeapSupplement<Navigator> { | 22 class NavigatorBeacon final : public NoBaseWillBeGarbageCollected<NavigatorBeaco
n>, public WillBeHeapSupplement<Navigator> { |
22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorBeacon); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorBeacon); |
23 public: | 24 public: |
24 static NavigatorBeacon& from(Navigator&); | 25 static NavigatorBeacon& from(Navigator&); |
25 | 26 |
26 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, const S
tring&, ExceptionState&); | 27 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, const A
rrayBufferViewOrBlobOrStringOrFormData&, ExceptionState&); |
27 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, PassRef
Ptr<DOMArrayBufferView>, ExceptionState&); | |
28 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, Blob*,
ExceptionState&); | |
29 static bool sendBeacon(ExecutionContext*, Navigator&, const String&, PassRef
PtrWillBeRawPtr<DOMFormData>, ExceptionState&); | |
30 | 28 |
31 private: | 29 private: |
32 explicit NavigatorBeacon(Navigator&); | 30 explicit NavigatorBeacon(Navigator&); |
33 | 31 |
34 static const char* supplementName(); | 32 static const char* supplementName(); |
35 | 33 |
36 bool sendBeacon(ExecutionContext*, const String&, const String&, ExceptionSt
ate&); | |
37 bool sendBeacon(ExecutionContext*, const String&, PassRefPtr<DOMArrayBufferV
iew>, ExceptionState&); | |
38 bool sendBeacon(ExecutionContext*, const String&, Blob*, ExceptionState&); | |
39 bool sendBeacon(ExecutionContext*, const String&, PassRefPtrWillBeRawPtr<DOM
FormData>, ExceptionState&); | |
40 | |
41 bool canSendBeacon(ExecutionContext*, const KURL&, ExceptionState&); | 34 bool canSendBeacon(ExecutionContext*, const KURL&, ExceptionState&); |
42 int maxAllowance() const; | 35 int maxAllowance() const; |
43 bool beaconResult(ExecutionContext*, bool allowed, int sentBytes); | 36 bool beaconResult(ExecutionContext*, bool allowed, int sentBytes); |
44 | 37 |
45 int m_transmittedBytes; | 38 int m_transmittedBytes; |
46 Navigator& m_navigator; | 39 Navigator& m_navigator; |
47 }; | 40 }; |
48 | 41 |
49 } // namespace blink | 42 } // namespace blink |
50 | 43 |
51 #endif // NavigatorBeacon_h | 44 #endif // NavigatorBeacon_h |
OLD | NEW |