OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 | 1288 |
1289 void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) { | 1289 void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) { |
1290 std::string onc_blob; | 1290 std::string onc_blob; |
1291 std::string passcode; | 1291 std::string passcode; |
1292 if (list->GetSize() != 2 || | 1292 if (list->GetSize() != 2 || |
1293 !list->GetString(0, &onc_blob) || | 1293 !list->GetString(0, &onc_blob) || |
1294 !list->GetString(1, &passcode)) { | 1294 !list->GetString(1, &passcode)) { |
1295 NOTREACHED(); | 1295 NOTREACHED(); |
1296 } | 1296 } |
1297 | 1297 |
1298 std::string error; | 1298 const bool success = chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> |
1299 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | 1299 LoadOncNetworks(onc_blob, passcode); |
1300 LoadOncNetworks(onc_blob, passcode, &error); | |
1301 SendJavascriptCommand("receivedONCFileParse", | 1300 SendJavascriptCommand("receivedONCFileParse", |
1302 Value::CreateStringValue(error)); | 1301 Value::CreateBooleanValue(success)); |
1303 } | 1302 } |
1304 #endif | 1303 #endif |
1305 | 1304 |
1306 void NetInternalsMessageHandler::IOThreadImpl::OnSetLogLevel( | 1305 void NetInternalsMessageHandler::IOThreadImpl::OnSetLogLevel( |
1307 const ListValue* list) { | 1306 const ListValue* list) { |
1308 int log_level; | 1307 int log_level; |
1309 std::string log_level_string; | 1308 std::string log_level_string; |
1310 if (!list->GetString(0, &log_level_string) || | 1309 if (!list->GetString(0, &log_level_string) || |
1311 !base::StringToInt(log_level_string, &log_level)) { | 1310 !base::StringToInt(log_level_string, &log_level)) { |
1312 NOTREACHED(); | 1311 NOTREACHED(); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 return constants_dict; | 1572 return constants_dict; |
1574 } | 1573 } |
1575 | 1574 |
1576 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { | 1575 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { |
1577 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); | 1576 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); |
1578 | 1577 |
1579 // Set up the chrome://net-internals/ source. | 1578 // Set up the chrome://net-internals/ source. |
1580 GetProfile()->GetChromeURLDataManager()->AddDataSource( | 1579 GetProfile()->GetChromeURLDataManager()->AddDataSource( |
1581 CreateNetInternalsHTMLSource()); | 1580 CreateNetInternalsHTMLSource()); |
1582 } | 1581 } |
OLD | NEW |