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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ash/touch/touch_hud_debug.h" | 9 #include "ash/touch/touch_hud_debug.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/json/json_string_value_serializer.h" | 12 #include "base/json/json_string_value_serializer.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "components/feedback/feedback_util.h" | 14 #include "components/feedback/feedback_util.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const char kHUDLogDataKey[] = "hud_log"; | 21 const char kHUDLogDataKey[] = "hud_log"; |
22 | 22 |
23 void GetTouchLogsX11(system_logs::SystemLogsResponse* response) { | 23 void GetTouchLogsX11(system_logs::SystemLogsResponse* response) { |
24 scoped_ptr<base::DictionaryValue> dictionary = | 24 std::unique_ptr<base::DictionaryValue> dictionary = |
25 ash::TouchHudDebug::GetAllAsDictionary(); | 25 ash::TouchHudDebug::GetAllAsDictionary(); |
26 if (!dictionary->empty()) { | 26 if (!dictionary->empty()) { |
27 std::string touch_log; | 27 std::string touch_log; |
28 JSONStringValueSerializer json(&touch_log); | 28 JSONStringValueSerializer json(&touch_log); |
29 json.set_pretty_print(true); | 29 json.set_pretty_print(true); |
30 if (json.Serialize(*dictionary) && !touch_log.empty()) | 30 if (json.Serialize(*dictionary) && !touch_log.empty()) |
31 (*response)[kHUDLogDataKey] = touch_log; | 31 (*response)[kHUDLogDataKey] = touch_log; |
32 } | 32 } |
33 | 33 |
34 std::vector<std::pair<std::string, base::CommandLine>> commands; | 34 std::vector<std::pair<std::string, base::CommandLine>> commands; |
(...skipping 25 matching lines...) Expand all Loading... |
60 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 60 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
61 DCHECK(!callback.is_null()); | 61 DCHECK(!callback.is_null()); |
62 | 62 |
63 SystemLogsResponse* response = new SystemLogsResponse; | 63 SystemLogsResponse* response = new SystemLogsResponse; |
64 BrowserThread::PostBlockingPoolTaskAndReply( | 64 BrowserThread::PostBlockingPoolTaskAndReply( |
65 FROM_HERE, base::Bind(&GetTouchLogsX11, response), | 65 FROM_HERE, base::Bind(&GetTouchLogsX11, response), |
66 base::Bind(callback, base::Owned(response))); | 66 base::Bind(callback, base::Owned(response))); |
67 } | 67 } |
68 | 68 |
69 } // namespace system_logs | 69 } // namespace system_logs |
OLD | NEW |