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

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: Rebased. 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
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/chrome_browser_chromeos.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 39fb7d5dad18410a2286b9c0ed45197bfc7cd79d..c752508d2a91a078ee7236a77f6271e1b6178f4a 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"
@@ -1508,19 +1510,29 @@ void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) {
NOTREACHED();
}
+ chromeos::onc::ONCSource onc_source = chromeos::onc::ONC_SOURCE_USER_IMPORT;
+
+ base::ListValue network_configs;
+ 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;
}
+ 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.
- cros_network->RequestNetworkScan();
+ network_library->RequestNetworkScan();
+
+ chromeos::CertificateHandler certificate_handler;
+ if (!certificate_handler.ImportCertificates(certificates, onc_source, NULL)) {
+ error += "Some certificates couldn't be imported.";
+ LOG(ERROR) << error;
+ }
SendJavascriptCommand("receivedONCFileParse",
Value::CreateStringValue(error));
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698