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 #ifndef CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "chrome/browser/extensions/crx_installer_error.h" | 15 #include "chrome/browser/extensions/crx_installer_error.h" |
| 16 #include "chrome/browser/extensions/extension_install_prompt.h" | 16 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 17 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 17 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
| 18 #include "chrome/browser/extensions/webstore_installer.h" | 18 #include "chrome/browser/extensions/webstore_installer.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/web_apps.h" | 20 #include "chrome/common/web_apps.h" |
| 21 #include "sync/api/string_ordinal.h" | 21 #include "sync/api/string_ordinal.h" |
| 22 | 22 |
| 23 #if defined(OS_WIN) | |
| 24 #include "chrome/browser/extensions/app_host_installer_win.h" | |
| 25 #endif | |
| 26 | |
| 23 class ExtensionService; | 27 class ExtensionService; |
| 24 class SkBitmap; | 28 class SkBitmap; |
| 25 | 29 |
| 26 namespace extensions { | 30 namespace extensions { |
| 27 class ExtensionUpdaterTest; | 31 class ExtensionUpdaterTest; |
| 28 class RequirementsChecker; | 32 class RequirementsChecker; |
| 29 | 33 |
| 30 // This class installs a crx file into a profile. | 34 // This class installs a crx file into a profile. |
| 31 // | 35 // |
| 32 // Installing a CRX is a multi-step process, including unpacking the crx, | 36 // Installing a CRX is a multi-step process, including unpacking the crx, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 // Called on the UI thread to start the requirements check on the extension. | 211 // Called on the UI thread to start the requirements check on the extension. |
| 208 void CheckRequirements(); | 212 void CheckRequirements(); |
| 209 | 213 |
| 210 // Runs on the UI thread. Callback from RequirementsChecker. | 214 // Runs on the UI thread. Callback from RequirementsChecker. |
| 211 void OnRequirementsChecked(std::vector<std::string> requirement_errors); | 215 void OnRequirementsChecked(std::vector<std::string> requirement_errors); |
| 212 | 216 |
| 213 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) | 217 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) |
| 214 // that it is OK to install this extension. | 218 // that it is OK to install this extension. |
| 215 void ConfirmInstall(); | 219 void ConfirmInstall(); |
| 216 | 220 |
| 217 // Runs on File thread. Install the unpacked extension into the profile and | 221 // Runs on File thread. Ensures that App Host is installed, and then |
| 218 // notify the frontend. | 222 // proceeds to post CompleteExtensionInstall(). |
| 219 void CompleteInstall(); | 223 void CompleteInstall(); |
| 220 | 224 |
| 225 // Runs on File thread. Installs the unpacked extension into the profile and | |
| 226 // notifies the frontend. | |
| 227 void CompleteExtensionInstall(); | |
|
benwells
2012/10/03 05:08:43
Please come up with a better name for this functio
erikwright (departed)
2012/10/03 15:58:35
Naming is hell.
How about
CompleteInstall->Begin
huangs
2012/10/03 20:09:47
Done.
huangs
2012/10/03 20:09:47
Done.
| |
| 228 | |
| 229 #if defined(OS_WIN) | |
| 230 void OnAppHostInstallFailure(); | |
| 231 #endif | |
| 232 | |
| 221 // Result reporting. | 233 // Result reporting. |
| 222 void ReportFailureFromFileThread(const CrxInstallerError& error); | 234 void ReportFailureFromFileThread(const CrxInstallerError& error); |
| 223 void ReportFailureFromUIThread(const CrxInstallerError& error); | 235 void ReportFailureFromUIThread(const CrxInstallerError& error); |
| 224 void ReportSuccessFromFileThread(); | 236 void ReportSuccessFromFileThread(); |
| 225 void ReportSuccessFromUIThread(); | 237 void ReportSuccessFromUIThread(); |
| 226 void NotifyCrxInstallComplete(const Extension* extension); | 238 void NotifyCrxInstallComplete(const Extension* extension); |
| 227 | 239 |
| 228 // The file we're installing. | 240 // The file we're installing. |
| 229 FilePath source_file_; | 241 FilePath source_file_; |
| 230 | 242 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 | 364 |
| 353 // Whether we should produce an error if the manifest declares requirements | 365 // Whether we should produce an error if the manifest declares requirements |
| 354 // that are not met. If false and there is an unmet requirement, the install | 366 // that are not met. If false and there is an unmet requirement, the install |
| 355 // will continue but the extension will be distabled. | 367 // will continue but the extension will be distabled. |
| 356 bool error_on_unsupported_requirements_; | 368 bool error_on_unsupported_requirements_; |
| 357 | 369 |
| 358 scoped_ptr<RequirementsChecker> requirements_checker_; | 370 scoped_ptr<RequirementsChecker> requirements_checker_; |
| 359 | 371 |
| 360 bool has_requirement_errors_; | 372 bool has_requirement_errors_; |
| 361 | 373 |
| 374 #if defined(OS_WIN) | |
| 375 AppHostInstaller app_host_installer_; | |
| 376 #endif | |
| 377 | |
| 362 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 378 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 363 }; | 379 }; |
| 364 | 380 |
| 365 } // namespace extensions | 381 } // namespace extensions |
| 366 | 382 |
| 367 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 383 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |