chromium/content/browser/field_trial_synchronizer.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_FIELD_TRIAL_SYNCHRONIZER_H_
#define CONTENT_BROWSER_FIELD_TRIAL_SYNCHRONIZER_H_

#include <string>
#include <vector>

#include "base/metrics/field_trial.h"
#include "components/variations/variations_ids_provider.h"

namespace content {
class RenderProcessHost;

// This class is used by the browser process to communicate FieldTrial setting
// (field trial name and group) and Variation header to any previously started
// renderers.
//
// This class registers itself as an observer of FieldTrialList. FieldTrialList
// notifies this class by calling its OnFieldTrialGroupFinalized method when a
// group is selected (finalized) for a FieldTrial and OnFieldTrialGroupFinalized
// method sends the FieldTrial's name and the group to all renderer processes.
// Each renderer process creates the FieldTrial, and by using a 100% probability
// for the FieldTrial, forces the FieldTrial to have the same group string. This
// is mostly an optimization so that renderers don't send anything to the
// browser when they know that a trial is already active.
//
// This class also registers itself as a VariationsIdsProvider Observer and
// updates the renderers if the variations header changes.
class FieldTrialSynchronizer
    : public base::FieldTrialList::Observer,
      public variations::VariationsIdsProvider::Observer {};

}  // namespace content

#endif  // CONTENT_BROWSER_FIELD_TRIAL_SYNCHRONIZER_H_