diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/loader/PingLoader.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/loader/PingLoader.h')
-rw-r--r-- | Source/WebCore/loader/PingLoader.h | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/Source/WebCore/loader/PingLoader.h b/Source/WebCore/loader/PingLoader.h index 295e2f4f2..b29e8da8f 100644 --- a/Source/WebCore/loader/PingLoader.h +++ b/Source/WebCore/loader/PingLoader.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,53 +30,31 @@ * */ -#ifndef PingLoader_h -#define PingLoader_h +#pragma once -#include "ResourceHandleClient.h" -#include "Timer.h" -#include <wtf/Noncopyable.h> -#include <wtf/RefPtr.h> +#include <wtf/Ref.h> namespace WebCore { class FormData; class Frame; class URL; -class ResourceError; -class ResourceHandle; -class ResourceResponse; +class ResourceRequest; -// This class triggers asynchronous loads independent of Frame staying alive (i.e., auditing pingbacks). -// Since nothing depends on resources loaded through this class, we just want -// to allow the load to live long enough to ensure the message was actually sent. -// Therefore, as soon as a callback is received from the ResourceHandle, this class -// will cancel the load and delete itself. -class PingLoader : private ResourceHandleClient { - WTF_MAKE_NONCOPYABLE(PingLoader); WTF_MAKE_FAST_ALLOCATED; -public: - static void loadImage(Frame*, const URL& url); - static void sendPing(Frame*, const URL& pingURL, const URL& destinationURL); - static void sendViolationReport(Frame*, const URL& reportURL, PassRefPtr<FormData> report); +enum class ViolationReportType { + ContentSecurityPolicy, + XSSAuditor, +}; - virtual ~PingLoader(); +class PingLoader { +public: + static void loadImage(Frame&, const URL&); + static void sendPing(Frame&, const URL& pingURL, const URL& destinationURL); + static void sendViolationReport(Frame&, const URL& reportURL, Ref<FormData>&& report, ViolationReportType); private: - static void createPingLoader(Frame*, ResourceRequest&); - PingLoader(Frame*, ResourceRequest&); - - virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override { delete this; } - virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int) override { delete this; } - virtual void didFinishLoading(ResourceHandle*, double) override { delete this; } - virtual void didFail(ResourceHandle*, const ResourceError&) override { delete this; } - virtual bool shouldUseCredentialStorage(ResourceHandle*) override { return m_shouldUseCredentialStorage; } - void timeoutTimerFired(Timer<PingLoader>&) { delete this; } - - RefPtr<ResourceHandle> m_handle; - Timer<PingLoader> m_timeout; - bool m_shouldUseCredentialStorage; + enum class ShouldFollowRedirects { No, Yes }; + static void startPingLoad(Frame&, ResourceRequest&, ShouldFollowRedirects); }; -} - -#endif +} // namespace WebCore |