summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant/instant_field_trial.h
blob: e4149bcd96d2368e2a0e7078dde3b32956a2a0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_
#define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_

#include <string>

#include "base/basictypes.h"

class Profile;

// This class manages the Instant field trial. Each user is in exactly one of
// three field trial groups: Inactive, Control or Experiment.
// - Inactive users are those who have played with the Instant option in the
//   Preferences page, or those for whom group policy provides an override, or
//   those with an incognito profile, etc. The field trial is inactive for such
//   users, so their Instant preference setting is respected.
// - Control and Experiment are all the other users, i.e., those who have never
//   touched the Preferences option. Some percentage of these users are chosen
//   into the Experiment group and get Instant enabled automatically. The rest
//   fall into the Control group; for them, Instant remains disabled by default.
// - Control and Experiment are further split into two subgroups each, in order
//   to detect bias between them (when analyzing metrics). The subgroups are
//   treated identically for all other purposes.
class InstantFieldTrial {
 public:
  enum Group {
    INACTIVE,
    CONTROL1,
    CONTROL2,
    EXPERIMENT1,
    EXPERIMENT2,
  };
  static Group GetGroup(Profile* profile);

  // Check if the group is either of the two experiment subgroups.
  static bool IsExperimentGroup(Profile* profile);

  // Returns a string describing the user's group. Can be added to histogram
  // names, to split histograms by field trial groups.
  static std::string GetGroupName(Profile* profile);

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial);
};

#endif  // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_