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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_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 (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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR)); 1004 l10n_util::GetStringUTF8(IDS_CERT_MANAGER_CERT_PARSE_ERROR));
1005 return; 1005 return;
1006 } 1006 }
1007 1007
1008 scoped_refptr<net::X509Certificate> root_cert = 1008 scoped_refptr<net::X509Certificate> root_cert =
1009 certificate_manager_model_->cert_db()->FindRootInList( 1009 certificate_manager_model_->cert_db()->FindRootInList(
1010 selected_cert_list_); 1010 selected_cert_list_);
1011 1011
1012 // TODO(mattm): check here if root_cert is not a CA cert and show error. 1012 // TODO(mattm): check here if root_cert is not a CA cert and show error.
1013 1013
1014 base::StringValue cert_name(root_cert->subject().GetDisplayName()); 1014 base::Value cert_name(root_cert->subject().GetDisplayName());
1015 web_ui()->CallJavascriptFunctionUnsafe( 1015 web_ui()->CallJavascriptFunctionUnsafe(
1016 "CertificateEditCaTrustOverlay.showImport", cert_name); 1016 "CertificateEditCaTrustOverlay.showImport", cert_name);
1017 } 1017 }
1018 1018
1019 void CertificateManagerHandler::ImportCATrustSelected( 1019 void CertificateManagerHandler::ImportCATrustSelected(
1020 const base::ListValue* args) { 1020 const base::ListValue* args) {
1021 bool fail = false; 1021 bool fail = false;
1022 bool trust_ssl = false; 1022 bool trust_ssl = false;
1023 bool trust_email = false; 1023 bool trust_email = false;
1024 bool trust_obj_sign = false; 1024 bool trust_obj_sign = false;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 base::ListValue args; 1184 base::ListValue args;
1185 args.AppendString(tree_name); 1185 args.AppendString(tree_name);
1186 args.Append(std::move(nodes)); 1186 args.Append(std::move(nodes));
1187 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree", 1187 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree",
1188 args); 1188 args);
1189 } 1189 }
1190 } 1190 }
1191 1191
1192 void CertificateManagerHandler::ShowError(const std::string& title, 1192 void CertificateManagerHandler::ShowError(const std::string& title,
1193 const std::string& error) const { 1193 const std::string& error) const {
1194 auto title_value = base::MakeUnique<base::StringValue>(title); 1194 auto title_value = base::MakeUnique<base::Value>(title);
1195 auto error_value = base::MakeUnique<base::StringValue>(error); 1195 auto error_value = base::MakeUnique<base::Value>(error);
1196 auto ok_title_value = 1196 auto ok_title_value =
1197 base::MakeUnique<base::StringValue>(l10n_util::GetStringUTF8(IDS_OK)); 1197 base::MakeUnique<base::Value>(l10n_util::GetStringUTF8(IDS_OK));
1198 auto cancel_title_value = base::Value::CreateNullValue(); 1198 auto cancel_title_value = base::Value::CreateNullValue();
1199 auto ok_callback_value = base::Value::CreateNullValue(); 1199 auto ok_callback_value = base::Value::CreateNullValue();
1200 auto cancel_callback_value = base::Value::CreateNullValue(); 1200 auto cancel_callback_value = base::Value::CreateNullValue();
1201 std::vector<const base::Value*> args = { 1201 std::vector<const base::Value*> args = {
1202 title_value.get(), error_value.get(), 1202 title_value.get(), error_value.get(),
1203 ok_title_value.get(), cancel_title_value.get(), 1203 ok_title_value.get(), cancel_title_value.get(),
1204 ok_callback_value.get(), cancel_callback_value.get()}; 1204 ok_callback_value.get(), cancel_callback_value.get()};
1205 web_ui()->CallJavascriptFunctionUnsafe("AlertOverlay.show", args); 1205 web_ui()->CallJavascriptFunctionUnsafe("AlertOverlay.show", args);
1206 } 1206 }
1207 1207
(...skipping 11 matching lines...) Expand all
1219 1219
1220 base::ListValue cert_error_list; 1220 base::ListValue cert_error_list;
1221 for (size_t i = 0; i < not_imported.size(); ++i) { 1221 for (size_t i = 0; i < not_imported.size(); ++i) {
1222 const net::NSSCertDatabase::ImportCertFailure& failure = not_imported[i]; 1222 const net::NSSCertDatabase::ImportCertFailure& failure = not_imported[i];
1223 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 1223 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
1224 dict->SetString(kNameId, failure.certificate->subject().GetDisplayName()); 1224 dict->SetString(kNameId, failure.certificate->subject().GetDisplayName());
1225 dict->SetString(kErrorId, NetErrorToString(failure.net_error)); 1225 dict->SetString(kErrorId, NetErrorToString(failure.net_error));
1226 cert_error_list.Append(std::move(dict)); 1226 cert_error_list.Append(std::move(dict));
1227 } 1227 }
1228 1228
1229 base::StringValue title_value(title); 1229 base::Value title_value(title);
1230 base::StringValue error_value(error); 1230 base::Value error_value(error);
1231 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", 1231 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show",
1232 title_value, error_value, 1232 title_value, error_value,
1233 cert_error_list); 1233 cert_error_list);
1234 } 1234 }
1235 1235
1236 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1236 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1237 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1237 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1238 } 1238 }
1239 1239
1240 } // namespace options 1240 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698