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
android_webview / browser / metrics / android_metrics_provider.h [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_METRICS_ANDROID_METRICS_PROVIDER_H_
#define ANDROID_WEBVIEW_BROWSER_METRICS_ANDROID_METRICS_PROVIDER_H_
#include "components/metrics/metrics_provider.h"
#include "base/memory/raw_ptr.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
namespace android_webview {
namespace prefs {
constexpr char kPrimaryCpuAbiBitnessPref[] =
"android_system_info.primary_cpu_abi_bitness";
}
// AndroidMetricsProvider is responsible for logging information related to
// system-level information about the Android device as well as the process.
class AndroidMetricsProvider : public metrics::MetricsProvider {
public:
explicit AndroidMetricsProvider(PrefService* local_state)
: local_state_(local_state) {}
~AndroidMetricsProvider() override = default;
static void RegisterPrefs(PrefRegistrySimple* registry);
void OnDidCreateMetricsLog() override;
void ProvidePreviousSessionData(
metrics::ChromeUserMetricsExtension* uma_proto) override;
AndroidMetricsProvider(const AndroidMetricsProvider&) = delete;
AndroidMetricsProvider& operator=(const AndroidMetricsProvider&) = delete;
static void ResetGlobalStateForTesting();
private:
raw_ptr<PrefService> local_state_;
static inline bool local_state_saved_ = false;
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_METRICS_ANDROID_METRICS_PROVIDER_H_