| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/process/launch.h" | 12 #include "base/process/launch.h" |
| 13 #include "components/feedback/feedback_util.h" | 13 #include "components/feedback/feedback_util.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "ui/ozone/public/input_controller.h" |
| 16 #include "ui/ozone/public/ozone_platform.h" |
| 15 | 17 |
| 16 using content::BrowserThread; | 18 using content::BrowserThread; |
| 17 | 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| 20 const char kHUDLogDataKey[] = "hud_log"; | 22 const char kHUDLogDataKey[] = "hud_log"; |
| 21 | 23 |
| 24 // The prefix "hack-33025" was historically chosen in http://crbug.com/139715. |
| 25 // We continue to go with it in order to be compatible with the existing touch |
| 26 // log processing toolchain. |
| 27 const char kDeviceStatusLogDataKey[] = "hack-33025-touchpad"; |
| 28 |
| 22 void GetTouchLogsOzone(system_logs::SystemLogsResponse* response) { | 29 void GetTouchLogsOzone(system_logs::SystemLogsResponse* response) { |
| 23 scoped_ptr<base::DictionaryValue> dictionary = | 30 scoped_ptr<base::DictionaryValue> dictionary = |
| 24 ash::TouchHudDebug::GetAllAsDictionary(); | 31 ash::TouchHudDebug::GetAllAsDictionary(); |
| 25 if (!dictionary->empty()) { | 32 if (!dictionary->empty()) { |
| 26 std::string touch_log; | 33 std::string touch_log; |
| 27 JSONStringValueSerializer json(&touch_log); | 34 JSONStringValueSerializer json(&touch_log); |
| 28 json.set_pretty_print(true); | 35 json.set_pretty_print(true); |
| 29 if (json.Serialize(*dictionary) && !touch_log.empty()) | 36 if (json.Serialize(*dictionary) && !touch_log.empty()) |
| 30 (*response)[kHUDLogDataKey] = touch_log; | 37 (*response)[kHUDLogDataKey] = touch_log; |
| 31 } | 38 } |
| 32 | 39 |
| 33 // TODO(sheckylin): Add ozone touch log collection implementation. See | 40 (*response)[kDeviceStatusLogDataKey] = ui::OzonePlatform::GetInstance() |
| 34 // http://crbug.com/400022. | 41 ->GetInputController() |
| 35 NOTIMPLEMENTED(); | 42 ->GetGestureDeviceStatus(); |
| 36 } | 43 } |
| 37 | 44 |
| 38 } // namespace | 45 } // namespace |
| 39 | 46 |
| 40 namespace system_logs { | 47 namespace system_logs { |
| 41 | 48 |
| 42 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { | 49 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { |
| 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 44 DCHECK(!callback.is_null()); | 51 DCHECK(!callback.is_null()); |
| 45 | 52 |
| 46 SystemLogsResponse* response = new SystemLogsResponse; | 53 SystemLogsResponse* response = new SystemLogsResponse; |
| 47 BrowserThread::PostBlockingPoolTaskAndReply( | 54 BrowserThread::PostBlockingPoolTaskAndReply( |
| 48 FROM_HERE, base::Bind(&GetTouchLogsOzone, response), | 55 FROM_HERE, base::Bind(&GetTouchLogsOzone, response), |
| 49 base::Bind(callback, base::Owned(response))); | 56 base::Bind(callback, base::Owned(response))); |
| 50 } | 57 } |
| 51 | 58 |
| 52 } // namespace system_logs | 59 } // namespace system_logs |
| OLD | NEW |