OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 // This files declares a class that contains methods and data to conduct |
| 6 // for user expeirments. |
| 7 |
| 8 #ifndef CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_ |
| 9 #define CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_ |
| 10 |
| 11 #include "base/string16.h" |
| 12 #include "chrome/installer/util/browser_distribution.h" |
| 13 #include "chrome/installer/util/util_constants.h" |
| 14 |
| 15 class BrowserDistribution; |
| 16 class Version; |
| 17 |
| 18 namespace base { |
| 19 class FilePath; |
| 20 } |
| 21 |
| 22 namespace installer { |
| 23 |
| 24 class Product; |
| 25 |
| 26 namespace user_experiment { |
| 27 |
| 28 // Flags to control what to show in the UserExperiment dialog. |
| 29 enum ToastUIflags { |
| 30 kUninstall = 1 << 0, // Uninstall radio button. |
| 31 kDontBugMeAsButton = 1 << 1, // This is a button, not a radio button. |
| 32 kWhyLink = 1 << 2, // Has the 'why I am seeing this' link. |
| 33 kMakeDefault = 1 << 3, // Has the 'make it default' checkbox. |
| 34 }; |
| 35 |
| 36 // A struct for communicating what a UserExperiment contains. In these |
| 37 // experiments we show toasts to the user if they are inactive for a certain |
| 38 // amount of time. |
| 39 struct ExperimentDetails { |
| 40 string16 prefix; // The experiment code prefix for this experiment, |
| 41 // also known as the 'TV' part in 'TV80'. |
| 42 int flavor; // The flavor index for this experiment. |
| 43 int heading; // The heading resource ID to use for this experiment. |
| 44 int flags; // See ToastUIFlags above. |
| 45 int control_group; // Size of the control group (in percentages). Control |
| 46 // group is the group that qualifies for the |
| 47 // experiment but does not participate. |
| 48 }; |
| 49 |
| 50 // Creates the experiment details for a given language-brand combo. |
| 51 // If |flavor| is -1, then a flavor will be selected at random. |experiment| |
| 52 // is the struct you want to write the experiment information to. |
| 53 // Returns false if no experiment details could be gathered. |
| 54 bool CreateExperimentDetails(int flavor, |
| 55 ExperimentDetails* experiment); |
| 56 |
| 57 // After an install or upgrade the user might qualify to participate in an |
| 58 // experiment. This function determines if the user qualifies and if so it |
| 59 // sets the wheels in motion or in simple cases does the experiment itself. |
| 60 void LaunchUserExperiment(BrowserDistribution* dist, |
| 61 const base::FilePath& setup_path, |
| 62 InstallStatus status, |
| 63 const Version& version, |
| 64 const Product& product, |
| 65 bool system_level); |
| 66 |
| 67 // The user has qualified for the inactive user toast experiment and this |
| 68 // function just performs it. |
| 69 void InactiveUserToastExperiment(BrowserDistribution* dist, |
| 70 int flavor, |
| 71 const string16& experiment_group, |
| 72 const Product& installation, |
| 73 const base::FilePath& application_path); |
| 74 |
| 75 } // namespace user_experiment |
| 76 |
| 77 } // namespace installer |
| 78 |
| 79 #endif // CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_ |
OLD | NEW |