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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1561 NOTREACHED(); | 1561 NOTREACHED(); |
1562 } | 1562 } |
1563 | 1563 |
1564 chromeos::onc::ONCSource onc_source = chromeos::onc::ONC_SOURCE_USER_IMPORT; | 1564 chromeos::onc::ONCSource onc_source = chromeos::onc::ONC_SOURCE_USER_IMPORT; |
1565 | 1565 |
1566 base::ListValue network_configs; | 1566 base::ListValue network_configs; |
1567 base::ListValue certificates; | 1567 base::ListValue certificates; |
1568 std::string error; | 1568 std::string error; |
1569 if (!chromeos::onc::ParseAndValidateOncForImport( | 1569 if (!chromeos::onc::ParseAndValidateOncForImport( |
1570 onc_blob, onc_source, passcode, &network_configs, &certificates)) { | 1570 onc_blob, onc_source, passcode, &network_configs, &certificates)) { |
1571 error = "Errors occurred during the ONC parsing."; | 1571 error = "Errors occurred during the ONC parsing."; |
Greg Spencer (Chromium)
2013/06/27 20:15:47
nit: Add a space after the period so that if more
pneubeck (no reviews)
2013/06/28 09:41:03
Done.
| |
1572 LOG(ERROR) << error; | 1572 LOG(ERROR) << error; |
1573 } | 1573 } |
1574 | 1574 |
1575 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs; | |
1576 chromeos::CertificateHandler certificate_handler; | |
1577 if (!certificate_handler.ImportCertificates(certificates, onc_source, NULL, | |
1578 &imported_server_and_ca_certs)) { | |
1579 error += "Some certificates couldn't be imported."; | |
Greg Spencer (Chromium)
2013/06/27 20:15:47
nit: Same here: add a space after the period so th
pneubeck (no reviews)
2013/06/28 09:41:03
Done.
| |
1580 LOG(ERROR) << error; | |
1581 } | |
1582 | |
1583 if (!chromeos::onc::ResolveServerCertRefsInNetworks( | |
1584 imported_server_and_ca_certs, &network_configs)) { | |
1585 error += "Some certificate references could not be resolved."; | |
1586 LOG(ERROR) << error; | |
1587 } | |
1588 | |
1589 net::CertificateList imported_server_and_ca_certs_list; | |
1590 for (chromeos::CertificateHandler::CertsByGUID::iterator it = | |
1591 imported_server_and_ca_certs.begin(); | |
1592 it != imported_server_and_ca_certs.end(); ++it) { | |
1593 imported_server_and_ca_certs_list.push_back(it->second); | |
1594 } | |
1575 chromeos::NetworkLibrary* network_library = | 1595 chromeos::NetworkLibrary* network_library = |
1576 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 1596 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
1577 network_library->LoadOncNetworks(network_configs, onc_source); | 1597 network_library->LoadOncNetworks( |
1598 network_configs, | |
1599 onc_source, | |
1600 base::Bind(&chromeos::onc::GetPEMEncodedCertFromFingerprint, | |
1601 imported_server_and_ca_certs_list)); | |
1578 // Now that we've added the networks, we need to rescan them so they'll be | 1602 // Now that we've added the networks, we need to rescan them so they'll be |
1579 // available from the menu more immediately. | 1603 // available from the menu more immediately. |
1580 network_library->RequestNetworkScan(); | 1604 network_library->RequestNetworkScan(); |
1581 | 1605 |
1582 chromeos::CertificateHandler certificate_handler; | |
1583 if (!certificate_handler.ImportCertificates(certificates, onc_source, NULL)) { | |
1584 error += "Some certificates couldn't be imported."; | |
1585 LOG(ERROR) << error; | |
1586 } | |
1587 | |
1588 SendJavascriptCommand("receivedONCFileParse", | 1606 SendJavascriptCommand("receivedONCFileParse", |
1589 Value::CreateStringValue(error)); | 1607 Value::CreateStringValue(error)); |
1590 } | 1608 } |
1591 | 1609 |
1592 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { | 1610 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { |
1593 DCHECK(list); | 1611 DCHECK(list); |
1594 StoreDebugLogs( | 1612 StoreDebugLogs( |
1595 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, | 1613 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, |
1596 AsWeakPtr())); | 1614 AsWeakPtr())); |
1597 } | 1615 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1884 } | 1902 } |
1885 | 1903 |
1886 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1904 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1887 : WebUIController(web_ui) { | 1905 : WebUIController(web_ui) { |
1888 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1906 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1889 | 1907 |
1890 // Set up the chrome://net-internals/ source. | 1908 // Set up the chrome://net-internals/ source. |
1891 Profile* profile = Profile::FromWebUI(web_ui); | 1909 Profile* profile = Profile::FromWebUI(web_ui); |
1892 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1910 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1893 } | 1911 } |
OLD | NEW |