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

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

Issue 14192017: Extract certificate policy application from NetworkLibrary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
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 a850cbb5ee8129a21b846a3e6d3e090e856ad7e6..f396eb22623cef00402bd358758212bd33d809ee 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -78,7 +78,9 @@
#include "chrome/browser/chromeos/system/syslogs_provider.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/debug_daemon_client.h"
+#include "chromeos/network/certificate_handler.h"
#include "chromeos/network/onc/onc_constants.h"
+#include "chromeos/network/onc/onc_utils.h"
#endif
#if defined(OS_WIN)
#include "chrome/browser/net/service_providers_win.h"
@@ -1514,19 +1516,34 @@ void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) {
NOTREACHED();
}
+ chromeos::onc::ONCSource onc_source = chromeos::onc::ONC_SOURCE_USER_IMPORT;
+
+ scoped_ptr<base::ListValue> network_configs;
+ scoped_ptr<base::ListValue> certificates;
std::string error;
- chromeos::NetworkLibrary* cros_network =
- chromeos::CrosLibrary::Get()->GetNetworkLibrary();
- if (!cros_network->LoadOncNetworks(onc_blob, passcode,
- chromeos::onc::ONC_SOURCE_USER_IMPORT,
- NULL)) {
- error = "Errors occurred during the ONC import.";
+ if (!chromeos::onc::ParseAndValidateOncForImport(
+ onc_blob, onc_source, passcode, &network_configs, &certificates)) {
+ error = "Errors occurred during the ONC parsing.";
LOG(ERROR) << error;
}
- // Now that we've added the networks, we need to rescan them so they'll be
- // available from the menu more immediately.
- cros_network->RequestNetworkScan();
+ if (network_configs) {
+ chromeos::NetworkLibrary* network_library =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ network_library->LoadOncNetworks(*network_configs, onc_source);
+ // Now that we've added the networks, we need to rescan them so they'll be
+ // available from the menu more immediately.
+ network_library->RequestNetworkScan();
+ }
+
+ if (certificates) {
+ scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList);
+ if (!chromeos::CertificateHandler::Get()->ImportCertificates(
+ *certificates, onc_source, web_trust_certs.get())) {
+ error = "Some certificates couldn't be imported.";
+ LOG(ERROR) << error;
+ }
+ }
SendJavascriptCommand("receivedONCFileParse",
Value::CreateStringValue(error));

Powered by Google App Engine
This is Rietveld 408576698