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 "config.h" | 5 #include "config.h" |
6 #include "modules/beacon/NavigatorBeacon.h" | 6 #include "modules/beacon/NavigatorBeacon.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/modules/v8/UnionTypesModules.h" | 9 #include "bindings/modules/v8/UnionTypesModules.h" |
10 #include "core/dom/DOMArrayBufferView.h" | 10 #include "core/dom/DOMArrayBufferView.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (!impl.canSendBeacon(context, url, exceptionState)) | 97 if (!impl.canSendBeacon(context, url, exceptionState)) |
98 return false; | 98 return false; |
99 | 99 |
100 int allowance = impl.maxAllowance(); | 100 int allowance = impl.maxAllowance(); |
101 int bytes = 0; | 101 int bytes = 0; |
102 bool allowed; | 102 bool allowed; |
103 | 103 |
104 if (data.isArrayBufferView()) | 104 if (data.isArrayBufferView()) |
105 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsArrayBufferView()->view(), bytes); | 105 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsArrayBufferView()->view(), bytes); |
106 else if (data.isBlob()) | 106 else if (data.isBlob()) |
107 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsBlob().get(), bytes); | 107 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsBlob(), bytes); |
108 else if (data.isString()) | 108 else if (data.isString()) |
109 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsString(), bytes); | 109 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsString(), bytes); |
110 else if (data.isFormData()) | 110 else if (data.isFormData()) |
111 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsFormData(), bytes); | 111 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, da
ta.getAsFormData(), bytes); |
112 else | 112 else |
113 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, St
ring(), bytes); | 113 allowed = BeaconLoader::sendBeacon(navigator.frame(), allowance, url, St
ring(), bytes); |
114 | 114 |
115 return impl.beaconResult(context, allowed, bytes); | 115 return impl.beaconResult(context, allowed, bytes); |
116 } | 116 } |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
OLD | NEW |