Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/ui/webui/options2/certificate_manager_handler.cc

Issue 10820034: Remove redirection header and add "ui::" before all SelectFileDialog usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reuploading for different try run. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/webui/options2/certificate_manager_handler.h" 5 #include "chrome/browser/ui/webui/options2/certificate_manager_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 NOTIMPLEMENTED(); 572 NOTIMPLEMENTED();
573 } 573 }
574 574
575 void CertificateManagerHandler::ExportPersonal(const ListValue* args) { 575 void CertificateManagerHandler::ExportPersonal(const ListValue* args) {
576 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); 576 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args);
577 if (!cert) 577 if (!cert)
578 return; 578 return;
579 579
580 selected_cert_list_.push_back(cert); 580 selected_cert_list_.push_back(cert);
581 581
582 SelectFileDialog::FileTypeInfo file_type_info; 582 ui::SelectFileDialog::FileTypeInfo file_type_info;
583 file_type_info.extensions.resize(1); 583 file_type_info.extensions.resize(1);
584 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12")); 584 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12"));
585 file_type_info.extension_description_overrides.push_back( 585 file_type_info.extension_description_overrides.push_back(
586 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES)); 586 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES));
587 file_type_info.include_all_files = true; 587 file_type_info.include_all_files = true;
588 select_file_dialog_ = SelectFileDialog::Create( 588 select_file_dialog_ = ui::SelectFileDialog::Create(
589 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 589 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
590 select_file_dialog_->SelectFile( 590 select_file_dialog_->SelectFile(
591 SelectFileDialog::SELECT_SAVEAS_FILE, string16(), 591 ui::SelectFileDialog::SELECT_SAVEAS_FILE, string16(),
592 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), 592 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
593 GetParentWindow(), 593 GetParentWindow(),
594 reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED)); 594 reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED));
595 } 595 }
596 596
597 void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) { 597 void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) {
598 NOTIMPLEMENTED(); 598 NOTIMPLEMENTED();
599 } 599 }
600 600
601 void CertificateManagerHandler::ExportPersonalFileSelected( 601 void CertificateManagerHandler::ExportPersonalFileSelected(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 ImportExportCleanup(); 655 ImportExportCleanup();
656 if (write_errno) { 656 if (write_errno) {
657 ShowError( 657 ShowError(
658 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_EXPORT_ERROR_TITLE), 658 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_PKCS12_EXPORT_ERROR_TITLE),
659 l10n_util::GetStringFUTF8(IDS_CERT_MANAGER_WRITE_ERROR_FORMAT, 659 l10n_util::GetStringFUTF8(IDS_CERT_MANAGER_WRITE_ERROR_FORMAT,
660 UTF8ToUTF16(safe_strerror(write_errno)))); 660 UTF8ToUTF16(safe_strerror(write_errno))));
661 } 661 }
662 } 662 }
663 663
664 void CertificateManagerHandler::StartImportPersonal(const ListValue* args) { 664 void CertificateManagerHandler::StartImportPersonal(const ListValue* args) {
665 SelectFileDialog::FileTypeInfo file_type_info; 665 ui::SelectFileDialog::FileTypeInfo file_type_info;
666 if (!args->GetBoolean(0, &use_hardware_backed_)) { 666 if (!args->GetBoolean(0, &use_hardware_backed_)) {
667 // Unable to retrieve the hardware backed attribute from the args, 667 // Unable to retrieve the hardware backed attribute from the args,
668 // so bail. 668 // so bail.
669 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss"); 669 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
670 ImportExportCleanup(); 670 ImportExportCleanup();
671 return; 671 return;
672 } 672 }
673 file_type_info.extensions.resize(1); 673 file_type_info.extensions.resize(1);
674 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12")); 674 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12"));
675 file_type_info.extension_description_overrides.push_back( 675 file_type_info.extension_description_overrides.push_back(
676 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES)); 676 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES));
677 file_type_info.include_all_files = true; 677 file_type_info.include_all_files = true;
678 select_file_dialog_ = SelectFileDialog::Create( 678 select_file_dialog_ = ui::SelectFileDialog::Create(
679 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 679 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
680 select_file_dialog_->SelectFile( 680 select_file_dialog_->SelectFile(
681 SelectFileDialog::SELECT_OPEN_FILE, string16(), 681 ui::SelectFileDialog::SELECT_OPEN_FILE, string16(),
682 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), 682 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
683 GetParentWindow(), 683 GetParentWindow(),
684 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED)); 684 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED));
685 } 685 }
686 686
687 void CertificateManagerHandler::ImportPersonalFileSelected( 687 void CertificateManagerHandler::ImportPersonalFileSelected(
688 const FilePath& path) { 688 const FilePath& path) {
689 file_path_ = path; 689 file_path_ = path;
690 web_ui()->CallJavascriptFunction( 690 web_ui()->CallJavascriptFunction(
691 "CertificateManager.importPersonalAskPassword"); 691 "CertificateManager.importPersonalAskPassword");
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 module_ = NULL; 786 module_ = NULL;
787 787
788 // There may be pending file dialogs, we need to tell them that we've gone 788 // There may be pending file dialogs, we need to tell them that we've gone
789 // away so they don't try and call back to us. 789 // away so they don't try and call back to us.
790 if (select_file_dialog_.get()) 790 if (select_file_dialog_.get())
791 select_file_dialog_->ListenerDestroyed(); 791 select_file_dialog_->ListenerDestroyed();
792 select_file_dialog_ = NULL; 792 select_file_dialog_ = NULL;
793 } 793 }
794 794
795 void CertificateManagerHandler::ImportServer(const ListValue* args) { 795 void CertificateManagerHandler::ImportServer(const ListValue* args) {
796 select_file_dialog_ = SelectFileDialog::Create( 796 select_file_dialog_ = ui::SelectFileDialog::Create(
797 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 797 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
798 ShowCertSelectFileDialog( 798 ShowCertSelectFileDialog(
799 select_file_dialog_.get(), 799 select_file_dialog_.get(),
800 SelectFileDialog::SELECT_OPEN_FILE, 800 ui::SelectFileDialog::SELECT_OPEN_FILE,
801 FilePath(), 801 FilePath(),
802 GetParentWindow(), 802 GetParentWindow(),
803 reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED)); 803 reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED));
804 } 804 }
805 805
806 void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) { 806 void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) {
807 file_path_ = path; 807 file_path_ = path;
808 file_access_provider_->StartRead( 808 file_access_provider_->StartRead(
809 file_path_, 809 file_path_,
810 &consumer_, 810 &consumer_,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); 845 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
846 } else if (!not_imported.empty()) { 846 } else if (!not_imported.empty()) {
847 ShowImportErrors( 847 ShowImportErrors(
848 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), 848 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE),
849 not_imported); 849 not_imported);
850 } 850 }
851 ImportExportCleanup(); 851 ImportExportCleanup();
852 } 852 }
853 853
854 void CertificateManagerHandler::ImportCA(const ListValue* args) { 854 void CertificateManagerHandler::ImportCA(const ListValue* args) {
855 select_file_dialog_ = SelectFileDialog::Create( 855 select_file_dialog_ = ui::SelectFileDialog::Create(
856 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 856 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
857 ShowCertSelectFileDialog(select_file_dialog_.get(), 857 ShowCertSelectFileDialog(select_file_dialog_.get(),
858 SelectFileDialog::SELECT_OPEN_FILE, 858 ui::SelectFileDialog::SELECT_OPEN_FILE,
859 FilePath(), 859 FilePath(),
860 GetParentWindow(), 860 GetParentWindow(),
861 reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED)); 861 reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED));
862 } 862 }
863 863
864 void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) { 864 void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) {
865 file_path_ = path; 865 file_path_ = path;
866 file_access_provider_->StartRead( 866 file_access_provider_->StartRead(
867 file_path_, 867 file_path_,
868 &consumer_, 868 &consumer_,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", 1085 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
1086 ready); 1086 ready);
1087 } 1087 }
1088 #endif 1088 #endif
1089 1089
1090 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1090 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1091 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); 1091 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow();
1092 } 1092 }
1093 1093
1094 } // namespace options2 1094 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698