1 // Copyright 2014 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 #ifndef CHROME_BROWSER_METRICS_GOOGLE_UPDATE_METRICS_PROVIDER_WIN_H_
6 #define CHROME_BROWSER_METRICS_GOOGLE_UPDATE_METRICS_PROVIDER_WIN_H_
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/installer/util/google_update_settings.h"
12 #include "components/metrics/metrics_provider.h"
14 // GoogleUpdateMetricsProviderWin is responsible for filling out the
15 // GoogleUpdate of the UMA SystemProfileProto.
16 class GoogleUpdateMetricsProviderWin
: public metrics::MetricsProvider
{
18 GoogleUpdateMetricsProviderWin();
19 virtual ~GoogleUpdateMetricsProviderWin();
21 // Fetches Google Update data asynchronously and calls |done_callback| when
23 void GetGoogleUpdateData(const base::Closure
& done_callback
);
25 // metrics::MetricsProvider
26 virtual void ProvideSystemProfileMetrics(
27 metrics::SystemProfileProto
* system_profile_proto
) override
;
30 // This is a small helper struct containing the Google Update metrics state.
31 struct GoogleUpdateMetrics
{
32 GoogleUpdateMetrics();
33 ~GoogleUpdateMetrics();
35 // Defines whether this is a user-level or system-level install.
36 bool is_system_install
;
38 // The time at which Google Update last started an automatic update check.
39 base::Time last_started_automatic_update_check
;
41 // The time at which Google Update last successfully received update
42 // information from Google servers.
43 base::Time last_checked
;
45 // Details about Google Update's attempts to update itself.
46 GoogleUpdateSettings::ProductData google_update_data
;
48 // Details about Google Update's attempts to update this product.
49 GoogleUpdateSettings::ProductData product_data
;
52 // Retrieve the Google Update data on the blocking pool.
53 static GoogleUpdateMetrics
GetGoogleUpdateDataOnBlockingPool();
55 // Receives |google_update_metrics| from a blocking pool thread and runs
57 void ReceiveGoogleUpdateData(
58 const base::Closure
& done_callback
,
59 const GoogleUpdateMetrics
& google_update_metrics
);
61 // Google Update metrics that were fetched via GetGoogleUpdateData(). Will be
62 // filled in only after the successful completion of GetGoogleUpdateData().
63 GoogleUpdateMetrics google_update_metrics_
;
65 base::WeakPtrFactory
<GoogleUpdateMetricsProviderWin
> weak_ptr_factory_
;
67 DISALLOW_COPY_AND_ASSIGN(GoogleUpdateMetricsProviderWin
);
70 #endif // CHROME_BROWSER_METRICS_GOOGLE_UPDATE_METRICS_PROVIDER_WIN_H_