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

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

Issue 1509673004: Adding support for specifying user-cert filename from URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « chrome/browser/resources/options/certificate_manager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/options/certificate_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 void CertificateManagerHandler::StartImportPersonal( 702 void CertificateManagerHandler::StartImportPersonal(
703 const base::ListValue* args) { 703 const base::ListValue* args) {
704 ui::SelectFileDialog::FileTypeInfo file_type_info; 704 ui::SelectFileDialog::FileTypeInfo file_type_info;
705 if (!args->GetBoolean(0, &use_hardware_backed_)) { 705 if (!args->GetBoolean(0, &use_hardware_backed_)) {
706 // Unable to retrieve the hardware backed attribute from the args, 706 // Unable to retrieve the hardware backed attribute from the args,
707 // so bail. 707 // so bail.
708 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss"); 708 web_ui()->CallJavascriptFunction("CertificateRestoreOverlay.dismiss");
709 ImportExportCleanup(); 709 ImportExportCleanup();
710 return; 710 return;
711 } 711 }
712 base::FilePath default_path;
713 base::string16 path_string;
714 if (args->GetString(1, &path_string))
715 default_path = base::FilePath::FromUTF16Unsafe(path_string);
712 file_type_info.extensions.resize(1); 716 file_type_info.extensions.resize(1);
713 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12")); 717 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("p12"));
714 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("crt")); 718 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("crt"));
715 file_type_info.extension_description_overrides.push_back( 719 file_type_info.extension_description_overrides.push_back(
716 l10n_util::GetStringUTF16(IDS_CERT_USAGE_SSL_CLIENT)); 720 l10n_util::GetStringUTF16(IDS_CERT_USAGE_SSL_CLIENT));
717 file_type_info.include_all_files = true; 721 file_type_info.include_all_files = true;
718 select_file_dialog_ = ui::SelectFileDialog::Create( 722 select_file_dialog_ = ui::SelectFileDialog::Create(
719 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 723 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
720 select_file_dialog_->SelectFile( 724 select_file_dialog_->SelectFile(
721 ui::SelectFileDialog::SELECT_OPEN_FILE, base::string16(), 725 ui::SelectFileDialog::SELECT_OPEN_FILE, base::string16(),
722 base::FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), 726 default_path, &file_type_info, 1, FILE_PATH_LITERAL("p12"),
723 GetParentWindow(), 727 GetParentWindow(),
724 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED)); 728 reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED));
725 } 729 }
726 730
727 void CertificateManagerHandler::ImportPersonalFileSelected( 731 void CertificateManagerHandler::ImportPersonalFileSelected(
728 const base::FilePath& path) { 732 const base::FilePath& path) {
729 file_path_ = path; 733 file_path_ = path;
730 if (file_path_.MatchesExtension(FILE_PATH_LITERAL(".p12"))) { 734 if (file_path_.MatchesExtension(FILE_PATH_LITERAL(".p12"))) {
731 web_ui()->CallJavascriptFunction( 735 web_ui()->CallJavascriptFunction(
732 "CertificateManager.importPersonalAskPassword"); 736 "CertificateManager.importPersonalAskPassword");
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 title_value, 1198 title_value,
1195 error_value, 1199 error_value,
1196 cert_error_list); 1200 cert_error_list);
1197 } 1201 }
1198 1202
1199 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1203 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1200 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1204 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1201 } 1205 }
1202 1206
1203 } // namespace options 1207 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/certificate_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698