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

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

Issue 10698053: Breaks compile on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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_handler2.h" 5 #include "chrome/browser/ui/webui/options2/certificate_manager_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" // for FileAccessProvider 9 #include "base/file_util.h" // for FileAccessProvider
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/safe_strerror_posix.h" 11 #include "base/safe_strerror_posix.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/certificate_viewer.h" 15 #include "chrome/browser/certificate_viewer.h"
16 #include "chrome/browser/ui/certificate_dialogs.h" 16 #include "chrome/browser/ui/certificate_dialogs.h"
17 #include "chrome/browser/ui/chrome_select_file_policy.h"
18 #include "chrome/browser/ui/crypto_module_password_dialog.h" 17 #include "chrome/browser/ui/crypto_module_password_dialog.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_contents_view.h" 20 #include "content/public/browser/web_contents_view.h"
22 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
23 #include "net/base/crypto_module.h" 22 #include "net/base/crypto_module.h"
24 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
25 #include "net/base/x509_certificate.h" 24 #include "net/base/x509_certificate.h"
26 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/l10n/l10n_util_collator.h" 26 #include "ui/base/l10n/l10n_util_collator.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 return; 556 return;
558 557
559 selected_cert_list_.push_back(cert); 558 selected_cert_list_.push_back(cert);
560 559
561 SelectFileDialog::FileTypeInfo file_type_info; 560 SelectFileDialog::FileTypeInfo file_type_info;
562 file_type_info.extensions.resize(1); 561 file_type_info.extensions.resize(1);
563 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12")); 562 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12"));
564 file_type_info.extension_description_overrides.push_back( 563 file_type_info.extension_description_overrides.push_back(
565 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES)); 564 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES));
566 file_type_info.include_all_files = true; 565 file_type_info.include_all_files = true;
567 select_file_dialog_ = SelectFileDialog::Create( 566 select_file_dialog_ = SelectFileDialog::Create(this);
568 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
569 select_file_dialog_->SelectFile( 567 select_file_dialog_->SelectFile(
570 SelectFileDialog::SELECT_SAVEAS_FILE, string16(), 568 SelectFileDialog::SELECT_SAVEAS_FILE, string16(),
571 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), 569 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
572 GetParentWindow(), 570 web_ui()->GetWebContents(), GetParentWindow(),
573 reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED)); 571 reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED));
574 } 572 }
575 573
576 void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) { 574 void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) {
577 NOTIMPLEMENTED(); 575 NOTIMPLEMENTED();
578 } 576 }
579 577
580 void CertificateManagerHandler::ExportPersonalFileSelected( 578 void CertificateManagerHandler::ExportPersonalFileSelected(
581 const FilePath& path) { 579 const FilePath& path) {
582 file_path_ = path; 580 file_path_ = path;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // so bail. 645 // so bail.
648 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss"); 646 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
649 ImportExportCleanup(); 647 ImportExportCleanup();
650 return; 648 return;
651 } 649 }
652 file_type_info.extensions.resize(1); 650 file_type_info.extensions.resize(1);
653 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12")); 651 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12"));
654 file_type_info.extension_description_overrides.push_back( 652 file_type_info.extension_description_overrides.push_back(
655 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES)); 653 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_PKCS12_FILES));
656 file_type_info.include_all_files = true; 654 file_type_info.include_all_files = true;
657 select_file_dialog_ = SelectFileDialog::Create( 655 select_file_dialog_ = SelectFileDialog::Create(this);
658 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
659 select_file_dialog_->SelectFile( 656 select_file_dialog_->SelectFile(
660 SelectFileDialog::SELECT_OPEN_FILE, string16(), 657 SelectFileDialog::SELECT_OPEN_FILE, string16(),
661 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), 658 FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"),
662 GetParentWindow(), 659 web_ui()->GetWebContents(), GetParentWindow(),
663 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED)); 660 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED));
664 } 661 }
665 662
666 void CertificateManagerHandler::ImportPersonalFileSelected( 663 void CertificateManagerHandler::ImportPersonalFileSelected(
667 const FilePath& path) { 664 const FilePath& path) {
668 file_path_ = path; 665 file_path_ = path;
669 web_ui()->CallJavascriptFunction( 666 web_ui()->CallJavascriptFunction(
670 "CertificateManager.importPersonalAskPassword"); 667 "CertificateManager.importPersonalAskPassword");
671 } 668 }
672 669
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 module_ = NULL; 762 module_ = NULL;
766 763
767 // There may be pending file dialogs, we need to tell them that we've gone 764 // There may be pending file dialogs, we need to tell them that we've gone
768 // away so they don't try and call back to us. 765 // away so they don't try and call back to us.
769 if (select_file_dialog_.get()) 766 if (select_file_dialog_.get())
770 select_file_dialog_->ListenerDestroyed(); 767 select_file_dialog_->ListenerDestroyed();
771 select_file_dialog_ = NULL; 768 select_file_dialog_ = NULL;
772 } 769 }
773 770
774 void CertificateManagerHandler::ImportServer(const ListValue* args) { 771 void CertificateManagerHandler::ImportServer(const ListValue* args) {
775 select_file_dialog_ = SelectFileDialog::Create( 772 select_file_dialog_ = SelectFileDialog::Create(this);
776 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
777 ShowCertSelectFileDialog( 773 ShowCertSelectFileDialog(
778 select_file_dialog_.get(), 774 select_file_dialog_.get(),
779 SelectFileDialog::SELECT_OPEN_FILE, 775 SelectFileDialog::SELECT_OPEN_FILE,
780 FilePath(), 776 FilePath(),
777 web_ui()->GetWebContents(),
781 GetParentWindow(), 778 GetParentWindow(),
782 reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED)); 779 reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED));
783 } 780 }
784 781
785 void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) { 782 void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) {
786 file_path_ = path; 783 file_path_ = path;
787 file_access_provider_->StartRead( 784 file_access_provider_->StartRead(
788 file_path_, 785 file_path_,
789 &consumer_, 786 &consumer_,
790 base::Bind(&CertificateManagerHandler::ImportServerFileRead, 787 base::Bind(&CertificateManagerHandler::ImportServerFileRead,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR)); 821 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_UNKNOWN_ERROR));
825 } else if (!not_imported.empty()) { 822 } else if (!not_imported.empty()) {
826 ShowImportErrors( 823 ShowImportErrors(
827 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE), 824 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_SERVER_IMPORT_ERROR_TITLE),
828 not_imported); 825 not_imported);
829 } 826 }
830 ImportExportCleanup(); 827 ImportExportCleanup();
831 } 828 }
832 829
833 void CertificateManagerHandler::ImportCA(const ListValue* args) { 830 void CertificateManagerHandler::ImportCA(const ListValue* args) {
834 select_file_dialog_ = SelectFileDialog::Create( 831 select_file_dialog_ = SelectFileDialog::Create(this);
835 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
836 ShowCertSelectFileDialog(select_file_dialog_.get(), 832 ShowCertSelectFileDialog(select_file_dialog_.get(),
837 SelectFileDialog::SELECT_OPEN_FILE, 833 SelectFileDialog::SELECT_OPEN_FILE,
838 FilePath(), 834 FilePath(),
835 web_ui()->GetWebContents(),
839 GetParentWindow(), 836 GetParentWindow(),
840 reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED)); 837 reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED));
841 } 838 }
842 839
843 void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) { 840 void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) {
844 file_path_ = path; 841 file_path_ = path;
845 file_access_provider_->StartRead( 842 file_access_provider_->StartRead(
846 file_path_, 843 file_path_,
847 &consumer_, 844 &consumer_,
848 base::Bind(&CertificateManagerHandler::ImportCAFileRead, 845 base::Bind(&CertificateManagerHandler::ImportCAFileRead,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", 1061 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
1065 ready); 1062 ready);
1066 } 1063 }
1067 #endif 1064 #endif
1068 1065
1069 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1066 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1070 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); 1067 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow();
1071 } 1068 }
1072 1069
1073 } // namespace options2 1070 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698