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