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

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

Issue 8741009: ONC import option to chromeos tab in chrome://net-internals (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review feedback Created 9 years 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_ui.cc
===================================================================
--- chrome/browser/ui/webui/net_internals_ui.cc (revision 112661)
+++ chrome/browser/ui/webui/net_internals_ui.cc (working copy)
@@ -66,6 +66,7 @@
#ifdef OS_CHROMEOS
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/system/syslogs_provider.h"
#endif
#ifdef OS_WIN
@@ -180,6 +181,7 @@
#ifdef OS_CHROMEOS
void OnRefreshSystemLogs(const ListValue* list);
void OnGetSystemLog(const ListValue* list);
+ void OnImportONCFile(const ListValue* list);
#endif
private:
@@ -560,6 +562,10 @@
"getSystemLog",
base::Bind(&NetInternalsMessageHandler::OnGetSystemLog,
base::Unretained(this)));
+ web_ui_->RegisterMessageCallback(
+ "importONCFile",
+ base::Bind(&NetInternalsMessageHandler::OnImportONCFile,
+ base::Unretained(this)));
#endif
}
@@ -1279,6 +1285,23 @@
DCHECK(syslogs_getter_.get());
syslogs_getter_->RequestSystemLog(list);
}
+
+void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) {
+ std::string onc_blob;
+ std::string passcode;
+ if (list->GetSize() != 2 ||
+ !list->GetString(0, &onc_blob) ||
+ !list->GetString(1, &passcode)) {
+ NOTREACHED();
+ return;
James Hawkins 2011/12/02 22:08:57 Don't handle NOTREACHEDs by returning. http://www
achuithb 2011/12/03 00:23:32 Done.
+ }
+
+ const bool success = chromeos::CrosLibrary::Get()->GetNetworkLibrary()->
+ LoadOncNetworks(onc_blob, passcode);
+ SendJavascriptCommand("receivedONCFileParse",
+ Value::CreateStringValue(success ? "ONC file successfully parsed" :
+ "ONC file parse failed"));
+}
#endif
void NetInternalsMessageHandler::IOThreadImpl::OnSetLogLevel(

Powered by Google App Engine
This is Rietveld 408576698