Chromium Code Reviews| Index: chrome/browser/chromeos/system_logs/device_event_log_source.cc |
| diff --git a/chrome/browser/chromeos/system_logs/device_event_log_source.cc b/chrome/browser/chromeos/system_logs/device_event_log_source.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d122ffe50734a7224f250ad9aa9e88c3ec07da6c |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/system_logs/device_event_log_source.cc |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
|
Ben Chan
2014/12/02 21:42:53
drop (c)
http://www.chromium.org/developers/codin
stevenjb
2014/12/03 00:16:03
Done. (This was copied from an existing older file
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chromeos/system_logs/device_event_log_source.h" |
| + |
| +#include "base/message_loop/message_loop.h" |
| +#include "chromeos/device_event_log.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +namespace system_logs { |
| + |
| +const char kNetworkEventLogEntry[] = "network_event_log"; |
| +const char kDeviceEventLogEntry[] = "device_event_log"; |
| + |
| +DeviceEventLogSource::DeviceEventLogSource() |
| + : SystemLogsSource("DeviceEvent") { |
| +} |
| + |
| +DeviceEventLogSource::~DeviceEventLogSource() { |
| +} |
| + |
| +void DeviceEventLogSource::Fetch(const SysLogsSourceCallback& callback) { |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| + DCHECK(!callback.is_null()); |
| + |
| + scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse); |
| + const int kMaxDeviceEventsForAboutSystem = 400; |
| + (*response)[kNetworkEventLogEntry] = |
| + chromeos::device_event_log::GetAsString( |
| + chromeos::device_event_log::OLDEST_FIRST, |
| + "time,file,level", |
| + chromeos::device_event_log::LOG_TYPE_NETWORK, |
| + chromeos::device_event_log::kDefaultLogLevel, |
| + kMaxDeviceEventsForAboutSystem); |
| + (*response)[kDeviceEventLogEntry] = |
| + chromeos::device_event_log::GetAsString( |
| + chromeos::device_event_log::OLDEST_FIRST, |
| + "time,file,level", |
| + chromeos::device_event_log::LOG_TYPE_NON_NETWORK, |
| + chromeos::device_event_log::kDefaultLogLevel, |
| + kMaxDeviceEventsForAboutSystem); |
| + callback.Run(response.get()); |
| +} |
| + |
| +} // namespace system_logs |