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 <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/version.h" | 16 #include "base/version.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/installer/util/util_constants.h" | 18 #include "chrome/installer/util/util_constants.h" |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 #include <windows.h> // NOLINT | 21 #include <windows.h> // NOLINT |
22 #endif | 22 #endif |
23 | 23 |
24 class AppRegistrationData; | 24 class AppRegistrationData; |
25 | 25 |
26 class BrowserDistribution { | 26 class BrowserDistribution { |
27 public: | 27 public: |
28 // TODO(grt): Remove Type. | |
29 enum Type { | |
30 CHROME_BROWSER, | |
31 NUM_TYPES | |
32 }; | |
33 | |
34 enum Subfolder { | 28 enum Subfolder { |
35 SUBFOLDER_CHROME, | 29 SUBFOLDER_CHROME, |
36 SUBFOLDER_APPS, | 30 SUBFOLDER_APPS, |
37 }; | 31 }; |
38 | 32 |
39 enum DefaultBrowserControlPolicy { | 33 enum DefaultBrowserControlPolicy { |
40 DEFAULT_BROWSER_UNSUPPORTED, | 34 DEFAULT_BROWSER_UNSUPPORTED, |
41 DEFAULT_BROWSER_OS_CONTROL_ONLY, | 35 DEFAULT_BROWSER_OS_CONTROL_ONLY, |
42 DEFAULT_BROWSER_FULL_CONTROL | 36 DEFAULT_BROWSER_FULL_CONTROL |
43 }; | 37 }; |
44 | 38 |
45 virtual ~BrowserDistribution(); | 39 virtual ~BrowserDistribution(); |
46 | 40 |
47 static BrowserDistribution* GetDistribution(); | 41 static BrowserDistribution* GetDistribution(); |
48 | 42 |
49 static BrowserDistribution* GetSpecificDistribution(Type type); | |
50 | |
51 Type GetType() const { return type_; } | |
52 | |
53 // Getter and adaptors for the underlying |app_reg_data_|. | 43 // Getter and adaptors for the underlying |app_reg_data_|. |
54 const AppRegistrationData& GetAppRegistrationData() const; | 44 const AppRegistrationData& GetAppRegistrationData() const; |
55 base::string16 GetAppGuid() const; | 45 base::string16 GetAppGuid() const; |
56 base::string16 GetStateKey() const; | 46 base::string16 GetStateKey() const; |
57 base::string16 GetStateMediumKey() const; | 47 base::string16 GetStateMediumKey() const; |
58 base::string16 GetVersionKey() const; | 48 base::string16 GetVersionKey() const; |
59 | 49 |
60 virtual void DoPostUninstallOperations( | 50 virtual void DoPostUninstallOperations( |
61 const base::Version& version, | 51 const base::Version& version, |
62 const base::FilePath& local_data_path, | 52 const base::FilePath& local_data_path, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 installer::ArchiveType archive_type, | 138 installer::ArchiveType archive_type, |
149 installer::InstallStatus install_status); | 139 installer::InstallStatus install_status); |
150 | 140 |
151 // Returns true if this distribution should set the Omaha experiment_labels | 141 // Returns true if this distribution should set the Omaha experiment_labels |
152 // registry value. | 142 // registry value. |
153 virtual bool ShouldSetExperimentLabels(); | 143 virtual bool ShouldSetExperimentLabels(); |
154 | 144 |
155 virtual bool HasUserExperiments(); | 145 virtual bool HasUserExperiments(); |
156 | 146 |
157 protected: | 147 protected: |
158 BrowserDistribution(Type type, | 148 explicit BrowserDistribution( |
159 std::unique_ptr<AppRegistrationData> app_reg_data); | 149 std::unique_ptr<AppRegistrationData> app_reg_data); |
160 | 150 |
161 template<class DistributionClass> | 151 template<class DistributionClass> |
162 static BrowserDistribution* GetOrCreateBrowserDistribution( | 152 static BrowserDistribution* GetOrCreateBrowserDistribution( |
163 BrowserDistribution** dist); | 153 BrowserDistribution** dist); |
164 | 154 |
165 const Type type_; | |
166 | |
167 std::unique_ptr<AppRegistrationData> app_reg_data_; | 155 std::unique_ptr<AppRegistrationData> app_reg_data_; |
168 | 156 |
169 private: | 157 private: |
170 BrowserDistribution(); | 158 BrowserDistribution(); |
171 | 159 |
172 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); | 160 DISALLOW_COPY_AND_ASSIGN(BrowserDistribution); |
173 }; | 161 }; |
174 | 162 |
175 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ | 163 #endif // CHROME_INSTALLER_UTIL_BROWSER_DISTRIBUTION_H_ |
OLD | NEW |