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) | |
| 21 { | |
|
satorux1
2012/08/06 23:47:31
move { to the previous line
tudalex(Chromium)
2012/08/07 00:56:11
Done.
| |
| 22 // TODO(tudalex): Move program calling in a array or something similar to make | |
| 23 // it more easier to modify and understand. | |
| 24 std::vector< std::pair<std::string, CommandLine> > commands; | |
|
satorux1
2012/08/06 23:47:31
no space after <
tudalex(Chromium)
2012/08/07 00:56:11
Done.
| |
| 25 | |
| 26 // Needed to initialize an empty command, but the constructor was private | |
| 27 CommandLine command(FilePath("/usr/bin/cras_test_client")); | |
| 28 command.AppendArg("--dump_server_info"); | |
| 29 commands.push_back(std::make_pair("cras", command)); | |
| 30 | |
| 31 command = CommandLine((FilePath("set"))); | |
| 32 commands.push_back(std::make_pair("env", command)); | |
| 33 | |
| 34 command = CommandLine(FilePath("/usr/bin/setxkbmap")); | |
| 35 command.AppendArg("-print"); | |
| 36 command.AppendArg("-query"); | |
| 37 commands.push_back(std::make_pair("setxkbmap", command)); | |
| 38 | |
| 39 command = CommandLine(FilePath("/usr/bin/xrandr")); | |
| 40 command.AppendArg("--verbose"); | |
| 41 commands.push_back(std::make_pair("xrandr", command)); | |
| 42 | |
| 43 command = CommandLine(FilePath("/opt/google/touchpad/tpcontrol")); | |
| 44 commands.push_back(std::make_pair("hack-33025-touchpad", command)); | |
| 45 | |
| 46 command = CommandLine(FilePath("/opt/google/touchpad/generate_userfeedback")); | |
| 47 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); | |
| 48 | |
| 49 | |
| 50 std::vector< std::pair<std::string, CommandLine> >::iterator it; | |
| 51 for (it = commands.begin(); it != commands.end(); ++it) { | |
| 52 std::string output; | |
| 53 base::GetAppOutput(it->second, &output); | |
| 54 (*response_)[it->first] = output; | |
| 55 } | |
| 56 request.Run(response_); | |
| 57 } | |
| 58 | |
| 59 } // namespace chromeos | |
| OLD | NEW |