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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 #include "net/base/transport_security_state.h" | 64 #include "net/base/transport_security_state.h" |
65 #include "net/disk_cache/disk_cache.h" | 65 #include "net/disk_cache/disk_cache.h" |
66 #include "net/http/http_cache.h" | 66 #include "net/http/http_cache.h" |
67 #include "net/http/http_network_layer.h" | 67 #include "net/http/http_network_layer.h" |
68 #include "net/http/http_network_session.h" | 68 #include "net/http/http_network_session.h" |
69 #include "net/http/http_server_properties.h" | 69 #include "net/http/http_server_properties.h" |
70 #include "net/http/http_stream_factory.h" | 70 #include "net/http/http_stream_factory.h" |
71 #include "net/proxy/proxy_service.h" | 71 #include "net/proxy/proxy_service.h" |
72 #include "net/url_request/url_request_context.h" | 72 #include "net/url_request/url_request_context.h" |
73 #include "net/url_request/url_request_context_getter.h" | 73 #include "net/url_request/url_request_context_getter.h" |
74 #include "ui/base/l10n/l10n_util.h" | |
pneubeck (no reviews)
2012/12/10 09:33:10
unused?
Greg Spencer (Chromium)
2012/12/10 23:54:03
Yes. Removed.
| |
74 #include "ui/base/resource/resource_bundle.h" | 75 #include "ui/base/resource/resource_bundle.h" |
75 | 76 |
76 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
77 #include "chrome/browser/chromeos/cros/cros_library.h" | 78 #include "chrome/browser/chromeos/cros/cros_library.h" |
78 #include "chrome/browser/chromeos/cros/network_library.h" | 79 #include "chrome/browser/chromeos/cros/network_library.h" |
79 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 80 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
80 #include "chromeos/dbus/dbus_thread_manager.h" | 81 #include "chromeos/dbus/dbus_thread_manager.h" |
81 #include "chromeos/dbus/debug_daemon_client.h" | 82 #include "chromeos/dbus/debug_daemon_client.h" |
83 #include "chromeos/network/onc/onc_constants.h" | |
82 #endif | 84 #endif |
83 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
84 #include "chrome/browser/net/service_providers_win.h" | 86 #include "chrome/browser/net/service_providers_win.h" |
85 #endif | 87 #endif |
86 | 88 |
87 using base::PassPlatformFile; | 89 using base::PassPlatformFile; |
88 using base::PlatformFile; | 90 using base::PlatformFile; |
89 using base::PlatformFileError; | 91 using base::PlatformFileError; |
90 using content::BrowserThread; | 92 using content::BrowserThread; |
91 using content::WebContents; | 93 using content::WebContents; |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 std::string passcode; | 1486 std::string passcode; |
1485 if (list->GetSize() != 2 || | 1487 if (list->GetSize() != 2 || |
1486 !list->GetString(0, &onc_blob) || | 1488 !list->GetString(0, &onc_blob) || |
1487 !list->GetString(1, &passcode)) { | 1489 !list->GetString(1, &passcode)) { |
1488 NOTREACHED(); | 1490 NOTREACHED(); |
1489 } | 1491 } |
1490 | 1492 |
1491 std::string error; | 1493 std::string error; |
1492 chromeos::NetworkLibrary* cros_network = | 1494 chromeos::NetworkLibrary* cros_network = |
1493 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 1495 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
1494 cros_network->LoadOncNetworks(onc_blob, passcode, | 1496 if (!cros_network->LoadOncNetworks(onc_blob, passcode, |
1495 chromeos::NetworkUIData::ONC_SOURCE_USER_IMPORT, | 1497 chromeos::onc::ONC_SOURCE_USER_IMPORT, |
1496 false, // allow_web_trust_from_policy | 1498 false)) { // allow web trust from policy |
1497 &error); | 1499 LOG(ERROR) << "Unable to load ONC."; |
1500 error = "Unable to load ONC configuration."; | |
1501 } | |
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) { |
1508 DCHECK(!list); | 1512 DCHECK(list); |
1509 StoreDebugLogs( | 1513 StoreDebugLogs( |
1510 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, | 1514 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, |
1511 AsWeakPtr())); | 1515 AsWeakPtr())); |
1512 } | 1516 } |
1513 | 1517 |
1514 void NetInternalsMessageHandler::OnStoreDebugLogsCompleted( | 1518 void NetInternalsMessageHandler::OnStoreDebugLogsCompleted( |
1515 const FilePath& log_path, bool succeeded) { | 1519 const FilePath& log_path, bool succeeded) { |
1516 std::string status; | 1520 std::string status; |
1517 if (succeeded) | 1521 if (succeeded) |
1518 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); | 1522 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); |
(...skipping 391 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 |