summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/system/syslogs_provider.h
blob: ecb92b6f9cfacc378df382677ce1f437ccf40a33 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2011 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.

#ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
#define CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_
#pragma once

#include <string>

#include "base/callback_old.h"
#include "content/browser/cancelable_request.h"

class CancelableRequestConsumerBase;

namespace chromeos {
namespace system {

typedef std::map<std::string, std::string> LogDictionaryType;

// This interface provides access to Chrome OS syslogs.
class SyslogsProvider : public CancelableRequestProvider {
 public:
  static SyslogsProvider* GetInstance();

  // The callback type used with RequestSyslogs().
  typedef Callback2<LogDictionaryType*,
                    std::string*>::Type ReadCompleteCallback;

  // Used to specify the syslogs context with RequestSyslogs().
  enum SyslogsContext {
    SYSLOGS_FEEDBACK,
    SYSLOGS_SYSINFO,
    SYSLOGS_NETWORK,
    SYSLOGS_DEFAULT
  };

  // Request system logs. Read happens on the FILE thread and callback is
  // called on the thread this is called from (via ForwardResult).
  // Logs are owned by callback function (use delete when done with them).
  // Returns the request handle. Call CancelRequest(Handle) to cancel
  // the request before the callback gets called.
  virtual Handle RequestSyslogs(
      bool compress_logs,
      SyslogsContext context,
      CancelableRequestConsumerBase* consumer,
      ReadCompleteCallback* callback) = 0;

 protected:
  virtual ~SyslogsProvider() {}
};

}  // namespace system
}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_SYSTEM_SYSLOGS_PROVIDER_H_