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

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

Issue 2606293002: Remove ScopedVector from chrome/browser/ui. (Closed)
Patch Set: one last fix Created 3 years, 11 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
11 #include <algorithm> 11 #include <algorithm>
12 #include <map> 12 #include <map>
13 #include <utility> 13 #include <utility>
14 #include <vector>
14 15
15 #include "base/bind.h" 16 #include "base/bind.h"
16 #include "base/bind_helpers.h" 17 #include "base/bind_helpers.h"
17 #include "base/files/file_util.h" // for FileAccessProvider 18 #include "base/files/file_util.h" // for FileAccessProvider
18 #include "base/i18n/string_compare.h" 19 #include "base/i18n/string_compare.h"
19 #include "base/id_map.h" 20 #include "base/id_map.h"
20 #include "base/macros.h" 21 #include "base/macros.h"
21 #include "base/memory/scoped_vector.h" 22 #include "base/memory/ptr_util.h"
22 #include "base/posix/safe_strerror.h" 23 #include "base/posix/safe_strerror.h"
23 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
25 #include "base/values.h" 26 #include "base/values.h"
26 #include "build/build_config.h" 27 #include "build/build_config.h"
27 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/certificate_viewer.h" 29 #include "chrome/browser/certificate_viewer.h"
29 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/ui/certificate_dialogs.h" 31 #include "chrome/browser/ui/certificate_dialogs.h"
31 #include "chrome/browser/ui/chrome_select_file_policy.h" 32 #include "chrome/browser/ui/chrome_select_file_policy.h"
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 base::ListValue args; 1186 base::ListValue args;
1186 args.AppendString(tree_name); 1187 args.AppendString(tree_name);
1187 args.Append(std::move(nodes)); 1188 args.Append(std::move(nodes));
1188 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree", 1189 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onPopulateTree",
1189 args); 1190 args);
1190 } 1191 }
1191 } 1192 }
1192 1193
1193 void CertificateManagerHandler::ShowError(const std::string& title, 1194 void CertificateManagerHandler::ShowError(const std::string& title,
1194 const std::string& error) const { 1195 const std::string& error) const {
1195 ScopedVector<const base::Value> args; 1196 auto title_value = base::MakeUnique<base::StringValue>(title);
1196 args.push_back(new base::StringValue(title)); 1197 auto error_value = base::MakeUnique<base::StringValue>(error);
1197 args.push_back(new base::StringValue(error)); 1198 auto ok_title_value =
1198 args.push_back(new base::StringValue(l10n_util::GetStringUTF8(IDS_OK))); 1199 base::MakeUnique<base::StringValue>(l10n_util::GetStringUTF8(IDS_OK));
1199 args.push_back(base::Value::CreateNullValue().release()); // cancelTitle 1200 auto cancel_title_value = base::Value::CreateNullValue();
1200 args.push_back(base::Value::CreateNullValue().release()); // okCallback 1201 auto ok_callback_value = base::Value::CreateNullValue();
1201 args.push_back(base::Value::CreateNullValue().release()); // cancelCallback 1202 auto cancel_callback_value = base::Value::CreateNullValue();
1202 web_ui()->CallJavascriptFunctionUnsafe("AlertOverlay.show", args.get()); 1203 std::vector<const base::Value*> args = {
1204 title_value.get(), error_value.get(),
1205 ok_title_value.get(), cancel_title_value.get(),
1206 ok_callback_value.get(), cancel_callback_value.get()};
stevenjb 2017/01/04 17:56:15 This all seems awkward. Would it make sense to add
Avi (use Gerrit) 2017/01/04 18:44:39 We can't overload just the ListValue, as calling a
1207 web_ui()->CallJavascriptFunctionUnsafe("AlertOverlay.show", args);
1203 } 1208 }
1204 1209
1205 void CertificateManagerHandler::ShowImportErrors( 1210 void CertificateManagerHandler::ShowImportErrors(
1206 const std::string& title, 1211 const std::string& title,
1207 const net::NSSCertDatabase::ImportCertFailureList& not_imported) const { 1212 const net::NSSCertDatabase::ImportCertFailureList& not_imported) const {
1208 std::string error; 1213 std::string error;
1209 if (selected_cert_list_.size() == 1) 1214 if (selected_cert_list_.size() == 1)
1210 error = l10n_util::GetStringUTF8( 1215 error = l10n_util::GetStringUTF8(
1211 IDS_CERT_MANAGER_IMPORT_SINGLE_NOT_IMPORTED); 1216 IDS_CERT_MANAGER_IMPORT_SINGLE_NOT_IMPORTED);
1212 else if (not_imported.size() == selected_cert_list_.size()) 1217 else if (not_imported.size() == selected_cert_list_.size())
(...skipping 15 matching lines...) Expand all
1228 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", 1233 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show",
1229 title_value, error_value, 1234 title_value, error_value,
1230 cert_error_list); 1235 cert_error_list);
1231 } 1236 }
1232 1237
1233 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1238 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1234 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); 1239 return web_ui()->GetWebContents()->GetTopLevelNativeWindow();
1235 } 1240 }
1236 1241
1237 } // namespace options 1242 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698