1// Copyright (c) 2012 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/dbus_log_source.h"
6
7#include "content/public/browser/browser_thread.h"
8#include "dbus/dbus_statistics.h"
9
10const char kDBusLogEntryShort[] = "dbus_summary";
11const char kDBusLogEntryLong[] = "dbus_details";
12
13namespace system_logs {
14
15void DBusLogSource::Fetch(const SysLogsSourceCallback& callback) {
16  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
17  DCHECK(!callback.is_null());
18
19  SystemLogsResponse response;
20  response[kDBusLogEntryShort] = dbus::statistics::GetAsString(
21      dbus::statistics::SHOW_INTERFACE,
22      dbus::statistics::FORMAT_ALL);
23  response[kDBusLogEntryLong] = dbus::statistics::GetAsString(
24      dbus::statistics::SHOW_METHOD,
25      dbus::statistics::FORMAT_TOTALS);
26  callback.Run(&response);
27}
28
29}  // namespace system_logs
30