Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/installer/util/user_experiment.h

Issue 12321061: Pulling user experiment code from BrowserDistribution to a new class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updating .gypi to fix compile error. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 class UserExperiment {
grt (UTC plus 2) 2013/02/26 02:42:09 my apologies for not being clear in my previous re
huangs 2013/02/26 03:22:25 Ah yes, I misread. Done.
29 public:
30
31 enum ExperimentCode {
32 kExperimentAny, // Whether or not any experiment is supported.
33 kExperimentInactiveUserToast,
34 };
35
36 // Flags to control what to show in the UserExperiment dialog.
37 enum ToastUIflags {
38 kUninstall = 1, // Uninstall radio button.
gab 2013/02/25 22:09:53 s/1/1 << 0
huangs 2013/02/26 03:22:25 s/$/\//. :) Done.
39 kDontBugMeAsButton = 2, // Don't bug me is a button, not a radio button.
gab 2013/02/25 22:09:53 s/2/1 << 1
huangs 2013/02/26 03:22:25 Done.
40 kWhyLink = 4, // Has the 'why I am seeing this' link.
gab 2013/02/25 22:09:53 s/4/1 << 2
huangs 2013/02/26 03:22:25 Done.
41 kMakeDefault = 8, // Has the 'make it default' checkbox.
gab 2013/02/25 22:09:53 s/8/1 << 3 This is how bitfields are usually writ
huangs 2013/02/26 03:22:25 Done.
42 };
43
44 // A struct for communicating what a UserExperiment contains. In these
45 // experiments we show toasts to the user if they are inactive for a certain
46 // amount of time.
47 struct ExperimentDetails {
48 string16 prefix; // The experiment code prefix for this experiment,
49 // also known as the 'TV' part in 'TV80'.
50 int flavor; // The flavor index for this experiment.
51 int heading; // The heading resource ID to use for this experiment.
52 int flags; // See ToastUIFlags above.
53 int control_group; // Size of the control group (in percentages). Control
54 // group is the group that qualifies for the
55 // experiment but does not participate.
56 };
57
58 UserExperiment();
59
60 static bool IsExperimentSupported(BrowserDistribution::Type type,
61 ExperimentCode code);
62
63 // Creates the experiment details for a given language-brand combo.
64 // If |flavor| is -1, then a flavor will be selected at random. |experiment|
65 // is the struct you want to write the experiment information to.
66 // Returns false if no experiment details could be gathered.
67 static bool CreateExperimentDetails(int flavor,
68 ExperimentDetails* experiment);
69
70 // After an install or upgrade the user might qualify to participate in an
71 // experiment. This function determines if the user qualifies and if so it
72 // sets the wheels in motion or in simple cases does the experiment itself.
73 static void LaunchUserExperiment(const base::FilePath& setup_path,
74 InstallStatus status,
75 const Version& version,
76 const Product& product,
77 bool system_level);
78
79 // The user has qualified for the inactive user toast experiment and this
80 // function just performs it.
81 static void InactiveUserToastExperiment(
82 BrowserDistribution* dist,
83 int flavor,
84 const string16& experiment_group,
85 const Product& installation,
86 const base::FilePath& application_path);
87
88 };
89
90 } // namespace user_experiment
91
92 } // namespace installer
93
94 #endif // CHROME_INSTALLER_UTIL_USER_EXPERIMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698