1 // Copyright (c) 2010 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.
5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app.
8 #ifndef CHROME_FRAME_CRASH_REPORTING_CRASH_METRICS_H_
9 #define CHROME_FRAME_CRASH_REPORTING_CRASH_METRICS_H_
11 #include "base/basictypes.h"
12 #include "base/lazy_instance.h"
13 #include "base/threading/thread_local.h"
15 // This class provides functionality to track counters like successful page
16 // loads in the host browser, total number of crashes, page loads in chrome
18 class CrashMetricsReporter
{
23 CHROME_FRAME_NAVIGATION_COUNT
,
28 // Returns the global instance of this class.
29 static CrashMetricsReporter
* GetInstance();
31 // The following function pair return/set/increment the specified user
32 // metrics value from the registry. These values are set under the
34 // HKCU\Software\\Google\\ChromeFrame\\UserMetrics
35 int GetMetric(Metric metric
);
36 bool SetMetric(Metric metric
, int value
);
37 int IncrementMetric(Metric metric
);
39 // Records the crash metrics counters like navigation count, crash count.
40 void RecordCrashMetrics();
46 void set_active(bool active
) {
51 friend struct base::DefaultLazyInstanceTraits
<CrashMetricsReporter
>;
53 CrashMetricsReporter()
55 virtual ~CrashMetricsReporter() {}
57 // Indicates whether the crash metrics reporter instance is active.
60 static wchar_t* g_metric_names
[LAST_METRIC
];
62 DISALLOW_COPY_AND_ASSIGN(CrashMetricsReporter
);
65 #endif // CHROME_FRAME_CRASH_REPORTING_CRASH_METRICS_H_