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

Side by Side Diff: chrome/browser/chromeos/syslogs/commandline_fetcher.cc

Issue 10827130: Refactoring the SysInfoProvider. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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
(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 #include "content/public/browser/browser_thread.h"
18
19 namespace chromeos {
20
21 void CommandLineFetcher::Fetch(const SysLogsFetcherCallback& request) {
22 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)) {
23 content::BrowserThread::PostTask(content::BrowserThread::FILE,
satorux1 2012/08/08 22:01:03 FILE thread is supposedly dead. Please use PostBlo
tudalex(Chromium) 2012/08/09 02:30:24 Done.
24 FROM_HERE,
25 base::Bind(&CommandLineFetcher::Fetch,
26 base::Unretained(this),
satorux1 2012/08/08 22:01:03 This looks unsafe. Is this guaranteed that |this|
tudalex(Chromium) 2012/08/09 02:30:24 Created a anonymous namespace and put the main exe
27 request));
28 return;
29 }
30
31 // TODO(tudalex): Move program calling in a array or something similar to make
32 // it more easier to modify and understand.
33 std::vector<std::pair<std::string, CommandLine> > commands;
34
35 // Needed to initialize an empty command, but the constructor was private
36 CommandLine command(FilePath("/usr/bin/cras_test_client"));
37 command.AppendArg("--dump_server_info");
38 commands.push_back(std::make_pair("cras", command));
39
40 command = CommandLine((FilePath("set")));
41 commands.push_back(std::make_pair("env", command));
42
43 command = CommandLine(FilePath("/usr/bin/setxkbmap"));
44 command.AppendArg("-print");
45 command.AppendArg("-query");
46 commands.push_back(std::make_pair("setxkbmap", command));
47
48 command = CommandLine(FilePath("/usr/bin/xrandr"));
49 command.AppendArg("--verbose");
50 commands.push_back(std::make_pair("xrandr", command));
51
52 command = CommandLine(FilePath("/opt/google/touchpad/tpcontrol"));
53 commands.push_back(std::make_pair("hack-33025-touchpad", command));
54
55 command = CommandLine(FilePath("/opt/google/touchpad/generate_userfeedback"));
56 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command));
57
58
59 std::vector< std::pair<std::string, CommandLine> >::iterator it;
60 for (it = commands.begin(); it != commands.end(); ++it) {
61 std::string output;
62 base::GetAppOutput(it->second, &output);
63 (*response_)[it->first] = output;
64 }
65 content::BrowserThread::PostTask(content::BrowserThread::UI,
66 FROM_HERE,
satorux1 2012/08/08 22:01:03 indentation.
tudalex(Chromium) 2012/08/09 02:30:24 Done.
67 base::Bind(request, response_));
68 }
69
70 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698