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
57
58
59
60
61
62
63
64
65
android_webview / browser / aw_metrics_service_client_delegate.cc [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "android_webview/browser/aw_metrics_service_client_delegate.h"
#include "android_webview/browser/aw_browser_process.h"
#include "android_webview/browser/debugging_metrics_provider.h"
#include "android_webview/browser/lifecycle/aw_contents_lifecycle_notifier.h"
#include "android_webview/browser/metrics/android_metrics_provider.h"
#include "android_webview/browser/metrics/aw_component_metrics_provider_delegate.h"
#include "android_webview/browser/metrics/aw_metrics_filtering_status_metrics_provider.h"
#include "android_webview/browser/metrics/aw_metrics_service_client.h"
#include "android_webview/browser/metrics/aw_server_side_allowlist_metrics_provider.h"
#include "android_webview/browser/metrics/renderer_process_metrics_provider.h"
#include "android_webview/browser/metrics/visibility_metrics_provider.h"
#include "android_webview/browser/page_load_metrics/aw_page_load_metrics_provider.h"
#include "android_webview/browser/tracing/aw_background_tracing_metrics_provider.h"
#include "components/metrics/component_metrics_provider.h"
#include "components/metrics/metrics_service.h"
namespace android_webview {
AwMetricsServiceClientDelegate::AwMetricsServiceClientDelegate() = default;
AwMetricsServiceClientDelegate::~AwMetricsServiceClientDelegate() = default;
void AwMetricsServiceClientDelegate::RegisterAdditionalMetricsProviders(
metrics::MetricsService* service) {
PrefService* local_state = AwBrowserProcess::GetInstance()->local_state();
service->RegisterMetricsProvider(
std::make_unique<AndroidMetricsProvider>(local_state));
service->RegisterMetricsProvider(
std::make_unique<AwPageLoadMetricsProvider>());
service->RegisterMetricsProvider(std::make_unique<VisibilityMetricsProvider>(
AwBrowserProcess::GetInstance()->visibility_metrics_logger()));
service->RegisterMetricsProvider(
std::make_unique<RendererProcessMetricsProvider>());
service->RegisterMetricsProvider(
std::make_unique<DebuggingMetricsProvider>());
service->RegisterMetricsProvider(
std::make_unique<metrics::ComponentMetricsProvider>(
std::make_unique<AwComponentMetricsProviderDelegate>(
AwMetricsServiceClient::GetInstance())));
service->RegisterMetricsProvider(
std::make_unique<tracing::AwBackgroundTracingMetricsProvider>());
service->RegisterMetricsProvider(
std::make_unique<AwServerSideAllowlistMetricsProvider>(
AwMetricsServiceClient::GetInstance()));
service->RegisterMetricsProvider(
std::make_unique<AwMetricsFilteringStatusMetricsProvider>(
AwMetricsServiceClient::GetInstance()));
}
void AwMetricsServiceClientDelegate::AddWebViewAppStateObserver(
WebViewAppStateObserver* observer) {
AwContentsLifecycleNotifier::GetInstance().AddObserver(observer);
}
bool AwMetricsServiceClientDelegate::HasAwContentsEverCreated() const {
return AwContentsLifecycleNotifier::GetInstance()
.has_aw_contents_ever_created();
}
} // namespace android_webview