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