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