| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void set_do_not_sync(bool do_not_sync) { do_not_sync_ = do_not_sync; } | 191 void set_do_not_sync(bool do_not_sync) { do_not_sync_ = do_not_sync; } |
| 192 | 192 |
| 193 bool did_handle_successfully() const { return did_handle_successfully_; } | 193 bool did_handle_successfully() const { return did_handle_successfully_; } |
| 194 | 194 |
| 195 Profile* profile() { return installer_.profile(); } | 195 Profile* profile() { return installer_.profile(); } |
| 196 | 196 |
| 197 const Extension* extension() { return installer_.extension().get(); } | 197 const Extension* extension() { return installer_.extension().get(); } |
| 198 | 198 |
| 199 const std::string& current_version() const { return current_version_; } |
| 200 |
| 199 private: | 201 private: |
| 200 friend class ::ExtensionServiceTest; | 202 friend class ::ExtensionServiceTest; |
| 201 friend class ExtensionUpdaterTest; | 203 friend class ExtensionUpdaterTest; |
| 202 friend class ExtensionCrxInstallerTest; | 204 friend class ExtensionCrxInstallerTest; |
| 203 | 205 |
| 204 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, | 206 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, |
| 205 scoped_ptr<ExtensionInstallPrompt> client, | 207 scoped_ptr<ExtensionInstallPrompt> client, |
| 206 const WebstoreInstaller::Approval* approval); | 208 const WebstoreInstaller::Approval* approval); |
| 207 virtual ~CrxInstaller(); | 209 virtual ~CrxInstaller(); |
| 208 | 210 |
| 209 // Converts the source user script to an extension. | 211 // Converts the source user script to an extension. |
| 210 void ConvertUserScriptOnFileThread(); | 212 void ConvertUserScriptOnFileThread(); |
| 211 | 213 |
| 212 // Converts the source web app to an extension. | 214 // Converts the source web app to an extension. |
| 213 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app, | 215 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); |
| 214 const base::FilePath& install_directory); | |
| 215 | 216 |
| 216 // Called after OnUnpackSuccess as a last check to see whether the install | 217 // Called after OnUnpackSuccess as a last check to see whether the install |
| 217 // should complete. | 218 // should complete. |
| 218 CrxInstallerError AllowInstall(const Extension* extension); | 219 CrxInstallerError AllowInstall(const Extension* extension); |
| 219 | 220 |
| 220 // SandboxedUnpackerClient | 221 // SandboxedUnpackerClient |
| 221 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; | 222 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; |
| 222 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, | 223 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, |
| 223 const base::FilePath& extension_dir, | 224 const base::FilePath& extension_dir, |
| 224 const base::DictionaryValue* original_manifest, | 225 const base::DictionaryValue* original_manifest, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // and needs additional permissions. | 266 // and needs additional permissions. |
| 266 void ConfirmReEnable(); | 267 void ConfirmReEnable(); |
| 267 | 268 |
| 268 // The file we're installing. | 269 // The file we're installing. |
| 269 base::FilePath source_file_; | 270 base::FilePath source_file_; |
| 270 | 271 |
| 271 // The URL the file was downloaded from. | 272 // The URL the file was downloaded from. |
| 272 GURL download_url_; | 273 GURL download_url_; |
| 273 | 274 |
| 274 // The directory extensions are installed to. | 275 // The directory extensions are installed to. |
| 275 base::FilePath install_directory_; | 276 const base::FilePath install_directory_; |
| 276 | 277 |
| 277 // The location the installation came from (bundled with Chromium, registry, | 278 // The location the installation came from (bundled with Chromium, registry, |
| 278 // manual install, etc). This metadata is saved with the installation if | 279 // manual install, etc). This metadata is saved with the installation if |
| 279 // successful. Defaults to INTERNAL. | 280 // successful. Defaults to INTERNAL. |
| 280 Manifest::Location install_source_; | 281 Manifest::Location install_source_; |
| 281 | 282 |
| 282 // Indicates whether the user has already approved the extension to be | 283 // Indicates whether the user has already approved the extension to be |
| 283 // installed. If true, |expected_manifest_| and |expected_id_| must match | 284 // installed. If true, |expected_manifest_| and |expected_id_| must match |
| 284 // those of the CRX. | 285 // those of the CRX. |
| 285 bool approved_; | 286 bool approved_; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 418 |
| 418 // Gives access to common methods and data of an extension installer. | 419 // Gives access to common methods and data of an extension installer. |
| 419 ExtensionInstaller installer_; | 420 ExtensionInstaller installer_; |
| 420 | 421 |
| 421 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 422 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 422 }; | 423 }; |
| 423 | 424 |
| 424 } // namespace extensions | 425 } // namespace extensions |
| 425 | 426 |
| 426 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 427 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |