Chromium Code Reviews| 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 "chrome/browser/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 base::FilePath::StringType extension = | 539 base::FilePath::StringType extension = |
| 540 default_file_path.ReplaceExtension(extension_in_list) | 540 default_file_path.ReplaceExtension(extension_in_list) |
| 541 .FinalExtension(); | 541 .FinalExtension(); |
| 542 alternate_extensions.push_back(extension); | 542 alternate_extensions.push_back(extension); |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 | 546 |
| 547 GURL requestor_url = params->requestor; | 547 GURL requestor_url = params->requestor; |
| 548 sb_service->download_protection_service()->CheckPPAPIDownloadRequest( | 548 sb_service->download_protection_service()->CheckPPAPIDownloadRequest( |
| 549 requestor_url, default_file_path, alternate_extensions, profile_, | 549 requestor_url, render_frame_host_->GetLastCommittedURL(), |
|
asanka
2017/01/05 20:35:31
render_frame_host_ could be nullptr :-(
Jialiu Lin
2017/01/05 22:10:13
Added a check here. in case render_frame_host_ is
| |
| 550 WebContents::FromRenderFrameHost(render_frame_host_), | |
| 551 default_file_path, alternate_extensions, profile_, | |
| 550 base::Bind(&InterpretSafeBrowsingVerdict, | 552 base::Bind(&InterpretSafeBrowsingVerdict, |
| 551 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, | 553 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, |
| 552 this, default_file_path, base::Passed(¶ms)))); | 554 this, default_file_path, base::Passed(¶ms)))); |
| 553 } | 555 } |
| 554 | 556 |
| 555 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( | 557 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( |
| 556 const base::FilePath& default_file_path, | 558 const base::FilePath& default_file_path, |
| 557 std::unique_ptr<content::FileChooserParams> params, | 559 std::unique_ptr<content::FileChooserParams> params, |
| 558 bool allowed_by_safe_browsing) { | 560 bool allowed_by_safe_browsing) { |
| 559 if (!allowed_by_safe_browsing) { | 561 if (!allowed_by_safe_browsing) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 | 705 |
| 704 // static | 706 // static |
| 705 base::FilePath FileSelectHelper::GetSanitizedFileName( | 707 base::FilePath FileSelectHelper::GetSanitizedFileName( |
| 706 const base::FilePath& suggested_filename) { | 708 const base::FilePath& suggested_filename) { |
| 707 if (suggested_filename.empty()) | 709 if (suggested_filename.empty()) |
| 708 return base::FilePath(); | 710 return base::FilePath(); |
| 709 return net::GenerateFileName( | 711 return net::GenerateFileName( |
| 710 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), | 712 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), |
| 711 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); | 713 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); |
| 712 } | 714 } |
| OLD | NEW |