Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: Source/core/loader/BeaconLoader.h

Issue 232053005: Implement navigator.sendBeacon() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adjust unrelated test expectation Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/BeaconLoader.h
diff --git a/Source/core/loader/BeaconLoader.h b/Source/core/loader/BeaconLoader.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3699b139ba4445a54663ac4c3e316627d3b1ccf
--- /dev/null
+++ b/Source/core/loader/BeaconLoader.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BeaconLoader_h
+#define BeaconLoader_h
+
+#include "core/loader/SimplexLoader.h"
+#include "platform/heap/Handle.h"
+#include "wtf/Noncopyable.h"
+
+namespace WTF {
+class ArrayBufferView;
+}
+
+namespace WebCore {
+
+class Blob;
+class DOMFormData;
+class KURL;
+class LocalFrame;
+
+// Issue asynchronous beacon transmission loads independent of LocalFrame
+// staying alive. SimplexLoader providing the service.
+class BeaconLoader FINAL : public SimplexLoader {
+ WTF_MAKE_NONCOPYABLE(BeaconLoader);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static void sendBeacon(LocalFrame*, const KURL&, const String&);
+ static void sendBeacon(LocalFrame*, const KURL&, PassRefPtr<WTF::ArrayBufferView>&);
+ static void sendBeacon(LocalFrame*, const KURL&, PassRefPtrWillBeRawPtr<Blob>&);
+ static void sendBeacon(LocalFrame*, const KURL&, PassRefPtrWillBeRawPtr<DOMFormData>&);
+
+ virtual ~BeaconLoader() { }
+
+private:
+ static void prepareRequest(LocalFrame*, ResourceRequest&);
+ static void issueRequest(LocalFrame*, ResourceRequest&);
+};
+
+} // namespace WebCore
+
+#endif // BeaconLoader_h

Powered by Google App Engine
This is Rietveld 408576698