OLD | NEW |
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 std::unique_ptr<net::URLRequest> request( | 309 std::unique_ptr<net::URLRequest> request( |
310 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); | 310 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
311 request->set_method("GET"); | 311 request->set_method("GET"); |
312 | 312 |
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 -1 /*TODO(horo)*/, context, nullptr /*TODO(horo)*/); |
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_SKIP_CACHE_VALIDATION); | 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)) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 if (it != save_file_map_.end()) { | 447 if (it != save_file_map_.end()) { |
448 SaveFile* save_file = it->second.get(); | 448 SaveFile* save_file = it->second.get(); |
449 DCHECK(!save_file->InProgress()); | 449 DCHECK(!save_file->InProgress()); |
450 base::DeleteFile(save_file->FullPath(), false); | 450 base::DeleteFile(save_file->FullPath(), false); |
451 save_file_map_.erase(it); | 451 save_file_map_.erase(it); |
452 } | 452 } |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 } // namespace content | 456 } // namespace content |
OLD | NEW |