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