| 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" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 void set_install_wait_for_idle(bool val) { | 183 void set_install_wait_for_idle(bool val) { |
| 184 install_wait_for_idle_ = val; | 184 install_wait_for_idle_ = val; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void set_is_ephemeral(bool val) { | 187 void set_is_ephemeral(bool val) { |
| 188 is_ephemeral_ = val; | 188 is_ephemeral_ = val; |
| 189 } | 189 } |
| 190 | 190 |
| 191 void set_is_syncable(bool is_syncable) { is_syncable_ = is_syncable; } |
| 192 |
| 191 bool did_handle_successfully() const { return did_handle_successfully_; } | 193 bool did_handle_successfully() const { return did_handle_successfully_; } |
| 192 | 194 |
| 193 Profile* profile() { return installer_.profile(); } | 195 Profile* profile() { return installer_.profile(); } |
| 194 | 196 |
| 195 const Extension* extension() { return installer_.extension().get(); } | 197 const Extension* extension() { return installer_.extension().get(); } |
| 196 | 198 |
| 197 private: | 199 private: |
| 198 friend class ::ExtensionServiceTest; | 200 friend class ::ExtensionServiceTest; |
| 199 friend class ExtensionUpdaterTest; | 201 friend class ExtensionUpdaterTest; |
| 200 friend class ExtensionCrxInstallerTest; | 202 friend class ExtensionCrxInstallerTest; |
| 201 | 203 |
| 202 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, | 204 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, |
| 203 scoped_ptr<ExtensionInstallPrompt> client, | 205 scoped_ptr<ExtensionInstallPrompt> client, |
| 204 const WebstoreInstaller::Approval* approval); | 206 const WebstoreInstaller::Approval* approval); |
| 205 virtual ~CrxInstaller(); | 207 virtual ~CrxInstaller(); |
| 206 | 208 |
| 207 // Converts the source user script to an extension. | 209 // Converts the source user script to an extension. |
| 208 void ConvertUserScriptOnFileThread(); | 210 void ConvertUserScriptOnFileThread(); |
| 209 | 211 |
| 210 // Converts the source web app to an extension. | 212 // Converts the source web app to an extension. |
| 211 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app, | 213 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); |
| 212 const base::FilePath& install_directory); | |
| 213 | 214 |
| 214 // Called after OnUnpackSuccess as a last check to see whether the install | 215 // Called after OnUnpackSuccess as a last check to see whether the install |
| 215 // should complete. | 216 // should complete. |
| 216 CrxInstallerError AllowInstall(const Extension* extension); | 217 CrxInstallerError AllowInstall(const Extension* extension); |
| 217 | 218 |
| 218 // SandboxedUnpackerClient | 219 // SandboxedUnpackerClient |
| 219 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; | 220 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; |
| 220 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, | 221 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, |
| 221 const base::FilePath& extension_dir, | 222 const base::FilePath& extension_dir, |
| 222 const base::DictionaryValue* original_manifest, | 223 const base::DictionaryValue* original_manifest, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // and needs additional permissions. | 264 // and needs additional permissions. |
| 264 void ConfirmReEnable(); | 265 void ConfirmReEnable(); |
| 265 | 266 |
| 266 // The file we're installing. | 267 // The file we're installing. |
| 267 base::FilePath source_file_; | 268 base::FilePath source_file_; |
| 268 | 269 |
| 269 // The URL the file was downloaded from. | 270 // The URL the file was downloaded from. |
| 270 GURL download_url_; | 271 GURL download_url_; |
| 271 | 272 |
| 272 // The directory extensions are installed to. | 273 // The directory extensions are installed to. |
| 273 base::FilePath install_directory_; | 274 const base::FilePath install_directory_; |
| 274 | 275 |
| 275 // The location the installation came from (bundled with Chromium, registry, | 276 // The location the installation came from (bundled with Chromium, registry, |
| 276 // manual install, etc). This metadata is saved with the installation if | 277 // manual install, etc). This metadata is saved with the installation if |
| 277 // successful. Defaults to INTERNAL. | 278 // successful. Defaults to INTERNAL. |
| 278 Manifest::Location install_source_; | 279 Manifest::Location install_source_; |
| 279 | 280 |
| 280 // Indicates whether the user has already approved the extension to be | 281 // Indicates whether the user has already approved the extension to be |
| 281 // installed. If true, |expected_manifest_| and |expected_id_| must match | 282 // installed. If true, |expected_manifest_| and |expected_id_| must match |
| 282 // those of the CRX. | 283 // those of the CRX. |
| 283 bool approved_; | 284 bool approved_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // Used to show the install dialog. | 404 // Used to show the install dialog. |
| 404 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; | 405 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; |
| 405 | 406 |
| 406 // Whether the update is initiated by the user from the extension settings | 407 // Whether the update is initiated by the user from the extension settings |
| 407 // page. | 408 // page. |
| 408 bool update_from_settings_page_; | 409 bool update_from_settings_page_; |
| 409 | 410 |
| 410 // True if an ephemeral app is being installed. | 411 // True if an ephemeral app is being installed. |
| 411 bool is_ephemeral_; | 412 bool is_ephemeral_; |
| 412 | 413 |
| 414 // Boolean value to initiate the relevant field in the installed Extension. |
| 415 // Default is true, which means the install extension is allowed to be synced. |
| 416 bool is_syncable_; |
| 417 |
| 413 // Gives access to common methods and data of an extension installer. | 418 // Gives access to common methods and data of an extension installer. |
| 414 ExtensionInstaller installer_; | 419 ExtensionInstaller installer_; |
| 415 | 420 |
| 416 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 421 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 417 }; | 422 }; |
| 418 | 423 |
| 419 } // namespace extensions | 424 } // namespace extensions |
| 420 | 425 |
| 421 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 426 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |