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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
| 535 Profile::FromBrowserContext(web_contents_->GetBrowserContext()), |
535 base::Bind(&InterpretSafeBrowsingVerdict, | 536 base::Bind(&InterpretSafeBrowsingVerdict, |
536 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, | 537 base::Bind(&FileSelectHelper::ProceedWithSafeBrowsingVerdict, |
537 this, default_file_path, base::Passed(¶ms)))); | 538 this, default_file_path, base::Passed(¶ms)))); |
538 } | 539 } |
539 | 540 |
540 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( | 541 void FileSelectHelper::ProceedWithSafeBrowsingVerdict( |
541 const base::FilePath& default_file_path, | 542 const base::FilePath& default_file_path, |
542 std::unique_ptr<content::FileChooserParams> params, | 543 std::unique_ptr<content::FileChooserParams> params, |
543 bool allowed_by_safe_browsing) { | 544 bool allowed_by_safe_browsing) { |
544 if (!allowed_by_safe_browsing) { | 545 if (!allowed_by_safe_browsing) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 689 |
689 // static | 690 // static |
690 base::FilePath FileSelectHelper::GetSanitizedFileName( | 691 base::FilePath FileSelectHelper::GetSanitizedFileName( |
691 const base::FilePath& suggested_filename) { | 692 const base::FilePath& suggested_filename) { |
692 if (suggested_filename.empty()) | 693 if (suggested_filename.empty()) |
693 return base::FilePath(); | 694 return base::FilePath(); |
694 return net::GenerateFileName( | 695 return net::GenerateFileName( |
695 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), | 696 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), |
696 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); | 697 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); |
697 } | 698 } |
OLD | NEW |