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

Side by Side Diff: chrome/renderer/prefetch_helper.cc

Issue 407883005: Remove 'WebURLRequest::TargetType' from PrefetchHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/prefetch_helper.h" 5 #include "chrome/renderer/prefetch_helper.h"
6 6
7 #include "chrome/common/prefetch_messages.h" 7 #include "chrome/common/prefetch_messages.h"
8 #include "content/public/renderer/render_frame.h" 8 #include "content/public/renderer/render_frame.h"
9 #include "third_party/WebKit/public/web/WebFrame.h" 9 #include "third_party/WebKit/public/web/WebFrame.h"
10 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" 10 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
(...skipping 15 matching lines...) Expand all
26 IPC_MESSAGE_HANDLER(PrefetchMsg_Prefetch, OnPrefetch) 26 IPC_MESSAGE_HANDLER(PrefetchMsg_Prefetch, OnPrefetch)
27 IPC_MESSAGE_UNHANDLED(handled = false) 27 IPC_MESSAGE_UNHANDLED(handled = false)
28 IPC_END_MESSAGE_MAP() 28 IPC_END_MESSAGE_MAP()
29 29
30 return handled; 30 return handled;
31 } 31 }
32 32
33 void PrefetchHelper::OnPrefetch(const GURL& url) { 33 void PrefetchHelper::OnPrefetch(const GURL& url) {
34 blink::WebFrame* frame = render_frame()->GetWebFrame(); 34 blink::WebFrame* frame = render_frame()->GetWebFrame();
35 blink::WebURLRequest request(url); 35 blink::WebURLRequest request(url);
36 request.setTargetType(blink::WebURLRequest::TargetIsPrefetch); 36 request.setRequestContext(blink::WebURLRequest::RequestContextPrefetch);
37 request.setPriority(blink::WebURLRequest::PriorityVeryLow); 37 request.setPriority(blink::WebURLRequest::PriorityVeryLow);
38 blink::WebURLLoaderOptions options; 38 blink::WebURLLoaderOptions options;
39 options.allowCredentials = true; 39 options.allowCredentials = true;
40 options.crossOriginRequestPolicy = 40 options.crossOriginRequestPolicy =
41 blink::WebURLLoaderOptions::CrossOriginRequestPolicyAllow; 41 blink::WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
42 blink::WebURLLoader* loader = frame->createAssociatedURLLoader(options); 42 blink::WebURLLoader* loader = frame->createAssociatedURLLoader(options);
43 loader->loadAsynchronously(request, this); 43 loader->loadAsynchronously(request, this);
44 loader_set_.insert(loader); 44 loader_set_.insert(loader);
45 } 45 }
46 46
47 void PrefetchHelper::didFinishLoading(blink::WebURLLoader* loader, 47 void PrefetchHelper::didFinishLoading(blink::WebURLLoader* loader,
48 double finishTime, 48 double finishTime,
49 int64_t totalEncodedDataLength) { 49 int64_t totalEncodedDataLength) {
50 loader_set_.erase(loader); 50 loader_set_.erase(loader);
51 } 51 }
52 52
53 void PrefetchHelper::didFail(blink::WebURLLoader* loader, 53 void PrefetchHelper::didFail(blink::WebURLLoader* loader,
54 const blink::WebURLError& error) { 54 const blink::WebURLError& error) {
55 loader_set_.erase(loader); 55 loader_set_.erase(loader);
56 } 56 }
57 57
58 } // namespace prefetch 58 } // namespace prefetch
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698