metrics_service_accessor.cc revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file.
4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/metrics/metrics_service_accessor.h"
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
7f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "components/metrics/metrics_service.h"
8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// TODO(asvitkine): Remove when this class is moved to metrics namespace.
101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciusing metrics::MetricsService;
111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciusing metrics::SyntheticTrialGroup;
125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// static
145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)bool MetricsServiceAccessor::RegisterSyntheticFieldTrial(
155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    MetricsService* metrics_service,
165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    uint32_t trial_name_hash,
175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    uint32_t group_name_hash) {
185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  if (!metrics_service)
195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    return false;
205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  SyntheticTrialGroup trial_group(trial_name_hash, group_name_hash);
225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  metrics_service->RegisterSyntheticFieldTrial(trial_group);
235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  return true;
245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}
25