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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/chromeos/system_logs/touch_log_source.h" 6 7 #include "ash/touch/touch_hud_debug.h" 8 #include "base/json/json_string_value_serializer.h" 9 #include "chrome/browser/feedback/feedback_util.h" 10 #include "content/public/browser/browser_thread.h" 11 12 const char kHUDLogDataKey[] = "hud_log"; 13 14 namespace chromeos { 15 16 TouchLogSource::TouchLogSource() { 17 } 18 19 TouchLogSource::~TouchLogSource() { 20 } 21 22 void TouchLogSource::Fetch(const SysLogsSourceCallback& callback) { 23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 24 DCHECK(!callback.is_null()); 25 26 SystemLogsResponse response; 27 scoped_ptr<DictionaryValue> dictionary = 28 ash::internal::TouchHudDebug::GetAllAsDictionary(); 29 if (!dictionary->empty()) { 30 std::string touch_log; 31 JSONStringValueSerializer json(&touch_log); 32 json.set_pretty_print(true); 33 if (json.Serialize(*dictionary) && !touch_log.empty()) 34 response[kHUDLogDataKey] = touch_log; 35 } 36 callback.Run(&response); 37 } 38 39 } // namespace chromeos 40