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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/resource/resource_bundle.h" | 74 #include "ui/base/resource/resource_bundle.h" |
75 | 75 |
76 #if defined(OS_CHROMEOS) | 76 #if defined(OS_CHROMEOS) |
77 #include "chrome/browser/chromeos/cros/cros_library.h" | 77 #include "chrome/browser/chromeos/cros/cros_library.h" |
78 #include "chrome/browser/chromeos/cros/network_library.h" | 78 #include "chrome/browser/chromeos/cros/network_library.h" |
79 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 79 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
80 #include "chromeos/dbus/dbus_thread_manager.h" | 80 #include "chromeos/dbus/dbus_thread_manager.h" |
81 #include "chromeos/dbus/debug_daemon_client.h" | 81 #include "chromeos/dbus/debug_daemon_client.h" |
| 82 #include "chromeos/network/onc/onc_constants.h" |
82 #endif | 83 #endif |
83 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
84 #include "chrome/browser/net/service_providers_win.h" | 85 #include "chrome/browser/net/service_providers_win.h" |
85 #endif | 86 #endif |
86 | 87 |
87 using base::PassPlatformFile; | 88 using base::PassPlatformFile; |
88 using base::PlatformFile; | 89 using base::PlatformFile; |
89 using base::PlatformFileError; | 90 using base::PlatformFileError; |
90 using content::BrowserThread; | 91 using content::BrowserThread; |
91 using content::WebContents; | 92 using content::WebContents; |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 std::string passcode; | 1485 std::string passcode; |
1485 if (list->GetSize() != 2 || | 1486 if (list->GetSize() != 2 || |
1486 !list->GetString(0, &onc_blob) || | 1487 !list->GetString(0, &onc_blob) || |
1487 !list->GetString(1, &passcode)) { | 1488 !list->GetString(1, &passcode)) { |
1488 NOTREACHED(); | 1489 NOTREACHED(); |
1489 } | 1490 } |
1490 | 1491 |
1491 std::string error; | 1492 std::string error; |
1492 chromeos::NetworkLibrary* cros_network = | 1493 chromeos::NetworkLibrary* cros_network = |
1493 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 1494 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
1494 cros_network->LoadOncNetworks(onc_blob, passcode, | 1495 if (!cros_network->LoadOncNetworks(onc_blob, passcode, |
1495 chromeos::NetworkUIData::ONC_SOURCE_USER_IMPORT, | 1496 chromeos::onc::ONC_SOURCE_USER_IMPORT, |
1496 false, // allow_web_trust_from_policy | 1497 false)) { // allow web trust from policy |
1497 &error); | 1498 LOG(ERROR) << "Unable to load ONC."; |
| 1499 error = "Unable to load ONC configuration."; |
| 1500 } |
1498 | 1501 |
1499 // Now that we've added the networks, we need to rescan them so they'll be | 1502 // Now that we've added the networks, we need to rescan them so they'll be |
1500 // available from the menu more immediately. | 1503 // available from the menu more immediately. |
1501 cros_network->RequestNetworkScan(); | 1504 cros_network->RequestNetworkScan(); |
1502 | 1505 |
1503 SendJavascriptCommand("receivedONCFileParse", | 1506 SendJavascriptCommand("receivedONCFileParse", |
1504 Value::CreateStringValue(error)); | 1507 Value::CreateStringValue(error)); |
1505 } | 1508 } |
1506 | 1509 |
1507 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { | 1510 void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { |
1508 DCHECK(!list); | 1511 DCHECK(list); |
1509 StoreDebugLogs( | 1512 StoreDebugLogs( |
1510 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, | 1513 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogsCompleted, |
1511 AsWeakPtr())); | 1514 AsWeakPtr())); |
1512 } | 1515 } |
1513 | 1516 |
1514 void NetInternalsMessageHandler::OnStoreDebugLogsCompleted( | 1517 void NetInternalsMessageHandler::OnStoreDebugLogsCompleted( |
1515 const FilePath& log_path, bool succeeded) { | 1518 const FilePath& log_path, bool succeeded) { |
1516 std::string status; | 1519 std::string status; |
1517 if (succeeded) | 1520 if (succeeded) |
1518 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); | 1521 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 } | 1913 } |
1911 | 1914 |
1912 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1915 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1913 : WebUIController(web_ui) { | 1916 : WebUIController(web_ui) { |
1914 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1917 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1915 | 1918 |
1916 // Set up the chrome://net-internals/ source. | 1919 // Set up the chrome://net-internals/ source. |
1917 Profile* profile = Profile::FromWebUI(web_ui); | 1920 Profile* profile = Profile::FromWebUI(web_ui); |
1918 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1921 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
1919 } | 1922 } |
OLD | NEW |