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

Side by Side Diff: chrome/installer/util/browser_distribution.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: Stylistic changes; eliminating UserExperiment class in favour of namespace. Created 7 years, 10 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file declares a class that contains various method related to branding. 5 // This file declares a class that contains various method related to branding.
6 6
7 #ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 7 #ifndef CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
8 #define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 8 #define CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/version.h" 15 #include "base/version.h"
16 #include "chrome/installer/util/util_constants.h" 16 #include "chrome/installer/util/util_constants.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #include <windows.h> // NOLINT 19 #include <windows.h> // NOLINT
20 #endif 20 #endif
21 21
22 namespace installer {
23 class Product;
24 }
25
26 class BrowserDistribution { 22 class BrowserDistribution {
27 public: 23 public:
28 enum Type { 24 enum Type {
29 CHROME_BROWSER, 25 CHROME_BROWSER,
30 CHROME_FRAME, 26 CHROME_FRAME,
31 CHROME_BINARIES, 27 CHROME_BINARIES,
32 CHROME_APP_HOST, 28 CHROME_APP_HOST,
33 NUM_TYPES 29 NUM_TYPES
34 }; 30 };
35 31
36 // Flags to control what to show in the UserExperiment dialog.
37 enum ToastUIflags {
38 kUninstall = 1, // Uninstall radio button.
39 kDontBugMeAsButton = 2, // Don't bug me is a button, not a radio button.
40 kWhyLink = 4, // Has the 'why I am seeing this' link.
41 kMakeDefault = 8 // Has the 'make it default' checkbox.
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 UserExperiment {
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 virtual ~BrowserDistribution() {} 32 virtual ~BrowserDistribution() {}
59 33
60 static BrowserDistribution* GetDistribution(); 34 static BrowserDistribution* GetDistribution();
61 35
62 static BrowserDistribution* GetSpecificDistribution(Type type); 36 static BrowserDistribution* GetSpecificDistribution(Type type);
63 37
64 Type GetType() const { return type_; } 38 Type GetType() const { return type_; }
65 39
66 virtual void DoPostUninstallOperations(const Version& version, 40 virtual void DoPostUninstallOperations(const Version& version,
67 const base::FilePath& local_data_path, 41 const base::FilePath& local_data_path,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // non-NULL. 112 // non-NULL.
139 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid); 113 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid);
140 114
141 // Returns true if this distribution uses app_host.exe to run platform apps. 115 // Returns true if this distribution uses app_host.exe to run platform apps.
142 virtual bool AppHostIsSupported(); 116 virtual bool AppHostIsSupported();
143 117
144 virtual void UpdateInstallStatus(bool system_install, 118 virtual void UpdateInstallStatus(bool system_install,
145 installer::ArchiveType archive_type, 119 installer::ArchiveType archive_type,
146 installer::InstallStatus install_status); 120 installer::InstallStatus install_status);
147 121
148 // Gets the experiment details for a given language-brand combo. If |flavor|
149 // is -1, then a flavor will be selected at random. |experiment| is the struct
150 // you want to write the experiment information to. Returns false if no
151 // experiment details could be gathered.
152 virtual bool GetExperimentDetails(UserExperiment* experiment, int flavor);
153
154 // After an install or upgrade the user might qualify to participate in an
155 // experiment. This function determines if the user qualifies and if so it
156 // sets the wheels in motion or in simple cases does the experiment itself.
157 virtual void LaunchUserExperiment(const base::FilePath& setup_path,
158 installer::InstallStatus status,
159 const Version& version,
160 const installer::Product& product,
161 bool system_level);
162
163 // The user has qualified for the inactive user toast experiment and this
164 // function just performs it.
165 virtual void InactiveUserToastExperiment(int flavor,
166 const string16& experiment_group,
167 const installer::Product& installation,
168 const base::FilePath& application_path);
169
170 // Returns true if this distribution should set the Omaha experiment_labels 122 // Returns true if this distribution should set the Omaha experiment_labels
171 // registry value. 123 // registry value.
172 virtual bool ShouldSetExperimentLabels(); 124 virtual bool ShouldSetExperimentLabels();
173 125
174 protected: 126 protected:
175 explicit BrowserDistribution(Type type); 127 explicit BrowserDistribution(Type type);
176 128
177 template<class DistributionClass> 129 template<class DistributionClass>
178 static BrowserDistribution* GetOrCreateBrowserDistribution( 130 static BrowserDistribution* GetOrCreateBrowserDistribution(
179 BrowserDistribution** dist); 131 BrowserDistribution** dist);
180 132
181 const Type type_; 133 const Type type_;
182 134
183 private: 135 private:
184 BrowserDistribution(); 136 BrowserDistribution();
185 137
186 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); 138 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution);
187 }; 139 };
188 140
189 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ 141 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698