Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / browser / chromeos / system_logs / device_event_log_source.cc
blob0fb8a01b0ac721d5fea3f30c0f3863d8f4a8350b
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
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h"
7 #include "base/message_loop/message_loop.h"
8 #include "components/device_event_log/device_event_log.h"
9 #include "content/public/browser/browser_thread.h"
11 namespace system_logs {
13 const char kNetworkEventLogEntry[] = "network_event_log";
14 const char kDeviceEventLogEntry[] = "device_event_log";
16 DeviceEventLogSource::DeviceEventLogSource() : SystemLogsSource("DeviceEvent") {
19 DeviceEventLogSource::~DeviceEventLogSource() {
22 void DeviceEventLogSource::Fetch(const SysLogsSourceCallback& callback) {
23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
24 DCHECK(!callback.is_null());
26 scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse);
27 const int kMaxDeviceEventsForAboutSystem = 400;
28 (*response)[kNetworkEventLogEntry] = device_event_log::GetAsString(
29 device_event_log::OLDEST_FIRST, "time,file,level", "network",
30 device_event_log::kDefaultLogLevel, kMaxDeviceEventsForAboutSystem);
31 (*response)[kDeviceEventLogEntry] = device_event_log::GetAsString(
32 device_event_log::OLDEST_FIRST, "time,file,type,level", "non-network",
33 device_event_log::LOG_LEVEL_DEBUG, kMaxDeviceEventsForAboutSystem);
34 callback.Run(response.get());
37 } // namespace system_logs