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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1566 |
1567 base::ListValue network_configs; | 1567 base::ListValue network_configs; |
1568 base::ListValue certificates; | 1568 base::ListValue certificates; |
1569 std::string error; | 1569 std::string error; |
1570 if (!chromeos::onc::ParseAndValidateOncForImport( | 1570 if (!chromeos::onc::ParseAndValidateOncForImport( |
1571 onc_blob, onc_source, passcode, &network_configs, &certificates)) { | 1571 onc_blob, onc_source, passcode, &network_configs, &certificates)) { |
1572 error = "Errors occurred during the ONC parsing."; | 1572 error = "Errors occurred during the ONC parsing."; |
1573 LOG(ERROR) << error; | 1573 LOG(ERROR) << error; |
1574 } | 1574 } |
1575 | 1575 |
| 1576 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs; |
| 1577 chromeos::CertificateHandler certificate_handler; |
| 1578 if (!certificate_handler.ImportCertificates(certificates, onc_source, NULL, |
| 1579 &imported_server_and_ca_certs)) { |
| 1580 error += "Some certificates couldn't be imported."; |
| 1581 LOG(ERROR) << error; |
| 1582 } |
| 1583 |
| 1584 if (!chromeos::onc::ResolveServerCertRefsInNetworks( |
| 1585 imported_server_and_ca_certs, &network_configs)) { |
| 1586 error += "Some certificate references could not be resolved."; |
| 1587 LOG(ERROR) << error; |
| 1588 } |
| 1589 |
| 1590 net::CertificateList imported_server_and_ca_certs_list; |
| 1591 for (chromeos::CertificateHandler::CertsByGUID::iterator it = |
| 1592 imported_server_and_ca_certs.begin(); |
| 1593 it != imported_server_and_ca_certs.end(); ++it) { |
| 1594 imported_server_and_ca_certs_list.push_back(it->second); |
| 1595 } |
1576 chromeos::NetworkLibrary* network_library = | 1596 chromeos::NetworkLibrary* network_library = |
1577 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 1597 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
1578 network_library->LoadOncNetworks(network_configs, onc_source); | 1598 network_library->LoadOncNetworks( |
| 1599 network_configs, |
| 1600 onc_source, |
| 1601 base::Bind(&chromeos::onc::GetPEMEncodedCertFromFingerprint, |
| 1602 imported_server_and_ca_certs_list)); |
1579 // Now that we've added the networks, we need to rescan them so they'll be | 1603 // Now that we've added the networks, we need to rescan them so they'll be |
1580 // available from the menu more immediately. | 1604 // available from the menu more immediately. |
1581 network_library->RequestNetworkScan(); | 1605 network_library->RequestNetworkScan(); |
1582 | 1606 |
1583 chromeos::CertificateHandler certificate_handler; | |
1584 if (!certificate_handler.ImportCertificates(certificates, onc_source, NULL)) { | |
1585 error += "Some certificates couldn't be imported."; | |
1586 LOG(ERROR) << error; | |
1587 } | |
1588 | |
1589 SendJavascriptCommand("receivedONCFileParse", | 1607 SendJavascriptCommand("receivedONCFileParse", |
1590 Value::CreateStringValue(error)); | 1608 Value::CreateStringValue(error)); |
1591 } | 1609 } |
1592 | 1610 |
1593 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { | 1611 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { |
1594 DCHECK(list); | 1612 DCHECK(list); |
1595 StoreDebugLogs( | 1613 StoreDebugLogs( |
1596 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, | 1614 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, |
1597 AsWeakPtr())); | 1615 AsWeakPtr())); |
1598 } | 1616 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 } | 2014 } |
1997 | 2015 |
1998 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 2016 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1999 : WebUIController(web_ui) { | 2017 : WebUIController(web_ui) { |
2000 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 2018 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
2001 | 2019 |
2002 // Set up the chrome://net-internals/ source. | 2020 // Set up the chrome://net-internals/ source. |
2003 Profile* profile = Profile::FromWebUI(web_ui); | 2021 Profile* profile = Profile::FromWebUI(web_ui); |
2004 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 2022 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
2005 } | 2023 } |
OLD | NEW |