metrics_service_accessor.cc revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
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.
4
5#include "chrome/browser/metrics/metrics_service_accessor.h"
6
7#include "chrome/browser/browser_process.h"
8#include "components/metrics/metrics_service.h"
9#include "components/metrics/metrics_service_observer.h"
10
11// static
12void MetricsServiceAccessor::AddMetricsServiceObserver(
13    MetricsServiceObserver* observer) {
14  MetricsService* metrics_service = g_browser_process->metrics_service();
15  if (metrics_service)
16    metrics_service->AddObserver(observer);
17}
18
19void MetricsServiceAccessor::RemoveMetricsServiceObserver(
20    MetricsServiceObserver* observer) {
21  MetricsService* metrics_service = g_browser_process->metrics_service();
22  if (metrics_service)
23    metrics_service->RemoveObserver(observer);
24}
25