summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/system_logs/dbus_log_source.cc
blob: 8f925186a1bd9840542cafa85948b9ac8e9f1bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// 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/dbus_log_source.h"

#include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h"
#include "content/public/browser/browser_thread.h"
#include "dbus/dbus_statistics.h"

const char kDBusLogEntryShort[] = "dbus_summary";
const char kDBusLogEntryLong[] = "dbus_details";

namespace chromeos {

void DBusLogSource::Fetch(const SysLogsSourceCallback& callback) {
  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
  DCHECK(!callback.is_null());

  SystemLogsResponse response;
  response[kDBusLogEntryShort] = dbus::statistics::GetAsString(
      dbus::statistics::SHOW_INTERFACE,
      dbus::statistics::FORMAT_ALL);
  response[kDBusLogEntryLong] = dbus::statistics::GetAsString(
      dbus::statistics::SHOW_METHOD,
      dbus::statistics::FORMAT_TOTALS);
  callback.Run(&response);
}

}  // namespace chromeos