blob: 94ec9d8bf32436fa1a8a5a332156c6f8cb042464 [file] [log] [blame]
Darin Petkovf0136cd2012-11-07 16:18:02 +01001// Copyright (c) 2012 The Chromium OS 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#ifndef SHILL_DIAGNOSTICS_REPORTER_H_
6#define SHILL_DIAGNOSTICS_REPORTER_H_
7
8#include <base/lazy_instance.h>
9#include <base/memory/weak_ptr.h>
10
11namespace shill {
12
13class EventDispatcher;
14
15class DiagnosticsReporter {
16 public:
17 virtual ~DiagnosticsReporter();
18
19 // This is a singleton -- use DiagnosticsReporter::GetInstance()->Foo()
20 static DiagnosticsReporter *GetInstance();
21
22 void Init(EventDispatcher *dispatcher);
23
24 void Report();
25
26 protected:
27 DiagnosticsReporter();
28
29 virtual bool IsReportingEnabled();
30
31 private:
32 friend struct base::DefaultLazyInstanceTraits<DiagnosticsReporter>;
33 friend class DiagnosticsReporterTest;
34
35 void TriggerCrash();
36
37 EventDispatcher *dispatcher_;
38 base::WeakPtrFactory<DiagnosticsReporter> weak_ptr_factory_;
39
40 DISALLOW_COPY_AND_ASSIGN(DiagnosticsReporter);
41};
42
43} // namespace shill
44
45#endif // SHILL_DIAGNOSTICS_REPORTER_H_