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

Unified Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Flattened components/cert_database folders. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/crypto_module_delegate_nss.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/net_internals/net_internals_ui.cc
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index 09e64c33aa790f856cb36e17188b8e77aadea47e..bd7894369e2b732fa70f4b68a7699a455cb82ed7 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -76,11 +76,12 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/system/syslogs_provider.h"
#include "chrome/browser/chromeos/system_logs/debug_log_writer.h"
-#include "chrome/browser/net/nss_context.h"
+#include "chrome/browser/net/cert_database_service_factory.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
#include "chromeos/network/onc/onc_certificate_importer_impl.h"
#include "chromeos/network/onc/onc_utils.h"
+#include "components/cert_database/cert_database_service.h"
#include "components/user_manager/user.h"
#endif
@@ -238,13 +239,6 @@ class NetInternalsMessageHandler
void OnSetNetworkDebugModeCompleted(const std::string& subsystem,
bool succeeded);
- // Callback to |GetNSSCertDatabaseForProfile| used to retrieve the database
- // to which user's ONC defined certificates should be imported.
- // It parses and imports |onc_blob|.
- void ImportONCFileToNSSDB(const std::string& onc_blob,
- const std::string& passcode,
- net::NSSCertDatabase* nssdb);
-
// Called back by the CertificateImporter when a certificate import finished.
// |previous_error| contains earlier errors during this import.
void OnCertificatesImported(
@@ -1163,19 +1157,31 @@ void NetInternalsMessageHandler::OnGetSystemLog(
syslogs_getter_->RequestSystemLog(list);
}
-void NetInternalsMessageHandler::ImportONCFileToNSSDB(
- const std::string& onc_blob,
- const std::string& passcode,
- net::NSSCertDatabase* nssdb) {
+void NetInternalsMessageHandler::OnImportONCFile(const base::ListValue* list) {
+ std::string onc_blob;
+ std::string passcode;
+ if (list->GetSize() != 2 || !list->GetString(0, &onc_blob) ||
+ !list->GetString(1, &passcode)) {
+ NOTREACHED();
+ }
+
user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile(
Profile::FromWebUI(web_ui()));
-
if (!user) {
std::string error = "User not found.";
SendJavascriptCommand("receivedONCFileParse", new base::StringValue(error));
return;
}
+ cert_database::CertDatabaseService* cert_service =
+ cert_database::CertDatabaseServiceFactory::GetForBrowserContext(
+ web_ui()->GetWebContents()->GetBrowserContext());
+ if (!cert_service) {
+ std::string error = "Certificate database not available.";
+ SendJavascriptCommand("receivedONCFileParse", new base::StringValue(error));
+ return;
+ }
+
std::string error;
onc::ONCSource onc_source = onc::ONC_SOURCE_USER_IMPORT;
base::ListValue network_configs;
@@ -1196,7 +1202,8 @@ void NetInternalsMessageHandler::ImportONCFileToNSSDB(
error += network_error;
chromeos::onc::CertificateImporterImpl cert_importer(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), nssdb);
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
+ cert_service->GetIOPart());
cert_importer.ImportCertificates(
certificates,
onc_source,
@@ -1216,22 +1223,6 @@ void NetInternalsMessageHandler::OnCertificatesImported(
SendJavascriptCommand("receivedONCFileParse", new base::StringValue(error));
}
-void NetInternalsMessageHandler::OnImportONCFile(
- const base::ListValue* list) {
- std::string onc_blob;
- std::string passcode;
- if (list->GetSize() != 2 ||
- !list->GetString(0, &onc_blob) ||
- !list->GetString(1, &passcode)) {
- NOTREACHED();
- }
-
- GetNSSCertDatabaseForProfile(
- Profile::FromWebUI(web_ui()),
- base::Bind(&NetInternalsMessageHandler::ImportONCFileToNSSDB, AsWeakPtr(),
- onc_blob, passcode));
-}
-
void NetInternalsMessageHandler::OnStoreDebugLogs(const base::ListValue* list) {
DCHECK(list);
« no previous file with comments | « chrome/browser/ui/crypto_module_delegate_nss.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698