OLD | NEW |
---|---|
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 #include <vector> | |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/string16.h" | 15 #include "base/string16.h" |
15 #include "base/version.h" | 16 #include "base/version.h" |
16 #include "chrome/installer/util/util_constants.h" | 17 #include "chrome/installer/util/util_constants.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include <windows.h> // NOLINT | 20 #include <windows.h> // NOLINT |
20 #endif | 21 #endif |
21 | 22 |
22 namespace installer { | |
23 class Product; | |
24 } | |
25 | |
26 class BrowserDistribution { | 23 class BrowserDistribution { |
27 public: | 24 public: |
28 enum Type { | 25 enum Type { |
29 CHROME_BROWSER, | 26 CHROME_BROWSER, |
30 CHROME_FRAME, | 27 CHROME_FRAME, |
31 CHROME_BINARIES, | 28 CHROME_BINARIES, |
32 CHROME_APP_HOST, | 29 CHROME_APP_HOST, |
33 NUM_TYPES | 30 NUM_TYPES |
34 }; | 31 }; |
35 | 32 |
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() {} | 33 virtual ~BrowserDistribution() {} |
59 | 34 |
60 static BrowserDistribution* GetDistribution(); | 35 static BrowserDistribution* GetDistribution(); |
61 | 36 |
62 static BrowserDistribution* GetSpecificDistribution(Type type); | 37 static BrowserDistribution* GetSpecificDistribution(Type type); |
63 | 38 |
64 Type GetType() const { return type_; } | 39 Type GetType() const { return type_; } |
65 | 40 |
66 virtual void DoPostUninstallOperations(const Version& version, | 41 virtual void DoPostUninstallOperations(const Version& version, |
67 const base::FilePath& local_data_path, | 42 const base::FilePath& local_data_path, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 virtual std::string GetHttpPipeliningTestServer() const; | 86 virtual std::string GetHttpPipeliningTestServer() const; |
112 | 87 |
113 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
114 virtual string16 GetDistributionData(HKEY root_key); | 89 virtual string16 GetDistributionData(HKEY root_key); |
115 #endif | 90 #endif |
116 | 91 |
117 virtual string16 GetUninstallLinkName(); | 92 virtual string16 GetUninstallLinkName(); |
118 | 93 |
119 virtual string16 GetUninstallRegPath(); | 94 virtual string16 GetUninstallRegPath(); |
120 | 95 |
96 // Returns the path(s) to the directory that holds the user data (primary, | |
97 // and alterante if applicable). This is always inside a user's | |
98 // local application data folder (e.g., "AppData\Local or "Local | |
99 // Settings\Application Data" in %USERPROFILE%). Note that these are the | |
100 // defaults and do not take into account that they can be overriden with a | |
101 // command line parameter. |paths| may be empty on return, but is guaranteed | |
102 // not to contain empty paths otherwise. If more than one path is returned, | |
103 // they are guaranteed to be siblings. | |
104 virtual void GetUserDataPaths(std::vector<base::FilePath>* paths); | |
105 | |
121 virtual string16 GetVersionKey(); | 106 virtual string16 GetVersionKey(); |
122 | 107 |
123 virtual bool CanSetAsDefault(); | 108 virtual bool CanSetAsDefault(); |
124 | 109 |
125 virtual bool CanCreateDesktopShortcuts(); | 110 virtual bool CanCreateDesktopShortcuts(); |
126 | 111 |
127 // Returns the executable filename (not path) that contains the product icon. | 112 // Returns the executable filename (not path) that contains the product icon. |
128 virtual string16 GetIconFilename(); | 113 virtual string16 GetIconFilename(); |
129 | 114 |
130 // Returns the index of the icon for the product, inside the file specified by | 115 // Returns the index of the icon for the product, inside the file specified by |
131 // GetIconFilename(). | 116 // GetIconFilename(). |
132 virtual int GetIconIndex(); | 117 virtual int GetIconIndex(); |
133 | 118 |
134 virtual bool GetChromeChannel(string16* channel); | 119 virtual bool GetChromeChannel(string16* channel); |
135 | 120 |
136 // Returns true if this distribution includes a DelegateExecute verb handler, | 121 // Returns true if this distribution includes a DelegateExecute verb handler, |
137 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is | 122 // and provides the CommandExecuteImpl class UUID if |handler_class_uuid| is |
138 // non-NULL. | 123 // non-NULL. |
139 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid); | 124 virtual bool GetCommandExecuteImplClsid(string16* handler_class_uuid); |
140 | 125 |
141 // Returns true if this distribution uses app_host.exe to run platform apps. | 126 // Returns true if this distribution uses app_host.exe to run platform apps. |
142 virtual bool AppHostIsSupported(); | 127 virtual bool AppHostIsSupported(); |
143 | 128 |
144 virtual void UpdateInstallStatus(bool system_install, | 129 virtual void UpdateInstallStatus(bool system_install, |
145 installer::ArchiveType archive_type, | 130 installer::ArchiveType archive_type, |
146 installer::InstallStatus install_status); | 131 installer::InstallStatus install_status); |
147 | 132 |
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 | 133 // Returns true if this distribution should set the Omaha experiment_labels |
171 // registry value. | 134 // registry value. |
172 virtual bool ShouldSetExperimentLabels(); | 135 virtual bool ShouldSetExperimentLabels(); |
173 | 136 |
137 virtual bool HasUserExperiments() const; | |
grt (UTC plus 2)
2013/03/12 14:32:18
although it pains me to say it, un-constify this f
huangs
2013/03/12 18:03:07
Done.
| |
138 | |
174 protected: | 139 protected: |
175 explicit BrowserDistribution(Type type); | 140 explicit BrowserDistribution(Type type); |
176 | 141 |
177 template<class DistributionClass> | 142 template<class DistributionClass> |
178 static BrowserDistribution* GetOrCreateBrowserDistribution( | 143 static BrowserDistribution* GetOrCreateBrowserDistribution( |
179 BrowserDistribution** dist); | 144 BrowserDistribution** dist); |
180 | 145 |
181 const Type type_; | 146 const Type type_; |
182 | 147 |
183 private: | 148 private: |
184 BrowserDistribution(); | 149 BrowserDistribution(); |
185 | 150 |
186 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); | 151 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); |
187 }; | 152 }; |
188 | 153 |
189 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ | 154 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ |
OLD | NEW |