| 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 #include "modules/beacon/NavigatorBeacon.h" | 5 #include "modules/beacon/NavigatorBeacon.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/modules/v8/UnionTypesModules.h" | 8 #include "bindings/modules/v8/UnionTypesModules.h" |
| 9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 { | 25 { |
| 26 } | 26 } |
| 27 | 27 |
| 28 NavigatorBeacon::~NavigatorBeacon() | 28 NavigatorBeacon::~NavigatorBeacon() |
| 29 { | 29 { |
| 30 } | 30 } |
| 31 | 31 |
| 32 DEFINE_TRACE(NavigatorBeacon) | 32 DEFINE_TRACE(NavigatorBeacon) |
| 33 { | 33 { |
| 34 LocalFrameLifecycleObserver::trace(visitor); | 34 LocalFrameLifecycleObserver::trace(visitor); |
| 35 HeapSupplement<Navigator>::trace(visitor); | 35 Supplement<Navigator>::trace(visitor); |
| 36 } | 36 } |
| 37 | 37 |
| 38 const char* NavigatorBeacon::supplementName() | 38 const char* NavigatorBeacon::supplementName() |
| 39 { | 39 { |
| 40 return "NavigatorBeacon"; | 40 return "NavigatorBeacon"; |
| 41 } | 41 } |
| 42 | 42 |
| 43 NavigatorBeacon& NavigatorBeacon::from(Navigator& navigator) | 43 NavigatorBeacon& NavigatorBeacon::from(Navigator& navigator) |
| 44 { | 44 { |
| 45 NavigatorBeacon* supplement = static_cast<NavigatorBeacon*>(HeapSupplement<N
avigator>::from(navigator, supplementName())); | 45 NavigatorBeacon* supplement = static_cast<NavigatorBeacon*>(Supplement<Navig
ator>::from(navigator, supplementName())); |
| 46 if (!supplement) { | 46 if (!supplement) { |
| 47 supplement = new NavigatorBeacon(navigator); | 47 supplement = new NavigatorBeacon(navigator); |
| 48 provideTo(navigator, supplementName(), supplement); | 48 provideTo(navigator, supplementName(), supplement); |
| 49 } | 49 } |
| 50 return *supplement; | 50 return *supplement; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool NavigatorBeacon::canSendBeacon(ExecutionContext* context, const KURL& url,
ExceptionState& exceptionState) | 53 bool NavigatorBeacon::canSendBeacon(ExecutionContext* context, const KURL& url,
ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 if (!url.isValid()) { | 55 if (!url.isValid()) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.ge
tAsString(), bytes); | 119 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.ge
tAsString(), bytes); |
| 120 else if (data.isFormData()) | 120 else if (data.isFormData()) |
| 121 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.ge
tAsFormData(), bytes); | 121 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.ge
tAsFormData(), bytes); |
| 122 else | 122 else |
| 123 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, String(
), bytes); | 123 allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, String(
), bytes); |
| 124 | 124 |
| 125 return impl.beaconResult(context, allowed, bytes); | 125 return impl.beaconResult(context, allowed, bytes); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |