Index: chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc |
diff --git a/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc b/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc |
index 3e9f16524ca3b09afa34f637be703fbd256ced40..078b692ee0a62ff3bcf2c38ddabecc91883906a4 100644 |
--- a/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc |
+++ b/chrome/browser/chromeos/system_logs/touch_log_source_ozone.cc |
@@ -6,12 +6,17 @@ |
#include "ash/touch/touch_hud_debug.h" |
#include "base/bind.h" |
+#include "base/bind_helpers.h" |
+#include "base/callback.h" |
#include "base/command_line.h" |
#include "base/json/json_string_value_serializer.h" |
#include "base/logging.h" |
+#include "base/message_loop/message_loop.h" |
#include "base/process/launch.h" |
#include "components/feedback/feedback_util.h" |
#include "content/public/browser/browser_thread.h" |
+#include "ui/ozone/public/input_controller.h" |
+#include "ui/ozone/public/ozone_platform.h" |
using content::BrowserThread; |
@@ -19,7 +24,26 @@ namespace { |
const char kHUDLogDataKey[] = "hud_log"; |
-void GetTouchLogsOzone(system_logs::SystemLogsResponse* response) { |
+// The prefix "hack-33025" was historically chosen in http://crbug.com/139715. |
+// We continue to go with it in order to be compatible with the existing touch |
+// log processing toolchain. |
+const char kDeviceStatusLogDataKey[] = "hack-33025-touchpad"; |
+ |
+// Callback for handing the outcome of GetTouchDeviceStatus(). Appends the |
+// collected log to the SystemLogsResponse map. |
+void OnStatusLogCollected(scoped_ptr<system_logs::SystemLogsResponse> response, |
+ const system_logs::SysLogsSourceCallback& callback, |
+ scoped_ptr<std::string> log) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ (*response)[kDeviceStatusLogDataKey] = *log; |
+ |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(callback, base::Owned(response.release()))); |
+} |
+ |
+// Collect touch HUD debug logs. This needs to be done on the UI thread. |
+void CollectTouchHudDebugLog(system_logs::SystemLogsResponse* response) { |
scoped_ptr<base::DictionaryValue> dictionary = |
ash::TouchHudDebug::GetAllAsDictionary(); |
if (!dictionary->empty()) { |
@@ -29,10 +53,6 @@ void GetTouchLogsOzone(system_logs::SystemLogsResponse* response) { |
if (json.Serialize(*dictionary) && !touch_log.empty()) |
(*response)[kHUDLogDataKey] = touch_log; |
} |
- |
- // TODO(sheckylin): Add ozone touch log collection implementation. See |
- // http://crbug.com/400022. |
- NOTIMPLEMENTED(); |
} |
} // namespace |
@@ -43,10 +63,12 @@ void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!callback.is_null()); |
- SystemLogsResponse* response = new SystemLogsResponse; |
- BrowserThread::PostBlockingPoolTaskAndReply( |
- FROM_HERE, base::Bind(&GetTouchLogsOzone, response), |
- base::Bind(callback, base::Owned(response))); |
+ scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); |
+ CollectTouchHudDebugLog(response.get()); |
+ |
+ // Collect touch device status logs. |
+ ui::OzonePlatform::GetInstance()->GetInputController()->GetTouchDeviceStatus( |
+ base::Bind(&OnStatusLogCollected, base::Passed(&response), callback)); |
} |
} // namespace system_logs |