1 // Copyright 2014 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "components/metrics/metrics_provider.h" 6 7 #include "base/notreached.h" 8 #include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h" 9 10 namespace metrics { 11 MetricsProvider()12MetricsProvider::MetricsProvider() { 13 } 14 ~MetricsProvider()15MetricsProvider::~MetricsProvider() { 16 } 17 Init()18void MetricsProvider::Init() { 19 } 20 AsyncInit(base::OnceClosure done_callback)21void MetricsProvider::AsyncInit(base::OnceClosure done_callback) { 22 std::move(done_callback).Run(); 23 } 24 ProvideHistograms()25bool MetricsProvider::ProvideHistograms() { 26 return true; 27 } 28 OnDidCreateMetricsLog()29void MetricsProvider::OnDidCreateMetricsLog() { 30 emitted_ = ProvideHistograms(); 31 } 32 OnRecordingEnabled()33void MetricsProvider::OnRecordingEnabled() { 34 } 35 OnRecordingDisabled()36void MetricsProvider::OnRecordingDisabled() { 37 } 38 OnClientStateCleared()39void MetricsProvider::OnClientStateCleared() {} 40 OnAppEnterBackground()41void MetricsProvider::OnAppEnterBackground() { 42 } 43 OnPageLoadStarted()44void MetricsProvider::OnPageLoadStarted() {} 45 HasIndependentMetrics()46bool MetricsProvider::HasIndependentMetrics() { 47 return false; 48 } 49 ProvideIndependentMetrics(base::OnceClosure serialize_log_callback,base::OnceCallback<void (bool)> done_callback,ChromeUserMetricsExtension * uma_proto,base::HistogramSnapshotManager * snapshot_manager)50void MetricsProvider::ProvideIndependentMetrics( 51 base::OnceClosure serialize_log_callback, 52 base::OnceCallback<void(bool)> done_callback, 53 ChromeUserMetricsExtension* uma_proto, 54 base::HistogramSnapshotManager* snapshot_manager) { 55 // Either the method HasIndependentMetrics() has been overridden and this 56 // method has not, or this method being called without regard to Has(). 57 // Both are wrong. 58 NOTREACHED(); 59 } 60 ProvideSystemProfileMetrics(SystemProfileProto * system_profile_proto)61void MetricsProvider::ProvideSystemProfileMetrics( 62 SystemProfileProto* system_profile_proto) {} 63 ProvideSystemProfileMetricsWithLogCreationTime(base::TimeTicks log_creation_time,SystemProfileProto * system_profile_proto)64void MetricsProvider::ProvideSystemProfileMetricsWithLogCreationTime( 65 base::TimeTicks log_creation_time, 66 SystemProfileProto* system_profile_proto) { 67 ProvideSystemProfileMetrics(system_profile_proto); 68 } 69 HasPreviousSessionData()70bool MetricsProvider::HasPreviousSessionData() { 71 return false; 72 } 73 ProvidePreviousSessionData(ChromeUserMetricsExtension * uma_proto)74void MetricsProvider::ProvidePreviousSessionData( 75 ChromeUserMetricsExtension* uma_proto) { 76 ProvideStabilityMetrics(uma_proto->mutable_system_profile()); 77 } 78 ProvideCurrentSessionData(ChromeUserMetricsExtension * uma_proto)79void MetricsProvider::ProvideCurrentSessionData( 80 ChromeUserMetricsExtension* uma_proto) { 81 ProvideStabilityMetrics(uma_proto->mutable_system_profile()); 82 83 if (!emitted_) { 84 ProvideHistograms(); 85 } 86 } 87 ProvideCurrentSessionUKMData()88void MetricsProvider::ProvideCurrentSessionUKMData() {} 89 ProvideStabilityMetrics(SystemProfileProto * system_profile_proto)90void MetricsProvider::ProvideStabilityMetrics( 91 SystemProfileProto* system_profile_proto) { 92 } 93 ClearSavedStabilityMetrics()94void MetricsProvider::ClearSavedStabilityMetrics() { 95 } 96 RecordHistogramSnapshots(base::HistogramSnapshotManager * snapshot_manager)97void MetricsProvider::RecordHistogramSnapshots( 98 base::HistogramSnapshotManager* snapshot_manager) { 99 } 100 RecordInitialHistogramSnapshots(base::HistogramSnapshotManager * snapshot_manager)101void MetricsProvider::RecordInitialHistogramSnapshots( 102 base::HistogramSnapshotManager* snapshot_manager) { 103 } 104 105 } // namespace metrics 106