Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
|
achuithb
2014/12/11 20:19:08
Was this changed by clang_format? If not, don't ch
Shecky Lin
2014/12/12 08:31:22
Done.
| |
| 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" |
| 11 #include "base/logging.h" | |
| 11 #include "base/process/launch.h" | 12 #include "base/process/launch.h" |
| 12 #include "components/feedback/feedback_util.h" | 13 #include "components/feedback/feedback_util.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 const char kHUDLogDataKey[] = "hud_log"; | 20 const char kHUDLogDataKey[] = "hud_log"; |
| 20 | 21 |
| 21 void GetTouchLogs(system_logs::SystemLogsResponse* response) { | 22 void GetTouchLogsOzone(system_logs::SystemLogsResponse* response) { |
| 22 scoped_ptr<base::DictionaryValue> dictionary = | 23 scoped_ptr<base::DictionaryValue> dictionary = |
| 23 ash::TouchHudDebug::GetAllAsDictionary(); | 24 ash::TouchHudDebug::GetAllAsDictionary(); |
| 24 if (!dictionary->empty()) { | 25 if (!dictionary->empty()) { |
| 25 std::string touch_log; | 26 std::string touch_log; |
| 26 JSONStringValueSerializer json(&touch_log); | 27 JSONStringValueSerializer json(&touch_log); |
| 27 json.set_pretty_print(true); | 28 json.set_pretty_print(true); |
| 28 if (json.Serialize(*dictionary) && !touch_log.empty()) | 29 if (json.Serialize(*dictionary) && !touch_log.empty()) |
| 29 (*response)[kHUDLogDataKey] = touch_log; | 30 (*response)[kHUDLogDataKey] = touch_log; |
| 30 } | 31 } |
| 31 | 32 |
| 32 std::vector<std::pair<std::string, CommandLine> > commands; | 33 // TODO(sheckylin): Add ozone touch log collection implementation. |
|
achuithb
2014/12/11 20:19:08
Let's add a tracking bug id here as well.
Shecky Lin
2014/12/12 08:31:22
Done.
| |
| 33 CommandLine command = | 34 NOTIMPLEMENTED(); |
| 34 CommandLine(base::FilePath("/opt/google/input/inputcontrol")); | |
| 35 command.AppendArg("--status"); | |
| 36 commands.push_back(std::make_pair("hack-33025-touchpad", command)); | |
| 37 | |
| 38 command = | |
| 39 CommandLine(base::FilePath("/opt/google/input/cmt_feedback")); | |
| 40 commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); | |
| 41 | |
| 42 command = CommandLine( | |
| 43 base::FilePath("/opt/google/input/evdev_feedback")); | |
| 44 commands.push_back( | |
| 45 std::make_pair("hack-33025-touchscreen_activity", command)); | |
| 46 | |
| 47 for (size_t i = 0; i < commands.size(); ++i) { | |
| 48 std::string output; | |
| 49 base::GetAppOutput(commands[i].second, &output); | |
| 50 (*response)[commands[i].first] = output; | |
| 51 } | |
| 52 } | 35 } |
| 53 | 36 |
| 54 } // namespace | 37 } // namespace |
| 55 | 38 |
| 56 namespace system_logs { | 39 namespace system_logs { |
| 57 | 40 |
| 58 TouchLogSource::TouchLogSource() : SystemLogsSource("Touch") { | |
| 59 } | |
| 60 | |
| 61 TouchLogSource::~TouchLogSource() { | |
| 62 } | |
| 63 | |
| 64 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { | 41 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { |
| 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 66 DCHECK(!callback.is_null()); | 43 DCHECK(!callback.is_null()); |
| 67 | 44 |
| 68 SystemLogsResponse* response = new SystemLogsResponse; | 45 SystemLogsResponse* response = new SystemLogsResponse; |
| 69 BrowserThread::PostBlockingPoolTaskAndReply( | 46 BrowserThread::PostBlockingPoolTaskAndReply( |
| 70 FROM_HERE, | 47 FROM_HERE, base::Bind(&GetTouchLogsOzone, response), |
|
achuithb
2014/12/11 20:19:08
Is this clang_format? If not, I think having base:
Shecky Lin
2014/12/12 08:31:22
It is clang_format. I'm keeping it thereby.
| |
| 71 base::Bind(&GetTouchLogs, response), | |
| 72 base::Bind(callback, base::Owned(response))); | 48 base::Bind(callback, base::Owned(response))); |
| 73 } | 49 } |
| 74 | 50 |
| 75 } // namespace system_logs | 51 } // namespace system_logs |
| OLD | NEW |