OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/touch_log_source.h" | 5 #include "chrome/browser/chromeos/system_logs/touch_log_source.h" |
6 | 6 |
7 #include "ash/touch/touch_hud_debug.h" | 7 #include "ash/touch/touch_hud_debug.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 scoped_ptr<base::DictionaryValue> dictionary = | 22 scoped_ptr<base::DictionaryValue> dictionary = |
23 ash::TouchHudDebug::GetAllAsDictionary(); | 23 ash::TouchHudDebug::GetAllAsDictionary(); |
24 if (!dictionary->empty()) { | 24 if (!dictionary->empty()) { |
25 std::string touch_log; | 25 std::string touch_log; |
26 JSONStringValueSerializer json(&touch_log); | 26 JSONStringValueSerializer json(&touch_log); |
27 json.set_pretty_print(true); | 27 json.set_pretty_print(true); |
28 if (json.Serialize(*dictionary) && !touch_log.empty()) | 28 if (json.Serialize(*dictionary) && !touch_log.empty()) |
29 (*response)[kHUDLogDataKey] = touch_log; | 29 (*response)[kHUDLogDataKey] = touch_log; |
30 } | 30 } |
31 | 31 |
32 std::vector<std::pair<std::string, CommandLine>> commands; | 32 std::vector<std::pair<std::string, base::CommandLine>> commands; |
33 CommandLine command = | 33 base::CommandLine command = |
34 CommandLine(base::FilePath("/opt/google/input/inputcontrol")); | 34 base::CommandLine(base::FilePath("/opt/google/input/inputcontrol")); |
35 command.AppendArg("--status"); | 35 command.AppendArg("--status"); |
36 commands.push_back(std::make_pair("hack-33025-touchpad", command)); | 36 commands.push_back(std::make_pair("hack-33025-touchpad", command)); |
37 | 37 |
38 command = CommandLine(base::FilePath("/opt/google/input/cmt_feedback")); | 38 command = base::CommandLine(base::FilePath("/opt/google/input/cmt_feedback")); |
39 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); | 39 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); |
40 | 40 |
41 command = CommandLine(base::FilePath("/opt/google/input/evdev_feedback")); | 41 command = |
| 42 base::CommandLine(base::FilePath("/opt/google/input/evdev_feedback")); |
42 commands.push_back( | 43 commands.push_back( |
43 std::make_pair("hack-33025-touchscreen_activity", command)); | 44 std::make_pair("hack-33025-touchscreen_activity", command)); |
44 | 45 |
45 for (size_t i = 0; i < commands.size(); ++i) { | 46 for (size_t i = 0; i < commands.size(); ++i) { |
46 std::string output; | 47 std::string output; |
47 base::GetAppOutput(commands[i].second, &output); | 48 base::GetAppOutput(commands[i].second, &output); |
48 (*response)[commands[i].first] = output; | 49 (*response)[commands[i].first] = output; |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 } // namespace | 53 } // namespace |
53 | 54 |
54 namespace system_logs { | 55 namespace system_logs { |
55 | 56 |
56 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { | 57 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { |
57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
58 DCHECK(!callback.is_null()); | 59 DCHECK(!callback.is_null()); |
59 | 60 |
60 SystemLogsResponse* response = new SystemLogsResponse; | 61 SystemLogsResponse* response = new SystemLogsResponse; |
61 BrowserThread::PostBlockingPoolTaskAndReply( | 62 BrowserThread::PostBlockingPoolTaskAndReply( |
62 FROM_HERE, base::Bind(&GetTouchLogsX11, response), | 63 FROM_HERE, base::Bind(&GetTouchLogsX11, response), |
63 base::Bind(callback, base::Owned(response))); | 64 base::Bind(callback, base::Owned(response))); |
64 } | 65 } |
65 | 66 |
66 } // namespace system_logs | 67 } // namespace system_logs |
OLD | NEW |