Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/fetch/FetchContext.h" | 37 #include "core/fetch/FetchContext.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/inspector/InspectorInstrumentation.h" | 39 #include "core/inspector/InspectorInstrumentation.h" |
| 40 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
| 41 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 42 #include "core/loader/FrameLoaderClient.h" | 42 #include "core/loader/FrameLoaderClient.h" |
| 43 #include "core/loader/UniqueIdentifier.h" | 43 #include "core/loader/UniqueIdentifier.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "platform/exported/WrappedResourceRequest.h" | 45 #include "platform/exported/WrappedResourceRequest.h" |
| 46 #include "platform/network/FormData.h" | |
| 47 #include "platform/network/ResourceError.h" | 46 #include "platform/network/ResourceError.h" |
| 48 #include "platform/network/ResourceRequest.h" | 47 #include "platform/network/ResourceRequest.h" |
| 49 #include "platform/network/ResourceResponse.h" | 48 #include "platform/network/ResourceResponse.h" |
| 50 #include "platform/weborigin/SecurityOrigin.h" | 49 #include "platform/weborigin/SecurityOrigin.h" |
| 51 #include "platform/weborigin/SecurityPolicy.h" | 50 #include "platform/weborigin/SecurityPolicy.h" |
| 52 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
| 53 #include "public/platform/WebURLLoader.h" | 52 #include "public/platform/WebURLLoader.h" |
| 54 #include "public/platform/WebURLResponse.h" | 53 #include "public/platform/WebURLResponse.h" |
| 55 #include "wtf/OwnPtr.h" | 54 #include "wtf/OwnPtr.h" |
| 56 | 55 |
| 56 | |
|
abarth-chromium
2014/05/08 13:15:25
Extra blank line
| |
| 57 namespace WebCore { | 57 namespace WebCore { |
| 58 | 58 |
| 59 void PingLoader::loadImage(LocalFrame* frame, const KURL& url) | 59 void PingLoader::loadImage(LocalFrame* frame, const KURL& url) |
| 60 { | 60 { |
| 61 if (!frame->document()->securityOrigin()->canDisplay(url)) { | 61 if (!frame->document()->securityOrigin()->canDisplay(url)) { |
| 62 FrameLoader::reportLocalLoadFailed(frame, url.string()); | 62 FrameLoader::reportLocalLoadFailed(frame, url.string()); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 | 65 |
| 66 ResourceRequest request(url); | 66 ResourceRequest request(url); |
| 67 request.setTargetType(ResourceRequest::TargetIsPing); | 67 request.setTargetType(ResourceRequest::TargetIsPing); |
| 68 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | 68 request.setHTTPHeaderField("Cache-Control", "max-age=0"); |
| 69 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); | 69 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); |
| 70 | 70 |
| 71 FetchInitiatorInfo initiatorInfo; | 71 FetchInitiatorInfo initiatorInfo; |
| 72 initiatorInfo.name = FetchInitiatorTypeNames::ping; | 72 initiatorInfo.name = FetchInitiatorTypeNames::ping; |
| 73 PingLoader::start(frame, request, initiatorInfo); | 73 PingLoader::start(frame, request, initiatorInfo); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing | 76 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl ink-auditing |
| 77 void PingLoader::sendPing(LocalFrame* frame, const KURL& pingURL, const KURL& de stinationURL) | 77 void PingLoader::sendLinkAuditPing(LocalFrame* frame, const KURL& pingURL, const KURL& destinationURL) |
| 78 { | 78 { |
| 79 ResourceRequest request(pingURL); | 79 ResourceRequest request(pingURL); |
| 80 request.setTargetType(ResourceRequest::TargetIsPing); | 80 request.setTargetType(ResourceRequest::TargetIsPing); |
| 81 request.setHTTPMethod("POST"); | 81 request.setHTTPMethod("POST"); |
| 82 request.setHTTPContentType("text/ping"); | 82 request.setHTTPContentType("text/ping"); |
| 83 request.setHTTPBody(FormData::create("PING")); | 83 request.setHTTPBody(FormData::create("PING")); |
| 84 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | 84 request.setHTTPHeaderField("Cache-Control", "max-age=0"); |
| 85 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); | 85 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); |
| 86 | 86 |
| 87 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); | 87 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 void PingLoader::didReceiveResponse(blink::WebURLLoader*, const blink::WebURLRes ponse&) | 156 void PingLoader::didReceiveResponse(blink::WebURLLoader*, const blink::WebURLRes ponse&) |
| 157 { | 157 { |
| 158 if (Page* page = this->page()) { | 158 if (Page* page = this->page()) { |
| 159 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); | 159 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); |
| 160 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 160 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
| 161 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); | 161 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); |
| 162 } | 162 } |
| 163 delete this; | 163 delete this; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void PingLoader::didReceiveData(blink::WebURLLoader*, const char* data, int data Length, int encodedDataLength) | 166 void PingLoader::didReceiveData(blink::WebURLLoader*, const char*, int, int) |
| 167 { | 167 { |
| 168 if (Page* page = this->page()) { | 168 if (Page* page = this->page()) { |
| 169 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); | 169 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); |
| 170 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 170 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
| 171 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); | 171 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); |
| 172 } | 172 } |
| 173 delete this; | 173 delete this; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void PingLoader::didFinishLoading(blink::WebURLLoader*, double, int64_t) | 176 void PingLoader::didFinishLoading(blink::WebURLLoader*, double, int64_t) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 197 { | 197 { |
| 198 if (Page* page = this->page()) { | 198 if (Page* page = this->page()) { |
| 199 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); | 199 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Re sourceFinish", "data", InspectorResourceFinishEvent::data(m_identifier, 0, true) ); |
| 200 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. | 200 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. |
| 201 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); | 201 InspectorInstrumentation::didFailLoading(page->mainFrame(), m_identifier , ResourceError::cancelledError(m_url)); |
| 202 } | 202 } |
| 203 delete this; | 203 delete this; |
| 204 } | 204 } |
| 205 | 205 |
| 206 } | 206 } |
| OLD | NEW |