OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Issue an asynchronous, one-directional request at some resources, ignoring | 51 // Issue an asynchronous, one-directional request at some resources, ignoring |
52 // any response. The request is made independent of any LocalFrame staying alive
, | 52 // any response. The request is made independent of any LocalFrame staying alive
, |
53 // and must only stay alive until the transmission has completed successfully | 53 // and must only stay alive until the transmission has completed successfully |
54 // (or not -- errors are not propagated back either.) Upon transmission, the | 54 // (or not -- errors are not propagated back either.) Upon transmission, the |
55 // the load is cancelled and the loader cancels itself. | 55 // the load is cancelled and the loader cancels itself. |
56 // | 56 // |
57 // The ping loader is used by audit pings, beacon transmissions and image loads | 57 // The ping loader is used by audit pings, beacon transmissions and image loads |
58 // during page unloading. | 58 // during page unloading. |
59 // | 59 // |
60 class CORE_EXPORT PingLoader : public RefCountedWillBeRefCountedGarbageCollected
<PingLoader>, public PageLifecycleObserver, private blink::WebURLLoaderClient { | 60 class CORE_EXPORT PingLoader : public RefCountedWillBeRefCountedGarbageCollected
<PingLoader>, public PageLifecycleObserver, private WebURLLoaderClient { |
61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PingLoader); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PingLoader); |
62 WTF_MAKE_NONCOPYABLE(PingLoader); | 62 WTF_MAKE_NONCOPYABLE(PingLoader); |
63 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PingLoader); | 63 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PingLoader); |
64 public: | 64 public: |
65 virtual ~PingLoader(); | 65 virtual ~PingLoader(); |
66 | 66 |
67 enum ViolationReportType { | 67 enum ViolationReportType { |
68 ContentSecurityPolicyViolationReport, | 68 ContentSecurityPolicyViolationReport, |
69 XSSAuditorViolationReport | 69 XSSAuditorViolationReport |
70 }; | 70 }; |
71 | 71 |
72 static void loadImage(LocalFrame*, const KURL& url); | 72 static void loadImage(LocalFrame*, const KURL& url); |
73 static void sendLinkAuditPing(LocalFrame*, const KURL& pingURL, const KURL&
destinationURL); | 73 static void sendLinkAuditPing(LocalFrame*, const KURL& pingURL, const KURL&
destinationURL); |
74 static void sendViolationReport(LocalFrame*, const KURL& reportURL, PassRefP
tr<FormData> report, ViolationReportType); | 74 static void sendViolationReport(LocalFrame*, const KURL& reportURL, PassRefP
tr<FormData> report, ViolationReportType); |
75 | 75 |
76 DECLARE_VIRTUAL_TRACE(); | 76 DECLARE_VIRTUAL_TRACE(); |
77 | 77 |
78 protected: | 78 protected: |
79 PingLoader(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&, StoredC
redentials); | 79 PingLoader(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&, StoredC
redentials); |
80 | 80 |
81 static void start(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&,
StoredCredentials = AllowStoredCredentials); | 81 static void start(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&,
StoredCredentials = AllowStoredCredentials); |
82 | 82 |
83 void dispose(); | 83 void dispose(); |
84 | 84 |
85 private: | 85 private: |
86 virtual void didReceiveResponse(blink::WebURLLoader*, const blink::WebURLRes
ponse&) override; | 86 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) overri
de; |
87 virtual void didReceiveData(blink::WebURLLoader*, const char*, int, int) ove
rride; | 87 virtual void didReceiveData(WebURLLoader*, const char*, int, int) override; |
88 virtual void didFinishLoading(blink::WebURLLoader*, double, int64_t) overrid
e; | 88 virtual void didFinishLoading(WebURLLoader*, double, int64_t) override; |
89 virtual void didFail(blink::WebURLLoader*, const blink::WebURLError&) overri
de; | 89 virtual void didFail(WebURLLoader*, const WebURLError&) override; |
90 | 90 |
91 void timeout(Timer<PingLoader>*); | 91 void timeout(Timer<PingLoader>*); |
92 | 92 |
93 void didFailLoading(Page*); | 93 void didFailLoading(Page*); |
94 | 94 |
95 OwnPtr<blink::WebURLLoader> m_loader; | 95 OwnPtr<WebURLLoader> m_loader; |
96 Timer<PingLoader> m_timeout; | 96 Timer<PingLoader> m_timeout; |
97 String m_url; | 97 String m_url; |
98 unsigned long m_identifier; | 98 unsigned long m_identifier; |
99 }; | 99 }; |
100 | 100 |
101 } | 101 } // namespace blink |
102 | 102 |
103 #endif // PingLoader_h | 103 #endif // PingLoader_h |
OLD | NEW |