Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/syslogs/commandline_fetcher.h" | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/bind.h" | |
| 11 #include "base/bind_helpers.h" | |
| 12 #include "base/command_line.h" | |
| 13 #include "base/file_path.h" | |
| 14 #include "base/file_util.h" | |
| 15 #include "base/logging.h" | |
| 16 #include "base/process_util.h" | |
| 17 | |
| 18 namespace chromeos { | |
| 19 | |
| 20 void CommandLineFetcher::Fetch(SysLogsFetcherCallback request) | |
|
rkc
2012/08/06 18:30:18
Add a TODO here to mention that we need to move th
tudalex(Chromium)
2012/08/06 19:14:22
Done.
| |
| 21 { | |
| 22 std::vector< std::pair<std::string, CommandLine> > commands; | |
| 23 | |
| 24 // Needed to initialize an empty command, but the constructor was private | |
| 25 CommandLine command(FilePath("/usr/bin/cras_test_client")); | |
| 26 command.AppendArg("--dump_server_info"); | |
| 27 commands.push_back(std::make_pair("cras", command)); | |
| 28 | |
| 29 command = CommandLine((FilePath("set"))); | |
| 30 commands.push_back(std::make_pair("env", command)); | |
| 31 | |
| 32 command = CommandLine(FilePath("/usr/bin/setxkbmap")); | |
| 33 command.AppendArg("-print"); | |
| 34 command.AppendArg("-query"); | |
| 35 commands.push_back(std::make_pair("setxkbmap", command)); | |
| 36 | |
| 37 command = CommandLine(FilePath("/usr/bin/xrandr")); | |
| 38 command.AppendArg("--verbose"); | |
| 39 commands.push_back(std::make_pair("xrandr", command)); | |
| 40 | |
| 41 command = CommandLine(FilePath("/opt/google/touchpad/tpcontrol")); | |
| 42 commands.push_back(std::make_pair("hack-33025-touchpad", command)); | |
| 43 | |
| 44 command = CommandLine(FilePath("/opt/google/touchpad/generate_userfeedback")); | |
| 45 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); | |
| 46 | |
| 47 | |
| 48 std::vector< std::pair<std::string, CommandLine> >::iterator it; | |
| 49 for (it = commands.begin(); it != commands.end(); ++it) { | |
| 50 std::string output; | |
| 51 base::GetAppOutput(it->second, &output); | |
| 52 (*response_)[it->first] = output; | |
| 53 } | |
| 54 request.Run(response_); | |
| 55 } | |
| 56 | |
| 57 } // namespace chromeos | |
| OLD | NEW |