Chromium Code Reviews| 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/chromeos/system_logs/command_line_log_source.h" | 5 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 if (base::SysInfo::IsRunningOnChromeOS()) { | 73 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 74 // The following command would hang if run in Linux Chrome OS build on a | 74 // The following command would hang if run in Linux Chrome OS build on a |
| 75 // Linux Workstation. | 75 // Linux Workstation. |
| 76 command = base::CommandLine(base::FilePath("/bin/sh")); | 76 command = base::CommandLine(base::FilePath("/bin/sh")); |
| 77 command.AppendArg("-c"); | 77 command.AppendArg("-c"); |
| 78 command.AppendArg( | 78 command.AppendArg( |
| 79 "/usr/bin/du -h / | grep -v -e \\/home\\/.*\\/Downloads\\/"); | 79 "/usr/bin/du -h / | grep -v -e \\/home\\/.*\\/Downloads\\/"); |
| 80 commands.push_back(std::make_pair("system_files", command)); | 80 commands.push_back(std::make_pair("system_files", command)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Track the list of plugged-in USB devices. | |
| 84 command = base::CommandLine(base::FilePath("/bin/sh")); | |
| 85 command.AppendArg("-c"); | |
| 86 command.AppendArg("/usr/bin/lsusb -t"); | |
| 87 commands.emplace_back("usb_devices", command); | |
|
xiyuan
2017/05/02 06:07:04
Do you want to update other push_back s ?
| |
| 88 | |
| 83 // Get disk space usage information | 89 // Get disk space usage information |
| 84 command = base::CommandLine(base::FilePath("/bin/df")); | 90 command = base::CommandLine(base::FilePath("/bin/df")); |
| 85 commands.push_back(std::make_pair("disk_usage", command)); | 91 commands.push_back(std::make_pair("disk_usage", command)); |
| 86 | 92 |
| 87 for (size_t i = 0; i < commands.size(); ++i) { | 93 for (size_t i = 0; i < commands.size(); ++i) { |
| 88 VLOG(1) << "Executting System Logs Command: " << commands[i].first; | 94 VLOG(1) << "Executting System Logs Command: " << commands[i].first; |
| 89 std::string output; | 95 std::string output; |
| 90 base::GetAppOutput(commands[i].second, &output); | 96 base::GetAppOutput(commands[i].second, &output); |
| 91 (*response)[commands[i].first] = output; | 97 (*response)[commands[i].first] = output; |
| 92 } | 98 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 108 | 114 |
| 109 SystemLogsResponse* response = new SystemLogsResponse; | 115 SystemLogsResponse* response = new SystemLogsResponse; |
| 110 base::PostTaskWithTraitsAndReply(FROM_HERE, | 116 base::PostTaskWithTraitsAndReply(FROM_HERE, |
| 111 base::TaskTraits().MayBlock().WithPriority( | 117 base::TaskTraits().MayBlock().WithPriority( |
| 112 base::TaskPriority::BACKGROUND), | 118 base::TaskPriority::BACKGROUND), |
| 113 base::Bind(&ExecuteCommandLines, response), | 119 base::Bind(&ExecuteCommandLines, response), |
| 114 base::Bind(callback, base::Owned(response))); | 120 base::Bind(callback, base::Owned(response))); |
| 115 } | 121 } |
| 116 | 122 |
| 117 } // namespace system_logs | 123 } // namespace system_logs |
| OLD | NEW |