blob: 7883f7310f0cfa68100865cbc1957c6f66c40942 [file] [log] [blame]
[email protected]7edd78cd2014-05-23 22:31:451// 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#ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_
6#define CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_
7
[email protected]bb5d1892014-08-06 06:03:228#include <stdint.h>
[email protected]0129c272014-08-02 00:35:179#include <string>
10
[email protected]7edd78cd2014-05-23 22:31:4511#include "base/macros.h"
12
[email protected]0129c272014-08-02 00:35:1713class MetricsService;
[email protected]7edd78cd2014-05-23 22:31:4514class MetricsServiceObserver;
15
16// This class limits and documents access to metrics service helper methods.
17// These methods are protected so each user has to inherit own program-specific
18// specialization and enable access there by declaring friends.
19class MetricsServiceAccessor {
20 protected:
21 // Constructor declared as protected to enable inheritance. Decendants should
22 // disallow instantiation.
23 MetricsServiceAccessor() {}
24
25 // Registers/unregisters |observer| to receive MetricsLog notifications
26 // from metrics service.
27 static void AddMetricsServiceObserver(MetricsServiceObserver* observer);
28 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer);
29
[email protected]bb5d1892014-08-06 06:03:2230 // Registers the specified synthetic field trial (identified by a hash of the
31 // trial name and group name) with |metrics_service|, if the service is not
32 // NULL, returning true on success.
33 // See the comment on MetricsService::RegisterSyntheticFieldTrial for details.
[email protected]0129c272014-08-02 00:35:1734 static bool RegisterSyntheticFieldTrial(MetricsService* metrics_service,
[email protected]bb5d1892014-08-06 06:03:2235 uint32_t trial_name_hash,
36 uint32_t group_name_hash);
[email protected]0129c272014-08-02 00:35:1737
[email protected]7edd78cd2014-05-23 22:31:4538 private:
39 DISALLOW_COPY_AND_ASSIGN(MetricsServiceAccessor);
40};
41
42#endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_ACCESSOR_H_