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

Side by Side Diff: Source/WebCore/loader/PingLoader.cpp

Issue 13687007: Remove PLATFORM(BLACKBERRY) support. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 namespace WebCore { 52 namespace WebCore {
53 53
54 void PingLoader::loadImage(Frame* frame, const KURL& url) 54 void PingLoader::loadImage(Frame* frame, const KURL& url)
55 { 55 {
56 if (!frame->document()->securityOrigin()->canDisplay(url)) { 56 if (!frame->document()->securityOrigin()->canDisplay(url)) {
57 FrameLoader::reportLocalLoadFailed(frame, url); 57 FrameLoader::reportLocalLoadFailed(frame, url);
58 return; 58 return;
59 } 59 }
60 60
61 ResourceRequest request(url); 61 ResourceRequest request(url);
62 #if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) 62 #if PLATFORM(CHROMIUM)
63 request.setTargetType(ResourceRequest::TargetIsImage); 63 request.setTargetType(ResourceRequest::TargetIsImage);
64 #endif 64 #endif
65 request.setHTTPHeaderField("Cache-Control", "max-age=0"); 65 request.setHTTPHeaderField("Cache-Control", "max-age=0");
66 String referrer = SecurityPolicy::generateReferrerHeader(frame->document()-> referrerPolicy(), request.url(), frame->loader()->outgoingReferrer()); 66 String referrer = SecurityPolicy::generateReferrerHeader(frame->document()-> referrerPolicy(), request.url(), frame->loader()->outgoingReferrer());
67 if (!referrer.isEmpty()) 67 if (!referrer.isEmpty())
68 request.setHTTPReferrer(referrer); 68 request.setHTTPReferrer(referrer);
69 frame->loader()->addExtraFieldsToSubresourceRequest(request); 69 frame->loader()->addExtraFieldsToSubresourceRequest(request);
70 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request)); 70 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request));
71 71
72 // Leak the ping loader, since it will kill itself as soon as it receives a response. 72 // Leak the ping loader, since it will kill itself as soon as it receives a response.
73 PingLoader* leakedPingLoader = pingLoader.leakPtr(); 73 PingLoader* leakedPingLoader = pingLoader.leakPtr();
74 UNUSED_PARAM(leakedPingLoader); 74 UNUSED_PARAM(leakedPingLoader);
75 } 75 }
76 76
77 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing 77 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing
78 void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destina tionURL) 78 void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destina tionURL)
79 { 79 {
80 ResourceRequest request(pingURL); 80 ResourceRequest request(pingURL);
81 #if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) 81 #if PLATFORM(CHROMIUM)
82 request.setTargetType(ResourceRequest::TargetIsSubresource); 82 request.setTargetType(ResourceRequest::TargetIsSubresource);
83 #endif 83 #endif
84 request.setHTTPMethod("POST"); 84 request.setHTTPMethod("POST");
85 request.setHTTPContentType("text/ping"); 85 request.setHTTPContentType("text/ping");
86 request.setHTTPBody(FormData::create("PING")); 86 request.setHTTPBody(FormData::create("PING"));
87 request.setHTTPHeaderField("Cache-Control", "max-age=0"); 87 request.setHTTPHeaderField("Cache-Control", "max-age=0");
88 frame->loader()->addExtraFieldsToSubresourceRequest(request); 88 frame->loader()->addExtraFieldsToSubresourceRequest(request);
89 89
90 SecurityOrigin* sourceOrigin = frame->document()->securityOrigin(); 90 SecurityOrigin* sourceOrigin = frame->document()->securityOrigin();
91 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); 91 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL);
(...skipping 10 matching lines...) Expand all
102 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request)); 102 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request));
103 103
104 // Leak the ping loader, since it will kill itself as soon as it receives a response. 104 // Leak the ping loader, since it will kill itself as soon as it receives a response.
105 PingLoader* leakedPingLoader = pingLoader.leakPtr(); 105 PingLoader* leakedPingLoader = pingLoader.leakPtr();
106 UNUSED_PARAM(leakedPingLoader); 106 UNUSED_PARAM(leakedPingLoader);
107 } 107 }
108 108
109 void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRe fPtr<FormData> report) 109 void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRe fPtr<FormData> report)
110 { 110 {
111 ResourceRequest request(reportURL); 111 ResourceRequest request(reportURL);
112 #if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) 112 #if PLATFORM(CHROMIUM)
113 request.setTargetType(ResourceRequest::TargetIsSubresource); 113 request.setTargetType(ResourceRequest::TargetIsSubresource);
114 #endif 114 #endif
115 request.setHTTPMethod("POST"); 115 request.setHTTPMethod("POST");
116 request.setHTTPContentType("application/json"); 116 request.setHTTPContentType("application/json");
117 request.setHTTPBody(report); 117 request.setHTTPBody(report);
118 frame->loader()->addExtraFieldsToSubresourceRequest(request); 118 frame->loader()->addExtraFieldsToSubresourceRequest(request);
119 119
120 String referrer = SecurityPolicy::generateReferrerHeader(frame->document()-> referrerPolicy(), reportURL, frame->loader()->outgoingReferrer()); 120 String referrer = SecurityPolicy::generateReferrerHeader(frame->document()-> referrerPolicy(), reportURL, frame->loader()->outgoingReferrer());
121 if (!referrer.isEmpty()) 121 if (!referrer.isEmpty())
122 request.setHTTPReferrer(referrer); 122 request.setHTTPReferrer(referrer);
(...skipping 23 matching lines...) Expand all
146 m_timeout.startOneShot(60000); 146 m_timeout.startOneShot(60000);
147 } 147 }
148 148
149 PingLoader::~PingLoader() 149 PingLoader::~PingLoader()
150 { 150 {
151 if (m_handle) 151 if (m_handle)
152 m_handle->cancel(); 152 m_handle->cancel();
153 } 153 }
154 154
155 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698