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, |
| 550 render_frame_host_? render_frame_host_->GetLastCommittedURL() : GURL(), |
| 551 WebContents::FromRenderFrameHost(render_frame_host_), |
| 552 default_file_path, alternate_extensions, profile_, |
550 base::Bind(&InterpretSafeBrowsingVerdict, | 553 base::Bind(&InterpretSafeBrowsingVerdict, |
551 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, | 554 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, |
552 this, default_file_path, base::Passed(¶ms)))); | 555 this, default_file_path, base::Passed(¶ms)))); |
553 } | 556 } |
554 | 557 |
555 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( | 558 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( |
556 const base::FilePath& default_file_path, | 559 const base::FilePath& default_file_path, |
557 std::unique_ptr<content::FileChooserParams> params, | 560 std::unique_ptr<content::FileChooserParams> params, |
558 bool allowed_by_safe_browsing) { | 561 bool allowed_by_safe_browsing) { |
559 if (!allowed_by_safe_browsing) { | 562 if (!allowed_by_safe_browsing) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 706 |
704 // static | 707 // static |
705 base::FilePath FileSelectHelper::GetSanitizedFileName( | 708 base::FilePath FileSelectHelper::GetSanitizedFileName( |
706 const base::FilePath& suggested_filename) { | 709 const base::FilePath& suggested_filename) { |
707 if (suggested_filename.empty()) | 710 if (suggested_filename.empty()) |
708 return base::FilePath(); | 711 return base::FilePath(); |
709 return net::GenerateFileName( | 712 return net::GenerateFileName( |
710 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), | 713 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), |
711 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); | 714 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); |
712 } | 715 } |
OLD | NEW |