OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
6 #define CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 6 #define CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 Operation operation() const { return operation_; } | 98 Operation operation() const { return operation_; } |
99 | 99 |
100 // A convenience method returning level() == SYSTEM_LEVEL. | 100 // A convenience method returning level() == SYSTEM_LEVEL. |
101 // TODO(grt): Eradicate the bool in favor of the enum. | 101 // TODO(grt): Eradicate the bool in favor of the enum. |
102 bool system_install() const; | 102 bool system_install() const; |
103 | 103 |
104 // A convenience method returning package_type() == MULTI_PACKAGE. | 104 // A convenience method returning package_type() == MULTI_PACKAGE. |
105 // TODO(grt): Eradicate the bool in favor of the enum. | 105 // TODO(grt): Eradicate the bool in favor of the enum. |
106 bool is_multi_install() const; | 106 bool is_multi_install() const; |
107 | 107 |
| 108 // Returns whether or not there is currently a Chrome Frame instance running. |
| 109 // Note that there isn't a mechanism to lock Chrome Frame in place, so Chrome |
| 110 // Frame may either exit or start up after this is called. |
| 111 bool is_chrome_frame_running() const { return is_chrome_frame_running_; } |
| 112 |
108 // The full path to the place where the operand resides. | 113 // The full path to the place where the operand resides. |
109 const FilePath& target_path() const { return target_path_; } | 114 const FilePath& target_path() const { return target_path_; } |
110 | 115 |
111 // True if the "msi" preference is set or if a product with the "msi" state | 116 // True if the "msi" preference is set or if a product with the "msi" state |
112 // flag is set is to be operated on. | 117 // flag is set is to be operated on. |
113 bool is_msi() const { return msi_; } | 118 bool is_msi() const { return msi_; } |
114 | 119 |
115 // True if the --verbose-logging command-line flag is set or if the | 120 // True if the --verbose-logging command-line flag is set or if the |
116 // verbose_logging master preferences option is true. | 121 // verbose_logging master preferences option is true. |
117 bool verbose_logging() const { return verbose_logging_; } | 122 bool verbose_logging() const { return verbose_logging_; } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // (FAILED_CUSTOM_ERROR) depending on whether |status| maps to success or not. | 178 // (FAILED_CUSTOM_ERROR) depending on whether |status| maps to success or not. |
174 // |status| itself is written to the InstallerError value. | 179 // |status| itself is written to the InstallerError value. |
175 // |string_resource_id|, if non-zero, identifies a localized string written to | 180 // |string_resource_id|, if non-zero, identifies a localized string written to |
176 // the InstallerResultUIString value. |launch_cmd|, if non-NULL and | 181 // the InstallerResultUIString value. |launch_cmd|, if non-NULL and |
177 // non-empty, is written to the InstallerSuccessLaunchCmdLine value. | 182 // non-empty, is written to the InstallerSuccessLaunchCmdLine value. |
178 void WriteInstallerResult(InstallStatus status, | 183 void WriteInstallerResult(InstallStatus status, |
179 int string_resource_id, | 184 int string_resource_id, |
180 const std::wstring* launch_cmd) const; | 185 const std::wstring* launch_cmd) const; |
181 | 186 |
182 protected: | 187 protected: |
| 188 static bool IsFileInUse(const FilePath& file); |
| 189 |
183 FilePath GetDefaultProductInstallPath(BrowserDistribution* dist) const; | 190 FilePath GetDefaultProductInstallPath(BrowserDistribution* dist) const; |
184 bool CanAddProduct(const Product& product, const FilePath* product_dir) const; | 191 bool CanAddProduct(const Product& product, const FilePath* product_dir) const; |
185 Product* AddProductInDirectory(const FilePath* product_dir, | 192 Product* AddProductInDirectory(const FilePath* product_dir, |
186 scoped_ptr<Product>* product); | 193 scoped_ptr<Product>* product); |
187 Product* AddProductFromPreferences( | 194 Product* AddProductFromPreferences( |
188 BrowserDistribution::Type distribution_type, | 195 BrowserDistribution::Type distribution_type, |
189 const MasterPreferences& prefs, | 196 const MasterPreferences& prefs, |
190 const InstallationState& machine_state); | 197 const InstallationState& machine_state); |
191 bool IsMultiInstallUpdate(const MasterPreferences& prefs, | 198 bool IsMultiInstallUpdate(const MasterPreferences& prefs, |
192 const InstallationState& machine_state); | 199 const InstallationState& machine_state); |
| 200 bool DetectChromeFrameInUse(const InstallationState& machine_state); |
193 | 201 |
194 // Sets this object's level and updates the root_key_ accordingly. | 202 // Sets this object's level and updates the root_key_ accordingly. |
195 void set_level(Level level); | 203 void set_level(Level level); |
196 | 204 |
197 // Sets this object's package type and updates the multi_package_distribution_ | 205 // Sets this object's package type and updates the multi_package_distribution_ |
198 // accordingly. | 206 // accordingly. |
199 void set_package_type(PackageType type); | 207 void set_package_type(PackageType type); |
200 | 208 |
201 Operation operation_; | 209 Operation operation_; |
202 FilePath target_path_; | 210 FilePath target_path_; |
203 std::wstring state_key_; | 211 std::wstring state_key_; |
204 BrowserDistribution::Type state_type_; | 212 BrowserDistribution::Type state_type_; |
205 ScopedVector<Product> products_; | 213 ScopedVector<Product> products_; |
206 BrowserDistribution* multi_package_distribution_; | 214 BrowserDistribution* multi_package_distribution_; |
207 Level level_; | 215 Level level_; |
208 PackageType package_type_; | 216 PackageType package_type_; |
209 #if defined(OS_WIN) | 217 #if defined(OS_WIN) |
210 HKEY root_key_; | 218 HKEY root_key_; |
211 #endif | 219 #endif |
212 bool msi_; | 220 bool msi_; |
213 bool verbose_logging_; | 221 bool verbose_logging_; |
| 222 bool is_chrome_frame_running_; |
214 | 223 |
215 private: | 224 private: |
216 DISALLOW_COPY_AND_ASSIGN(InstallerState); | 225 DISALLOW_COPY_AND_ASSIGN(InstallerState); |
217 }; // class InstallerState | 226 }; // class InstallerState |
218 | 227 |
219 } // namespace installer | 228 } // namespace installer |
220 | 229 |
221 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 230 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
OLD | NEW |