| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 default_file_path.ReplaceExtension(extension_in_list) | 524 default_file_path.ReplaceExtension(extension_in_list) |
| 525 .FinalExtension(); | 525 .FinalExtension(); |
| 526 alternate_extensions.push_back(extension); | 526 alternate_extensions.push_back(extension); |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| 531 GURL requestor_url = params->requestor; | 531 GURL requestor_url = params->requestor; |
| 532 sb_service->download_protection_service()->CheckPPAPIDownloadRequest( | 532 sb_service->download_protection_service()->CheckPPAPIDownloadRequest( |
| 533 requestor_url, default_file_path, alternate_extensions, | 533 requestor_url, default_file_path, alternate_extensions, |
| 534 Profile::FromBrowserContext(web_contents_->GetBrowserContext()), |
| 534 base::Bind(&InterpretSafeBrowsingVerdict, | 535 base::Bind(&InterpretSafeBrowsingVerdict, |
| 535 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, | 536 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, |
| 536 this, default_file_path, base::Passed(¶ms)))); | 537 this, default_file_path, base::Passed(¶ms)))); |
| 537 } | 538 } |
| 538 | 539 |
| 539 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( | 540 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( |
| 540 const base::FilePath& default_file_path, | 541 const base::FilePath& default_file_path, |
| 541 std::unique_ptr<content::FileChooserParams> params, | 542 std::unique_ptr<content::FileChooserParams> params, |
| 542 bool allowed_by_safe_browsing) { | 543 bool allowed_by_safe_browsing) { |
| 543 if (!allowed_by_safe_browsing) { | 544 if (!allowed_by_safe_browsing) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 | 681 |
| 681 // static | 682 // static |
| 682 base::FilePath FileSelectHelper::GetSanitizedFileName( | 683 base::FilePath FileSelectHelper::GetSanitizedFileName( |
| 683 const base::FilePath& suggested_filename) { | 684 const base::FilePath& suggested_filename) { |
| 684 if (suggested_filename.empty()) | 685 if (suggested_filename.empty()) |
| 685 return base::FilePath(); | 686 return base::FilePath(); |
| 686 return net::GenerateFileName( | 687 return net::GenerateFileName( |
| 687 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), | 688 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), |
| 688 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); | 689 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); |
| 689 } | 690 } |
| OLD | NEW |