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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 install_flags_ &= ~kInstallFlagInstallImmediately; | 190 install_flags_ &= ~kInstallFlagInstallImmediately; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void set_is_ephemeral(bool val) { | 193 void set_is_ephemeral(bool val) { |
| 194 if (val) | 194 if (val) |
| 195 install_flags_ |= kInstallFlagIsEphemeral; | 195 install_flags_ |= kInstallFlagIsEphemeral; |
| 196 else | 196 else |
| 197 install_flags_ &= ~kInstallFlagIsEphemeral; | 197 install_flags_ &= ~kInstallFlagIsEphemeral; |
| 198 } | 198 } |
| 199 | 199 |
| 200 void set_install_flag(int flag, bool val) { | 200 void set_install_flag(int flag, bool val) { |
|
not at google - send to devlin
2014/06/17 21:15:19
in the other CL I lgtm'd without looking at the la
xiyuan
2014/06/17 21:48:03
Done.
| |
| 201 if (val) | 201 if (val) |
| 202 install_flags_ |= flag; | 202 install_flags_ |= flag; |
| 203 else | 203 else |
| 204 install_flags_ &= ~flag; | 204 install_flags_ &= ~flag; |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool did_handle_successfully() const { return did_handle_successfully_; } | 207 bool did_handle_successfully() const { return did_handle_successfully_; } |
| 208 | 208 |
| 209 Profile* profile() { return installer_.profile(); } | 209 Profile* profile() { return installer_.profile(); } |
| 210 | 210 |
| 211 const Extension* extension() { return installer_.extension().get(); } | 211 const Extension* extension() { return installer_.extension().get(); } |
| 212 | 212 |
| 213 const std::string& current_version() const { return current_version_; } | |
| 214 | |
| 213 private: | 215 private: |
| 214 friend class ::ExtensionServiceTest; | 216 friend class ::ExtensionServiceTest; |
| 215 friend class ExtensionUpdaterTest; | 217 friend class ExtensionUpdaterTest; |
| 216 friend class ExtensionCrxInstallerTest; | 218 friend class ExtensionCrxInstallerTest; |
| 217 | 219 |
| 218 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, | 220 CrxInstaller(base::WeakPtr<ExtensionService> service_weak, |
| 219 scoped_ptr<ExtensionInstallPrompt> client, | 221 scoped_ptr<ExtensionInstallPrompt> client, |
| 220 const WebstoreInstaller::Approval* approval); | 222 const WebstoreInstaller::Approval* approval); |
| 221 virtual ~CrxInstaller(); | 223 virtual ~CrxInstaller(); |
| 222 | 224 |
| 223 // Converts the source user script to an extension. | 225 // Converts the source user script to an extension. |
| 224 void ConvertUserScriptOnFileThread(); | 226 void ConvertUserScriptOnFileThread(); |
| 225 | 227 |
| 226 // Converts the source web app to an extension. | 228 // Converts the source web app to an extension. |
| 227 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app, | 229 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); |
| 228 const base::FilePath& install_directory); | |
| 229 | 230 |
| 230 // Called after OnUnpackSuccess as a last check to see whether the install | 231 // Called after OnUnpackSuccess as a last check to see whether the install |
| 231 // should complete. | 232 // should complete. |
| 232 CrxInstallerError AllowInstall(const Extension* extension); | 233 CrxInstallerError AllowInstall(const Extension* extension); |
| 233 | 234 |
| 234 // SandboxedUnpackerClient | 235 // SandboxedUnpackerClient |
| 235 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; | 236 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; |
| 236 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, | 237 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, |
| 237 const base::FilePath& extension_dir, | 238 const base::FilePath& extension_dir, |
| 238 const base::DictionaryValue* original_manifest, | 239 const base::DictionaryValue* original_manifest, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 // and needs additional permissions. | 280 // and needs additional permissions. |
| 280 void ConfirmReEnable(); | 281 void ConfirmReEnable(); |
| 281 | 282 |
| 282 // The file we're installing. | 283 // The file we're installing. |
| 283 base::FilePath source_file_; | 284 base::FilePath source_file_; |
| 284 | 285 |
| 285 // The URL the file was downloaded from. | 286 // The URL the file was downloaded from. |
| 286 GURL download_url_; | 287 GURL download_url_; |
| 287 | 288 |
| 288 // The directory extensions are installed to. | 289 // The directory extensions are installed to. |
| 289 base::FilePath install_directory_; | 290 const base::FilePath install_directory_; |
| 290 | 291 |
| 291 // The location the installation came from (bundled with Chromium, registry, | 292 // The location the installation came from (bundled with Chromium, registry, |
| 292 // manual install, etc). This metadata is saved with the installation if | 293 // manual install, etc). This metadata is saved with the installation if |
| 293 // successful. Defaults to INTERNAL. | 294 // successful. Defaults to INTERNAL. |
| 294 Manifest::Location install_source_; | 295 Manifest::Location install_source_; |
| 295 | 296 |
| 296 // Indicates whether the user has already approved the extension to be | 297 // Indicates whether the user has already approved the extension to be |
| 297 // installed. If true, |expected_manifest_| and |expected_id_| must match | 298 // installed. If true, |expected_manifest_| and |expected_id_| must match |
| 298 // those of the CRX. | 299 // those of the CRX. |
| 299 bool approved_; | 300 bool approved_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 | 423 |
| 423 // Gives access to common methods and data of an extension installer. | 424 // Gives access to common methods and data of an extension installer. |
| 424 ExtensionInstaller installer_; | 425 ExtensionInstaller installer_; |
| 425 | 426 |
| 426 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 427 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 427 }; | 428 }; |
| 428 | 429 |
| 429 } // namespace extensions | 430 } // namespace extensions |
| 430 | 431 |
| 431 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 432 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |