| 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 caa8cbf4388eea16421e5ea4cc1f0fa44d98a8f2..621b78ad6e56e6b78936b766a7140c818d70738b 100644
|
| --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
|
| +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
|
| @@ -257,13 +257,6 @@
|
| 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(
|
| - const std::string& previous_error,
|
| - bool success,
|
| - const net::CertificateList& onc_trusted_certificates);
|
| #endif
|
|
|
| private:
|
| @@ -1414,52 +1407,38 @@
|
| const std::string& onc_blob,
|
| const std::string& passcode,
|
| net::NSSCertDatabase* nssdb) {
|
| + std::string error;
|
| 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;
|
| - }
|
| -
|
| - std::string error;
|
| - onc::ONCSource onc_source = onc::ONC_SOURCE_USER_IMPORT;
|
| - base::ListValue network_configs;
|
| - base::DictionaryValue global_network_config;
|
| - base::ListValue certificates;
|
| - if (!chromeos::onc::ParseAndValidateOncForImport(onc_blob,
|
| - onc_source,
|
| - passcode,
|
| - &network_configs,
|
| - &global_network_config,
|
| - &certificates)) {
|
| - error = "Errors occurred during the ONC parsing. ";
|
| - }
|
| -
|
| - std::string network_error;
|
| - chromeos::onc::ImportNetworksForUser(user, network_configs, &network_error);
|
| - if (!network_error.empty())
|
| - error += network_error;
|
| -
|
| - chromeos::onc::CertificateImporterImpl cert_importer(
|
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), nssdb);
|
| - cert_importer.ImportCertificates(
|
| - certificates,
|
| - onc_source,
|
| - base::Bind(&NetInternalsMessageHandler::OnCertificatesImported,
|
| - AsWeakPtr(),
|
| - error));
|
| -}
|
| -
|
| -void NetInternalsMessageHandler::OnCertificatesImported(
|
| - const std::string& previous_error,
|
| - bool success,
|
| - const net::CertificateList& /* unused onc_trusted_certificates */) {
|
| - std::string error = previous_error;
|
| - if (!success)
|
| - error += "Some certificates couldn't be imported. ";
|
| -
|
| + if (user) {
|
| + onc::ONCSource onc_source = onc::ONC_SOURCE_USER_IMPORT;
|
| +
|
| + base::ListValue network_configs;
|
| + base::DictionaryValue global_network_config;
|
| + base::ListValue certificates;
|
| + if (!chromeos::onc::ParseAndValidateOncForImport(onc_blob,
|
| + onc_source,
|
| + passcode,
|
| + &network_configs,
|
| + &global_network_config,
|
| + &certificates)) {
|
| + error = "Errors occurred during the ONC parsing. ";
|
| + }
|
| +
|
| + chromeos::onc::CertificateImporterImpl cert_importer(nssdb);
|
| + if (!cert_importer.ImportCertificates(certificates, onc_source, NULL))
|
| + error += "Some certificates couldn't be imported. ";
|
| +
|
| + std::string network_error;
|
| + chromeos::onc::ImportNetworksForUser(user, network_configs, &network_error);
|
| + if (!network_error.empty())
|
| + error += network_error;
|
| + } else {
|
| + error = "User not found.";
|
| + }
|
| +
|
| + LOG_IF(ERROR, !error.empty()) << error;
|
| SendJavascriptCommand("receivedONCFileParse", new base::StringValue(error));
|
| }
|
|
|
|
|