| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/feedback/system_logs/scrubbed_system_logs_fetcher.h" | 5 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_so
urce.h" | 11 #include "chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_so
urce.h" |
| 11 #include "chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h" | 12 #include "chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h" |
| 12 #include "chrome/browser/feedback/system_logs/log_sources/memory_details_log_sou
rce.h" | 13 #include "chrome/browser/feedback/system_logs/log_sources/memory_details_log_sou
rce.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
| 16 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h" | 17 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h" |
| 17 #include "chrome/browser/chromeos/system_logs/dbus_log_source.h" | 18 #include "chrome/browser/chromeos/system_logs/dbus_log_source.h" |
| 18 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" | 19 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" |
| 19 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h" | 20 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h" |
| 20 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" | 21 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" |
| 21 #include "chrome/browser/chromeos/system_logs/touch_log_source.h" | 22 #include "chrome/browser/chromeos/system_logs/touch_log_source.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 using content::BrowserThread; | 25 using content::BrowserThread; |
| 25 | 26 |
| 26 namespace system_logs { | 27 namespace system_logs { |
| 27 | 28 |
| 28 ScrubbedSystemLogsFetcher::ScrubbedSystemLogsFetcher() { | 29 ScrubbedSystemLogsFetcher::ScrubbedSystemLogsFetcher() { |
| 29 data_sources_.push_back(new ChromeInternalLogSource()); | 30 data_sources_.push_back(base::MakeUnique<ChromeInternalLogSource>()); |
| 30 data_sources_.push_back(new CrashIdsSource()); | 31 data_sources_.push_back(base::MakeUnique<CrashIdsSource>()); |
| 31 data_sources_.push_back(new MemoryDetailsLogSource()); | 32 data_sources_.push_back(base::MakeUnique<MemoryDetailsLogSource>()); |
| 32 | 33 |
| 33 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 34 data_sources_.push_back(new CommandLineLogSource()); | 35 data_sources_.push_back(base::MakeUnique<CommandLineLogSource>()); |
| 35 data_sources_.push_back(new DBusLogSource()); | 36 data_sources_.push_back(base::MakeUnique<DBusLogSource>()); |
| 36 data_sources_.push_back(new DeviceEventLogSource()); | 37 data_sources_.push_back(base::MakeUnique<DeviceEventLogSource>()); |
| 37 data_sources_.push_back(new LsbReleaseLogSource()); | 38 data_sources_.push_back(base::MakeUnique<LsbReleaseLogSource>()); |
| 38 data_sources_.push_back(new TouchLogSource()); | 39 data_sources_.push_back(base::MakeUnique<TouchLogSource>()); |
| 39 | 40 |
| 40 // Debug Daemon data source - currently only this data source supports | 41 // Debug Daemon data source - currently only this data source supports |
| 41 // the scrub_data parameter but all others get processed by Rewrite() | 42 // the scrub_data parameter but all others get processed by Rewrite() |
| 42 // as well. | 43 // as well. |
| 43 const bool scrub_data = true; | 44 const bool scrub_data = true; |
| 44 data_sources_.push_back(new DebugDaemonLogSource(scrub_data)); | 45 data_sources_.push_back(base::MakeUnique<DebugDaemonLogSource>(scrub_data)); |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 num_pending_requests_ = data_sources_.size(); | 48 num_pending_requests_ = data_sources_.size(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 ScrubbedSystemLogsFetcher::~ScrubbedSystemLogsFetcher() { | 51 ScrubbedSystemLogsFetcher::~ScrubbedSystemLogsFetcher() { |
| 51 } | 52 } |
| 52 | 53 |
| 53 void ScrubbedSystemLogsFetcher::Rewrite(const std::string& source_name, | 54 void ScrubbedSystemLogsFetcher::Rewrite(const std::string& source_name, |
| 54 SystemLogsResponse* response) { | 55 SystemLogsResponse* response) { |
| 55 for (auto& element : *response) | 56 for (auto& element : *response) |
| 56 element.second = anonymizer_.Anonymize(element.second); | 57 element.second = anonymizer_.Anonymize(element.second); |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace system_logs | 60 } // namespace system_logs |
| OLD | NEW |