OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/device_event_log_source.h" | 5 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "components/device_event_log/device_event_log.h" | 8 #include "components/device_event_log/device_event_log.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
11 namespace system_logs { | 11 namespace system_logs { |
12 | 12 |
13 const char kNetworkEventLogEntry[] = "network_event_log"; | 13 const char kNetworkEventLogEntry[] = "network_event_log"; |
14 const char kDeviceEventLogEntry[] = "device_event_log"; | 14 const char kDeviceEventLogEntry[] = "device_event_log"; |
15 | 15 |
16 DeviceEventLogSource::DeviceEventLogSource() : SystemLogsSource("DeviceEvent") { | 16 DeviceEventLogSource::DeviceEventLogSource() : SystemLogsSource("DeviceEvent") { |
17 } | 17 } |
18 | 18 |
19 DeviceEventLogSource::~DeviceEventLogSource() { | 19 DeviceEventLogSource::~DeviceEventLogSource() { |
20 } | 20 } |
21 | 21 |
22 void DeviceEventLogSource::Fetch(const SysLogsSourceCallback& callback) { | 22 void DeviceEventLogSource::Fetch(const SysLogsSourceCallback& callback) { |
23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
24 DCHECK(!callback.is_null()); | 24 DCHECK(!callback.is_null()); |
25 | 25 |
26 scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); | 26 scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); |
27 const int kMaxDeviceEventsForAboutSystem = 400; | 27 const int kMaxDeviceEventsForAboutSystem = 400; |
28 (*response)[kNetworkEventLogEntry] = device_event_log::GetAsString( | 28 (*response)[kNetworkEventLogEntry] = device_event_log::GetAsString( |
29 device_event_log::OLDEST_FIRST, "time,file,level", "network", | 29 device_event_log::OLDEST_FIRST, "time,file,level", "network", |
30 device_event_log::kDefaultLogLevel, kMaxDeviceEventsForAboutSystem); | 30 device_event_log::kDefaultLogLevel, kMaxDeviceEventsForAboutSystem); |
31 (*response)[kDeviceEventLogEntry] = device_event_log::GetAsString( | 31 (*response)[kDeviceEventLogEntry] = device_event_log::GetAsString( |
32 device_event_log::OLDEST_FIRST, "time,file,type,level", "non-network", | 32 device_event_log::OLDEST_FIRST, "time,file,type,level", "non-network", |
33 device_event_log::LOG_LEVEL_DEBUG, kMaxDeviceEventsForAboutSystem); | 33 device_event_log::LOG_LEVEL_DEBUG, kMaxDeviceEventsForAboutSystem); |
34 callback.Run(response.get()); | 34 callback.Run(response.get()); |
35 } | 35 } |
36 | 36 |
37 } // namespace system_logs | 37 } // namespace system_logs |
OLD | NEW |