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

Side by Side Diff: content/child/web_url_request_util.cc

Issue 1858533002: Introduce WebCachePolicy to merge cache policy enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hiroshige review Created 4 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
« no previous file with comments | « chrome/renderer/net/net_error_helper.cc ('k') | content/public/renderer/resource_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/child/web_url_request_util.h" 5 #include "content/child/web_url_request_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "net/base/load_flags.h" 14 #include "net/base/load_flags.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "third_party/WebKit/public/platform/FilePathConversion.h" 16 #include "third_party/WebKit/public/platform/FilePathConversion.h"
17 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
17 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" 18 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
18 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
19 #include "third_party/WebKit/public/platform/WebURL.h" 20 #include "third_party/WebKit/public/platform/WebURL.h"
20 #include "third_party/WebKit/public/platform/WebURLError.h" 21 #include "third_party/WebKit/public/platform/WebURLError.h"
21 #include "third_party/WebKit/public/platform/WebURLRequest.h" 22 #include "third_party/WebKit/public/platform/WebURLRequest.h"
22 23
24 using blink::WebCachePolicy;
23 using blink::WebHTTPBody; 25 using blink::WebHTTPBody;
24 using blink::WebString; 26 using blink::WebString;
25 using blink::WebURLRequest; 27 using blink::WebURLRequest;
26 28
27 namespace content { 29 namespace content {
28 30
29 namespace { 31 namespace {
30 32
31 const char kThrottledErrorDescription[] = 33 const char kThrottledErrorDescription[] =
32 "Request throttled. Visit http://dev.chromium.org/throttling for more " 34 "Request throttled. Visit http://dev.chromium.org/throttling for more "
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request) { 181 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request) {
180 HeaderFlattener flattener; 182 HeaderFlattener flattener;
181 request.visitHTTPHeaderFields(&flattener); 183 request.visitHTTPHeaderFields(&flattener);
182 return flattener.GetBuffer(); 184 return flattener.GetBuffer();
183 } 185 }
184 186
185 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request) { 187 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request) {
186 int load_flags = net::LOAD_NORMAL; 188 int load_flags = net::LOAD_NORMAL;
187 GURL url = request.url(); 189 GURL url = request.url();
188 switch (request.getCachePolicy()) { 190 switch (request.getCachePolicy()) {
189 case WebURLRequest::ValidatingCacheData: 191 case WebCachePolicy::ValidatingCacheData:
190 load_flags |= net::LOAD_VALIDATE_CACHE; 192 load_flags |= net::LOAD_VALIDATE_CACHE;
191 break; 193 break;
192 case WebURLRequest::BypassingCache: 194 case WebCachePolicy::BypassingCache:
193 load_flags |= net::LOAD_BYPASS_CACHE; 195 load_flags |= net::LOAD_BYPASS_CACHE;
194 break; 196 break;
195 case WebURLRequest::ReturnCacheDataElseLoad: 197 case WebCachePolicy::ReturnCacheDataElseLoad:
196 load_flags |= net::LOAD_PREFERRING_CACHE; 198 load_flags |= net::LOAD_PREFERRING_CACHE;
197 break; 199 break;
198 case WebURLRequest::ReturnCacheDataDontLoad: 200 case WebCachePolicy::ReturnCacheDataDontLoad:
199 load_flags |= net::LOAD_ONLY_FROM_CACHE; 201 load_flags |= net::LOAD_ONLY_FROM_CACHE;
200 break; 202 break;
201 case WebURLRequest::UseProtocolCachePolicy: 203 case WebCachePolicy::UseProtocolCachePolicy:
202 break; 204 break;
203 default: 205 default:
204 NOTREACHED(); 206 NOTREACHED();
205 } 207 }
206 208
207 if (!request.allowStoredCredentials()) { 209 if (!request.allowStoredCredentials()) {
208 load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; 210 load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES;
209 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; 211 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES;
210 } 212 }
211 213
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 bool stale_copy_in_cache, 434 bool stale_copy_in_cache,
433 int reason, 435 int reason,
434 bool was_ignored_by_handler) { 436 bool was_ignored_by_handler) {
435 blink::WebURLError error = 437 blink::WebURLError error =
436 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); 438 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason);
437 error.wasIgnoredByHandler = was_ignored_by_handler; 439 error.wasIgnoredByHandler = was_ignored_by_handler;
438 return error; 440 return error;
439 } 441 }
440 442
441 } // namespace content 443 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/net/net_error_helper.cc ('k') | content/public/renderer/resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698