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

Side by Side Diff: chrome/browser/ui/webui/settings/certificates_handler.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/certificates_handler.h" 5 #include "chrome/browser/ui/webui/settings/certificates_handler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 IDS_SETTINGS_CERTIFICATE_MANAGER_CERT_PARSE_ERROR)); 899 IDS_SETTINGS_CERTIFICATE_MANAGER_CERT_PARSE_ERROR));
900 return; 900 return;
901 } 901 }
902 902
903 scoped_refptr<net::X509Certificate> root_cert = 903 scoped_refptr<net::X509Certificate> root_cert =
904 certificate_manager_model_->cert_db()->FindRootInList( 904 certificate_manager_model_->cert_db()->FindRootInList(
905 selected_cert_list_); 905 selected_cert_list_);
906 906
907 // TODO(mattm): check here if root_cert is not a CA cert and show error. 907 // TODO(mattm): check here if root_cert is not a CA cert and show error.
908 908
909 base::StringValue cert_name(root_cert->subject().GetDisplayName()); 909 base::Value cert_name(root_cert->subject().GetDisplayName());
910 ResolveCallback(cert_name); 910 ResolveCallback(cert_name);
911 } 911 }
912 912
913 void CertificatesHandler::HandleImportCATrustSelected( 913 void CertificatesHandler::HandleImportCATrustSelected(
914 const base::ListValue* args) { 914 const base::ListValue* args) {
915 CHECK_EQ(4U, args->GetSize()); 915 CHECK_EQ(4U, args->GetSize());
916 AssignWebUICallbackId(args); 916 AssignWebUICallbackId(args);
917 917
918 bool trust_ssl = false; 918 bool trust_ssl = false;
919 bool trust_email = false; 919 bool trust_email = false;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 certificate_manager_model_ = std::move(model); 982 certificate_manager_model_ = std::move(model);
983 CertificateManagerModelReady(); 983 CertificateManagerModelReady();
984 } 984 }
985 985
986 void CertificatesHandler::CertificateManagerModelReady() { 986 void CertificatesHandler::CertificateManagerModelReady() {
987 base::Value user_db_available_value( 987 base::Value user_db_available_value(
988 certificate_manager_model_->is_user_db_available()); 988 certificate_manager_model_->is_user_db_available());
989 base::Value tpm_available_value( 989 base::Value tpm_available_value(
990 certificate_manager_model_->is_tpm_available()); 990 certificate_manager_model_->is_tpm_available());
991 CallJavascriptFunction("cr.webUIListenerCallback", 991 CallJavascriptFunction("cr.webUIListenerCallback",
992 base::StringValue("certificates-model-ready"), 992 base::Value("certificates-model-ready"),
993 user_db_available_value, tpm_available_value); 993 user_db_available_value, tpm_available_value);
994 certificate_manager_model_->Refresh(); 994 certificate_manager_model_->Refresh();
995 } 995 }
996 996
997 void CertificatesHandler::HandleRefreshCertificates( 997 void CertificatesHandler::HandleRefreshCertificates(
998 const base::ListValue* args) { 998 const base::ListValue* args) {
999 AllowJavascript(); 999 AllowJavascript();
1000 1000
1001 if (certificate_manager_model_) { 1001 if (certificate_manager_model_) {
1002 // Already have a model, the webui must be re-loading. Just re-run the 1002 // Already have a model, the webui must be re-loading. Just re-run the
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 subnodes->Append(std::move(cert_dict)); 1076 subnodes->Append(std::move(cert_dict));
1077 } 1077 }
1078 std::sort(subnodes->begin(), subnodes->end(), comparator); 1078 std::sort(subnodes->begin(), subnodes->end(), comparator);
1079 1079
1080 dict->Set(kSubnodesField, subnodes); 1080 dict->Set(kSubnodesField, subnodes);
1081 nodes->Append(std::move(dict)); 1081 nodes->Append(std::move(dict));
1082 } 1082 }
1083 std::sort(nodes->begin(), nodes->end(), comparator); 1083 std::sort(nodes->begin(), nodes->end(), comparator);
1084 1084
1085 CallJavascriptFunction("cr.webUIListenerCallback", 1085 CallJavascriptFunction("cr.webUIListenerCallback",
1086 base::StringValue("certificates-changed"), 1086 base::Value("certificates-changed"),
1087 base::StringValue(tab_name), *nodes); 1087 base::Value(tab_name), *nodes);
1088 } 1088 }
1089 } 1089 }
1090 1090
1091 void CertificatesHandler::ResolveCallback(const base::Value& response) { 1091 void CertificatesHandler::ResolveCallback(const base::Value& response) {
1092 DCHECK(!webui_callback_id_.empty()); 1092 DCHECK(!webui_callback_id_.empty());
1093 ResolveJavascriptCallback(base::StringValue(webui_callback_id_), response); 1093 ResolveJavascriptCallback(base::Value(webui_callback_id_), response);
1094 webui_callback_id_.clear(); 1094 webui_callback_id_.clear();
1095 } 1095 }
1096 1096
1097 void CertificatesHandler::RejectCallback(const base::Value& response) { 1097 void CertificatesHandler::RejectCallback(const base::Value& response) {
1098 DCHECK(!webui_callback_id_.empty()); 1098 DCHECK(!webui_callback_id_.empty());
1099 RejectJavascriptCallback(base::StringValue(webui_callback_id_), response); 1099 RejectJavascriptCallback(base::Value(webui_callback_id_), response);
1100 webui_callback_id_.clear(); 1100 webui_callback_id_.clear();
1101 } 1101 }
1102 1102
1103 void CertificatesHandler::RejectCallbackWithError(const std::string& title, 1103 void CertificatesHandler::RejectCallbackWithError(const std::string& title,
1104 const std::string& error) { 1104 const std::string& error) {
1105 std::unique_ptr<base::DictionaryValue> error_info(new base::DictionaryValue); 1105 std::unique_ptr<base::DictionaryValue> error_info(new base::DictionaryValue);
1106 error_info->SetString(kErrorTitle, title); 1106 error_info->SetString(kErrorTitle, title);
1107 error_info->SetString(kErrorDescription, error); 1107 error_info->SetString(kErrorDescription, error);
1108 RejectCallback(*error_info); 1108 RejectCallback(*error_info);
1109 } 1109 }
(...skipping 29 matching lines...) Expand all
1139 error_info->Set(kCertificateErrors, 1139 error_info->Set(kCertificateErrors,
1140 base::WrapUnique(cert_error_list.release())); 1140 base::WrapUnique(cert_error_list.release()));
1141 RejectCallback(*error_info); 1141 RejectCallback(*error_info);
1142 } 1142 }
1143 1143
1144 gfx::NativeWindow CertificatesHandler::GetParentWindow() const { 1144 gfx::NativeWindow CertificatesHandler::GetParentWindow() const {
1145 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1145 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1146 } 1146 }
1147 1147
1148 } // namespace settings 1148 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/about_handler.cc ('k') | chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698