Chromium Code Reviews| 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
|
gab
2012/04/27 20:58:45
Removed this too.
| |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/string16.h" | |
| 16 #include "base/version.h" | 17 #include "base/version.h" |
| 17 #include "chrome/installer/util/util_constants.h" | 18 #include "chrome/installer/util/util_constants.h" |
| 18 | 19 |
| 19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 20 #include <windows.h> // NOLINT | 21 #include <windows.h> // NOLINT |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace installer { | 24 namespace installer { |
| 24 class Product; | 25 class Product; |
| 25 } | 26 } |
| 26 | 27 |
| 27 class BrowserDistribution { | 28 class BrowserDistribution { |
| 28 public: | 29 public: |
| 29 enum Type { | 30 enum Type { |
| 30 CHROME_BROWSER, | 31 CHROME_BROWSER, |
| 31 CHROME_FRAME, | 32 CHROME_FRAME, |
| 32 CHROME_BINARIES, | 33 CHROME_BINARIES, |
| 33 NUM_TYPES | 34 NUM_TYPES |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 // A struct for communicating what a UserExperiment contains. In these | 37 // 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 // experiments we show toasts to the user if they are inactive for a certain |
| 38 // amount of time. | 39 // amount of time. |
| 39 struct UserExperiment { | 40 struct UserExperiment { |
| 40 std::wstring prefix; // The experiment code prefix for this experiment, | 41 string16 prefix; // The experiment code prefix for this experiment, |
|
grt (UTC plus 2)
2012/04/27 18:23:07
fix comment indentation
gab
2012/04/27 20:58:45
Done.
| |
| 41 // also known as the 'TV' part in 'TV80'. | 42 // also known as the 'TV' part in 'TV80'. |
| 42 int flavor; // The flavor index for this experiment. | 43 int flavor; // The flavor index for this experiment. |
| 43 int heading; // The heading resource ID to use for this experiment. | 44 int heading; // The heading resource ID to use for this experiment. |
| 44 bool compact_bubble; // Whether to show the compact heading or not. | 45 bool compact_bubble; // Whether to show the compact heading or not. |
| 45 int control_group; // Size of the control group (in percentages). Control | 46 int control_group; // Size of the control group (in percentages). Control |
| 46 // group is the group that qualifies for the | 47 // group is the group that qualifies for the |
| 47 // experiment but does not participate. | 48 // experiment but does not participate. |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // An array of the Types representing products; | 51 // An array of the Types representing products; |
| 51 static const Type kProductTypes[]; | 52 static const Type kProductTypes[]; |
| 52 | 53 |
| 53 // The number of elements in the array |kProductTypes|. | 54 // The number of elements in the array |kProductTypes|. |
| 54 static const size_t kNumProductTypes; | 55 static const size_t kNumProductTypes; |
| 55 | 56 |
| 56 virtual ~BrowserDistribution() {} | 57 virtual ~BrowserDistribution() {} |
| 57 | 58 |
| 58 static BrowserDistribution* GetDistribution(); | 59 static BrowserDistribution* GetDistribution(); |
| 59 | 60 |
| 60 static BrowserDistribution* GetSpecificDistribution(Type type); | 61 static BrowserDistribution* GetSpecificDistribution(Type type); |
| 61 | 62 |
| 62 Type GetType() const { return type_; } | 63 Type GetType() const { return type_; } |
| 63 | 64 |
| 64 virtual void DoPostUninstallOperations(const Version& version, | 65 virtual void DoPostUninstallOperations(const Version& version, |
| 65 const FilePath& local_data_path, | 66 const FilePath& local_data_path, |
| 66 const std::wstring& distribution_data); | 67 const string16& distribution_data); |
| 67 | 68 |
| 68 virtual std::wstring GetAppGuid(); | 69 virtual string16 GetAppGuid(); |
| 69 | 70 |
| 70 // Returns the name by which the program is registered with Default Programs. | 71 // Returns the name by which the program is registered with Default Programs. |
| 71 // This is not a localized string suitable for presenting to a user. | 72 // This is not a localized string suitable for presenting to a user. |
| 72 virtual std::wstring GetApplicationName(); | 73 virtual string16 GetApplicationName(); |
| 73 | 74 |
| 74 // Returns the localized name of the program. | 75 // Returns the localized name of the program. |
| 75 virtual std::wstring GetAppShortCutName(); | 76 virtual string16 GetAppShortCutName(); |
| 76 | 77 |
| 77 virtual std::wstring GetAlternateApplicationName(); | 78 virtual string16 GetAlternateApplicationName(); |
| 78 | 79 |
| 79 virtual std::wstring GetBrowserAppId(); | 80 virtual string16 GetBrowserAppId(); |
| 80 | 81 |
| 81 virtual std::wstring GetInstallSubDir(); | 82 virtual string16 GetInstallSubDir(); |
| 82 | 83 |
| 83 virtual std::wstring GetPublisherName(); | 84 virtual string16 GetPublisherName(); |
| 84 | 85 |
| 85 virtual std::wstring GetAppDescription(); | 86 virtual string16 GetAppDescription(); |
| 86 | 87 |
| 87 virtual std::wstring GetLongAppDescription(); | 88 virtual string16 GetLongAppDescription(); |
| 88 | 89 |
| 89 virtual std::string GetSafeBrowsingName(); | 90 virtual std::string GetSafeBrowsingName(); |
| 90 | 91 |
| 91 virtual std::wstring GetStateKey(); | 92 virtual string16 GetStateKey(); |
| 92 | 93 |
| 93 virtual std::wstring GetStateMediumKey(); | 94 virtual string16 GetStateMediumKey(); |
| 94 | 95 |
| 95 virtual std::wstring GetStatsServerURL(); | 96 virtual string16 GetStatsServerURL(); |
| 96 | 97 |
| 97 virtual std::string GetNetworkStatsServer() const; | 98 virtual std::string GetNetworkStatsServer() const; |
| 98 | 99 |
| 99 virtual std::string GetHttpPipeliningTestServer() const; | 100 virtual std::string GetHttpPipeliningTestServer() const; |
| 100 | 101 |
| 101 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 102 virtual std::wstring GetDistributionData(HKEY root_key); | 103 virtual string16 GetDistributionData(HKEY root_key); |
| 103 #endif | 104 #endif |
| 104 | 105 |
| 105 virtual std::wstring GetUninstallLinkName(); | 106 virtual string16 GetUninstallLinkName(); |
| 106 | 107 |
| 107 virtual std::wstring GetUninstallRegPath(); | 108 virtual string16 GetUninstallRegPath(); |
| 108 | 109 |
| 109 virtual std::wstring GetVersionKey(); | 110 virtual string16 GetVersionKey(); |
| 110 | 111 |
| 111 virtual bool CanSetAsDefault(); | 112 virtual bool CanSetAsDefault(); |
| 112 | 113 |
| 113 virtual bool CanCreateDesktopShortcuts(); | 114 virtual bool CanCreateDesktopShortcuts(); |
| 114 | 115 |
| 115 virtual int GetIconIndex(); | 116 virtual int GetIconIndex(); |
| 116 | 117 |
| 117 virtual bool GetChromeChannel(std::wstring* channel); | 118 virtual bool GetChromeChannel(string16* channel); |
| 118 | 119 |
| 119 // Returns true if the distribution includes a DelegateExecute verb handler, | 120 // Returns true if the distribution includes a DelegateExecute verb handler, |
| 120 // and provides the COM registration data if so: | 121 // and provides the COM registration data if so: |
| 121 // |handler_class_uuid| is the CommandExecuteImpl class UUID. | 122 // |handler_class_uuid| is the CommandExecuteImpl class UUID. |
| 122 // |type_lib_uuid| and |type_lib_version| identify its type library. | 123 // |type_lib_uuid| and |type_lib_version| identify its type library. |
| 123 // |interface_uuid| is the ICommandExecuteImpl interface UUID. | 124 // |interface_uuid| is the ICommandExecuteImpl interface UUID. |
| 124 // Only non-null parameters will be set, others will be ignored. | 125 // Only non-null parameters will be set, others will be ignored. |
| 125 // Implementations that only provide a DelegateExecute handler for use on | 126 // Implementations that only provide a DelegateExecute handler for use on |
| 126 // certain OS versions must only return true when run on those supported | 127 // certain OS versions must only return true when run on those supported |
| 127 // systems. | 128 // systems. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 145 // sets the wheels in motion or in simple cases does the experiment itself. | 146 // sets the wheels in motion or in simple cases does the experiment itself. |
| 146 virtual void LaunchUserExperiment(const FilePath& setup_path, | 147 virtual void LaunchUserExperiment(const FilePath& setup_path, |
| 147 installer::InstallStatus status, | 148 installer::InstallStatus status, |
| 148 const Version& version, | 149 const Version& version, |
| 149 const installer::Product& product, | 150 const installer::Product& product, |
| 150 bool system_level); | 151 bool system_level); |
| 151 | 152 |
| 152 // The user has qualified for the inactive user toast experiment and this | 153 // The user has qualified for the inactive user toast experiment and this |
| 153 // function just performs it. | 154 // function just performs it. |
| 154 virtual void InactiveUserToastExperiment(int flavor, | 155 virtual void InactiveUserToastExperiment(int flavor, |
| 155 const std::wstring& experiment_group, | 156 const string16& experiment_group, |
| 156 const installer::Product& installation, | 157 const installer::Product& installation, |
| 157 const FilePath& application_path); | 158 const FilePath& application_path); |
| 158 | 159 |
| 159 protected: | 160 protected: |
| 160 explicit BrowserDistribution(Type type); | 161 explicit BrowserDistribution(Type type); |
| 161 | 162 |
| 162 template<class DistributionClass> | 163 template<class DistributionClass> |
| 163 static BrowserDistribution* GetOrCreateBrowserDistribution( | 164 static BrowserDistribution* GetOrCreateBrowserDistribution( |
| 164 BrowserDistribution** dist); | 165 BrowserDistribution** dist); |
| 165 | 166 |
| 166 const Type type_; | 167 const Type type_; |
| 167 | 168 |
| 168 private: | 169 private: |
| 169 BrowserDistribution(); | 170 BrowserDistribution(); |
| 170 | 171 |
| 171 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); | 172 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ | 175 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ |
| OLD | NEW |