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