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

Side by Side Diff: content/browser/download/save_file_manager.cc

Issue 2398613002: [HttpCache] LOAD_ONLY_FROM_CACHE should not imply LOAD_PREFERRING_CACHE (Closed)
Patch Set: Always check vary Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "content/browser/download/save_file_manager.h" 7 #include "content/browser/download/save_file_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // The URLRequest needs to be initialized with the referrer and other 313 // The URLRequest needs to be initialized with the referrer and other
314 // information prior to issuing it. 314 // information prior to issuing it.
315 ResourceDispatcherHostImpl::Get()->InitializeURLRequest( 315 ResourceDispatcherHostImpl::Get()->InitializeURLRequest(
316 request.get(), referrer, 316 request.get(), referrer,
317 false, // download. 317 false, // download.
318 render_process_host_id, render_view_routing_id, render_frame_routing_id, 318 render_process_host_id, render_view_routing_id, render_frame_routing_id,
319 context); 319 context);
320 320
321 // So far, for saving page, we need fetch content from cache, in the 321 // So far, for saving page, we need fetch content from cache, in the
322 // future, maybe we can use a configuration to configure this behavior. 322 // future, maybe we can use a configuration to configure this behavior.
323 request->SetLoadFlags(net::LOAD_PREFERRING_CACHE); 323 request->SetLoadFlags(net::LOAD_SKIP_CACHE_VALIDATION);
324 324
325 // Check if the renderer is permitted to request the requested URL. 325 // Check if the renderer is permitted to request the requested URL.
326 using AuthorizationState = SaveFileResourceHandler::AuthorizationState; 326 using AuthorizationState = SaveFileResourceHandler::AuthorizationState;
327 AuthorizationState authorization_state = AuthorizationState::AUTHORIZED; 327 AuthorizationState authorization_state = AuthorizationState::AUTHORIZED;
328 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( 328 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
329 render_process_host_id, url)) { 329 render_process_host_id, url)) {
330 DVLOG(1) << "Denying unauthorized save of " << url.possibly_invalid_spec(); 330 DVLOG(1) << "Denying unauthorized save of " << url.possibly_invalid_spec();
331 authorization_state = AuthorizationState::NOT_AUTHORIZED; 331 authorization_state = AuthorizationState::NOT_AUTHORIZED;
332 // No need to return here (i.e. okay to begin processing the request below), 332 // No need to return here (i.e. okay to begin processing the request below),
333 // because NOT_AUTHORIZED will cause the request to be cancelled. See also 333 // because NOT_AUTHORIZED will cause the request to be cancelled. See also
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 SaveFile* save_file = it->second; 450 SaveFile* save_file = it->second;
451 DCHECK(!save_file->InProgress()); 451 DCHECK(!save_file->InProgress());
452 base::DeleteFile(save_file->FullPath(), false); 452 base::DeleteFile(save_file->FullPath(), false);
453 delete save_file; 453 delete save_file;
454 save_file_map_.erase(it); 454 save_file_map_.erase(it);
455 } 455 }
456 } 456 }
457 } 457 }
458 458
459 } // namespace content 459 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_request_core.cc ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698