Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/metrics/metrics_service_accessor.cc

Issue 532623003: Remove MetricsServiceObserver in favor of MetricsProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN build. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/metrics_service_accessor.h" 5 #include "chrome/browser/metrics/metrics_service_accessor.h"
6 6
7 #include "chrome/browser/browser_process.h"
8 #include "components/metrics/metrics_service.h" 7 #include "components/metrics/metrics_service.h"
9 #include "components/metrics/metrics_service_observer.h"
10 8
11 // TODO(asvitkine): Remove when this class is moved to metrics namespace. 9 // TODO(asvitkine): Remove when this class is moved to metrics namespace.
12 using metrics::MetricsService; 10 using metrics::MetricsService;
13 using metrics::MetricsServiceObserver;
14 using metrics::SyntheticTrialGroup; 11 using metrics::SyntheticTrialGroup;
15 12
16 // static 13 // static
17 void MetricsServiceAccessor::AddMetricsServiceObserver(
18 MetricsServiceObserver* observer) {
19 MetricsService* metrics_service = g_browser_process->metrics_service();
20 if (metrics_service)
21 metrics_service->AddObserver(observer);
22 }
23
24 void MetricsServiceAccessor::RemoveMetricsServiceObserver(
25 MetricsServiceObserver* observer) {
26 MetricsService* metrics_service = g_browser_process->metrics_service();
27 if (metrics_service)
28 metrics_service->RemoveObserver(observer);
29 }
30
31 // static
32 bool MetricsServiceAccessor::RegisterSyntheticFieldTrial( 14 bool MetricsServiceAccessor::RegisterSyntheticFieldTrial(
33 MetricsService* metrics_service, 15 MetricsService* metrics_service,
34 uint32_t trial_name_hash, 16 uint32_t trial_name_hash,
35 uint32_t group_name_hash) { 17 uint32_t group_name_hash) {
36 if (!metrics_service) 18 if (!metrics_service)
37 return false; 19 return false;
38 20
39 SyntheticTrialGroup trial_group(trial_name_hash, group_name_hash); 21 SyntheticTrialGroup trial_group(trial_name_hash, group_name_hash);
40 metrics_service->RegisterSyntheticFieldTrial(trial_group); 22 metrics_service->RegisterSyntheticFieldTrial(trial_group);
41 return true; 23 return true;
42 } 24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698