OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 | 1481 |
1482 void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) { | 1482 void NetInternalsMessageHandler::OnImportONCFile(const ListValue* list) { |
1483 std::string onc_blob; | 1483 std::string onc_blob; |
1484 std::string passcode; | 1484 std::string passcode; |
1485 if (list->GetSize() != 2 || | 1485 if (list->GetSize() != 2 || |
1486 !list->GetString(0, &onc_blob) || | 1486 !list->GetString(0, &onc_blob) || |
1487 !list->GetString(1, &passcode)) { | 1487 !list->GetString(1, &passcode)) { |
1488 NOTREACHED(); | 1488 NOTREACHED(); |
1489 } | 1489 } |
1490 | 1490 |
1491 std::string error; | |
1492 chromeos::NetworkLibrary* cros_network = | 1491 chromeos::NetworkLibrary* cros_network = |
1493 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 1492 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
1494 cros_network->LoadOncNetworks(onc_blob, passcode, | 1493 bool success = cros_network->LoadOncNetworks( |
1495 chromeos::NetworkUIData::ONC_SOURCE_USER_IMPORT, | 1494 onc_blob, |
1496 false, // allow_web_trust_from_policy | 1495 passcode, |
1497 &error); | 1496 chromeos::NetworkUIData::ONC_SOURCE_USER_IMPORT, |
| 1497 false); // allow_web_trust_from_policy |
| 1498 |
| 1499 std::string error; |
| 1500 if (!success) |
| 1501 error = "Couldn't import ONC"; |
1498 | 1502 |
1499 // Now that we've added the networks, we need to rescan them so they'll be | 1503 // Now that we've added the networks, we need to rescan them so they'll be |
1500 // available from the menu more immediately. | 1504 // available from the menu more immediately. |
1501 cros_network->RequestNetworkScan(); | 1505 cros_network->RequestNetworkScan(); |
1502 | 1506 |
1503 SendJavascriptCommand("receivedONCFileParse", | 1507 SendJavascriptCommand("receivedONCFileParse", |
1504 Value::CreateStringValue(error)); | 1508 Value::CreateStringValue(error)); |
1505 } | 1509 } |
1506 | 1510 |
1507 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { | 1511 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 } | 1914 } |
1911 | 1915 |
1912 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1916 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1913 : WebUIController(web_ui) { | 1917 : WebUIController(web_ui) { |
1914 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1918 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1915 | 1919 |
1916 // Set up the chrome://net-internals/ source. | 1920 // Set up the chrome://net-internals/ source. |
1917 Profile* profile = Profile::FromWebUI(web_ui); | 1921 Profile* profile = Profile::FromWebUI(web_ui); |
1918 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1922 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
1919 } | 1923 } |
OLD | NEW |