| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // | 60 // |
| 61 // scoped_refptr<CrxInstaller> installer(new CrxInstaller(...)); | 61 // scoped_refptr<CrxInstaller> installer(new CrxInstaller(...)); |
| 62 // installer->set_foo(); | 62 // installer->set_foo(); |
| 63 // installer->set_bar(); | 63 // installer->set_bar(); |
| 64 // installer->InstallCrx(...); | 64 // installer->InstallCrx(...); |
| 65 // | 65 // |
| 66 // Installation is aborted if the extension service learns that Chrome is | 66 // Installation is aborted if the extension service learns that Chrome is |
| 67 // terminating during the install. We can't listen for the app termination | 67 // terminating during the install. We can't listen for the app termination |
| 68 // notification here in this class because it can be destroyed on any thread | 68 // notification here in this class because it can be destroyed on any thread |
| 69 // and won't safely be able to clean up UI thread notification listeners. | 69 // and won't safely be able to clean up UI thread notification listeners. |
| 70 class CrxInstaller | 70 class CrxInstaller : public SandboxedUnpackerClient { |
| 71 : public SandboxedUnpackerClient, | |
| 72 public ExtensionInstallPrompt::Delegate { | |
| 73 public: | 71 public: |
| 74 // Used in histograms; do not change order. | 72 // Used in histograms; do not change order. |
| 75 enum OffStoreInstallAllowReason { | 73 enum OffStoreInstallAllowReason { |
| 76 OffStoreInstallDisallowed, | 74 OffStoreInstallDisallowed, |
| 77 OffStoreInstallAllowedFromSettingsPage, | 75 OffStoreInstallAllowedFromSettingsPage, |
| 78 OffStoreInstallAllowedBecausePref, | 76 OffStoreInstallAllowedBecausePref, |
| 79 OffStoreInstallAllowedInTest, | 77 OffStoreInstallAllowedInTest, |
| 80 NumOffStoreInstallAllowReasons | 78 NumOffStoreInstallAllowReasons |
| 81 }; | 79 }; |
| 82 | 80 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 void InstallCrx(const base::FilePath& source_file); | 99 void InstallCrx(const base::FilePath& source_file); |
| 102 void InstallCrxFile(const CRXFileInfo& source_file); | 100 void InstallCrxFile(const CRXFileInfo& source_file); |
| 103 | 101 |
| 104 // Convert the specified user script into an extension and install it. | 102 // Convert the specified user script into an extension and install it. |
| 105 void InstallUserScript(const base::FilePath& source_file, | 103 void InstallUserScript(const base::FilePath& source_file, |
| 106 const GURL& download_url); | 104 const GURL& download_url); |
| 107 | 105 |
| 108 // Convert the specified web app into an extension and install it. | 106 // Convert the specified web app into an extension and install it. |
| 109 void InstallWebApp(const WebApplicationInfo& web_app); | 107 void InstallWebApp(const WebApplicationInfo& web_app); |
| 110 | 108 |
| 111 // Overridden from ExtensionInstallPrompt::Delegate: | 109 void OnInstallPromptDone(ExtensionInstallPrompt::Result result); |
| 112 void InstallUIProceed() override; | |
| 113 void InstallUIAbort(bool user_initiated) override; | |
| 114 | 110 |
| 115 int creation_flags() const { return creation_flags_; } | 111 int creation_flags() const { return creation_flags_; } |
| 116 void set_creation_flags(int val) { creation_flags_ = val; } | 112 void set_creation_flags(int val) { creation_flags_ = val; } |
| 117 | 113 |
| 118 const base::FilePath& source_file() const { return source_file_; } | 114 const base::FilePath& source_file() const { return source_file_; } |
| 119 | 115 |
| 120 Manifest::Location install_source() const { | 116 Manifest::Location install_source() const { |
| 121 return install_source_; | 117 return install_source_; |
| 122 } | 118 } |
| 123 void set_install_source(Manifest::Location source) { | 119 void set_install_source(Manifest::Location source) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 436 |
| 441 // Performs requirements, policy and blacklist checks on the extension. | 437 // Performs requirements, policy and blacklist checks on the extension. |
| 442 ExtensionInstallChecker install_checker_; | 438 ExtensionInstallChecker install_checker_; |
| 443 | 439 |
| 444 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 440 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 445 }; | 441 }; |
| 446 | 442 |
| 447 } // namespace extensions | 443 } // namespace extensions |
| 448 | 444 |
| 449 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 445 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |