Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 10024056: Added functionality to chrome://net-internals/#chromeos page that user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void OnRendererReady(const ListValue* list); 269 void OnRendererReady(const ListValue* list);
270 void OnEnableHttpThrottling(const ListValue* list); 270 void OnEnableHttpThrottling(const ListValue* list);
271 void OnClearBrowserCache(const ListValue* list); 271 void OnClearBrowserCache(const ListValue* list);
272 void OnGetPrerenderInfo(const ListValue* list); 272 void OnGetPrerenderInfo(const ListValue* list);
273 #ifdef OS_CHROMEOS 273 #ifdef OS_CHROMEOS
274 void OnRefreshSystemLogs(const ListValue* list); 274 void OnRefreshSystemLogs(const ListValue* list);
275 void OnGetSystemLog(const ListValue* list); 275 void OnGetSystemLog(const ListValue* list);
276 void OnImportONCFile(const ListValue* list); 276 void OnImportONCFile(const ListValue* list);
277 void OnStoreDebugLogs(const ListValue* list); 277 void OnStoreDebugLogs(const ListValue* list);
278 void OnStoreDebugLogsCompleted(const FilePath& log_path, bool succeeded); 278 void OnStoreDebugLogsCompleted(const FilePath& log_path, bool succeeded);
279 void OnSetNetworkDebugMode(const ListValue* list);
280 void OnSetNetworkDebugModeCompleted(const std::string& subsystem,
281 bool succeeded);
279 #endif 282 #endif
280 283
281 private: 284 private:
282 class IOThreadImpl; 285 class IOThreadImpl;
283 286
284 #ifdef OS_CHROMEOS 287 #ifdef OS_CHROMEOS
285 // Class that is used for getting network related ChromeOS logs. 288 // Class that is used for getting network related ChromeOS logs.
286 // Logs are fetched from ChromeOS libcros on user request, and only when we 289 // Logs are fetched from ChromeOS libcros on user request, and only when we
287 // don't yet have a copy of logs. If a copy is present, we send back data from 290 // don't yet have a copy of logs. If a copy is present, we send back data from
288 // it, else we save request and answer to it when we get logs from libcros. 291 // it, else we save request and answer to it when we get logs from libcros.
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog, 645 base::Bind(&NetInternalsMessageHandler::OnGetSystemLog,
643 base::Unretained(this))); 646 base::Unretained(this)));
644 web_ui()->RegisterMessageCallback( 647 web_ui()->RegisterMessageCallback(
645 "importONCFile", 648 "importONCFile",
646 base::Bind(&NetInternalsMessageHandler::OnImportONCFile, 649 base::Bind(&NetInternalsMessageHandler::OnImportONCFile,
647 base::Unretained(this))); 650 base::Unretained(this)));
648 web_ui()->RegisterMessageCallback( 651 web_ui()->RegisterMessageCallback(
649 "storeDebugLogs", 652 "storeDebugLogs",
650 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogs, 653 base::Bind(&NetInternalsMessageHandler::OnStoreDebugLogs,
651 base::Unretained(this))); 654 base::Unretained(this)));
655 web_ui()->RegisterMessageCallback(
656 "setNetworkDebugMode",
657 base::Bind(&NetInternalsMessageHandler::OnSetNetworkDebugMode,
658 base::Unretained(this)));
652 #endif 659 #endif
653 } 660 }
654 661
655 void NetInternalsMessageHandler::SendJavascriptCommand( 662 void NetInternalsMessageHandler::SendJavascriptCommand(
656 const std::string& command, 663 const std::string& command,
657 Value* arg) { 664 Value* arg) {
658 scoped_ptr<Value> command_value(Value::CreateStringValue(command)); 665 scoped_ptr<Value> command_value(Value::CreateStringValue(command));
659 scoped_ptr<Value> value(arg); 666 scoped_ptr<Value> value(arg);
660 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
661 if (value.get()) { 668 if (value.get()) {
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 const FilePath& log_path, bool succeeded) { 1379 const FilePath& log_path, bool succeeded) {
1373 std::string status; 1380 std::string status;
1374 if (succeeded) 1381 if (succeeded)
1375 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); 1382 status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe();
1376 else 1383 else
1377 status = "Failed to create log file"; 1384 status = "Failed to create log file";
1378 SendJavascriptCommand("receivedStoreDebugLogs", 1385 SendJavascriptCommand("receivedStoreDebugLogs",
1379 Value::CreateStringValue(status)); 1386 Value::CreateStringValue(status));
1380 } 1387 }
1381 1388
1389 void NetInternalsMessageHandler::OnSetNetworkDebugMode(const ListValue* list) {
1390 std::string subsystem;
1391 if (list->GetSize() != 1 || !list->GetString(0, &subsystem))
1392 NOTREACHED();
1393 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->
1394 SetDebugMode(
1395 subsystem,
1396 base::Bind(
1397 &NetInternalsMessageHandler::OnSetNetworkDebugModeCompleted,
1398 AsWeakPtr(),
1399 subsystem));
1400 }
1401
1402 void NetInternalsMessageHandler::OnSetNetworkDebugModeCompleted(
1403 const std::string& subsystem,
1404 bool succeeded) {
1405 std::string status;
1406 if (succeeded)
1407 status = "Debug mode is changed to " + subsystem;
1408 else
1409 status = "Failed to change debug mode to " + subsystem;
1410 SendJavascriptCommand("receivedSetNetworkDebugMode",
1411 Value::CreateStringValue(status));
1412 }
1382 #endif 1413 #endif
1383 1414
1384 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpPipeliningStatus( 1415 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpPipeliningStatus(
1385 const ListValue* list) { 1416 const ListValue* list) {
1386 DictionaryValue* status_dict = new DictionaryValue(); 1417 DictionaryValue* status_dict = new DictionaryValue();
1387 1418
1388 status_dict->Set("pipelining_enabled", 1419 status_dict->Set("pipelining_enabled",
1389 Value::CreateBooleanValue( 1420 Value::CreateBooleanValue(
1390 net::HttpStreamFactory::http_pipelining_enabled())); 1421 net::HttpStreamFactory::http_pipelining_enabled()));
1391 1422
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 1723
1693 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1724 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1694 : WebUIController(web_ui) { 1725 : WebUIController(web_ui) {
1695 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1726 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1696 1727
1697 // Set up the chrome://net-internals/ source. 1728 // Set up the chrome://net-internals/ source.
1698 Profile* profile = Profile::FromWebUI(web_ui); 1729 Profile* profile = Profile::FromWebUI(web_ui);
1699 profile->GetChromeURLDataManager()->AddDataSource( 1730 profile->GetChromeURLDataManager()->AddDataSource(
1700 CreateNetInternalsHTMLSource()); 1731 CreateNetInternalsHTMLSource());
1701 } 1732 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/chromeos_view.js ('k') | chromeos/dbus/debug_daemon_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698