| 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 #include "chrome/browser/extensions/webstore_standalone_installer.h" | 5 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "base/version.h" | 8 #include "base/version.h" |
| 9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
| 10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // Don't install a blacklisted extension. | 344 // Don't install a blacklisted extension. |
| 345 install_result = webstore_install::BLACKLISTED; | 345 install_result = webstore_install::BLACKLISTED; |
| 346 install_message = kExtensionIsBlacklisted; | 346 install_message = kExtensionIsBlacklisted; |
| 347 } else if (util::IsEphemeralApp(installed_extension->id(), profile_) && | 347 } else if (util::IsEphemeralApp(installed_extension->id(), profile_) && |
| 348 !approval->is_ephemeral) { | 348 !approval->is_ephemeral) { |
| 349 // If the target extension has already been installed ephemerally and is | 349 // If the target extension has already been installed ephemerally and is |
| 350 // up to date, it can be promoted to a regular installed extension and | 350 // up to date, it can be promoted to a regular installed extension and |
| 351 // downloading from the Web Store is not necessary. | 351 // downloading from the Web Store is not necessary. |
| 352 scoped_refptr<const Extension> extension_to_install = | 352 scoped_refptr<const Extension> extension_to_install = |
| 353 GetLocalizedExtensionForDisplay(); | 353 GetLocalizedExtensionForDisplay(); |
| 354 if (!extension_to_install) { | 354 if (!extension_to_install.get()) { |
| 355 CompleteInstall(webstore_install::INVALID_MANIFEST, | 355 CompleteInstall(webstore_install::INVALID_MANIFEST, |
| 356 kInvalidManifestError); | 356 kInvalidManifestError); |
| 357 return; | 357 return; |
| 358 } | 358 } |
| 359 | 359 |
| 360 if (installed_extension->version()->CompareTo( | 360 if (installed_extension->version()->CompareTo( |
| 361 *extension_to_install->version()) < 0) { | 361 *extension_to_install->version()) < 0) { |
| 362 // If the existing extension is out of date, proceed with the install | 362 // If the existing extension is out of date, proceed with the install |
| 363 // to update the extension. | 363 // to update the extension. |
| 364 done = false; | 364 done = false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 default: | 417 default: |
| 418 break; | 418 break; |
| 419 } | 419 } |
| 420 | 420 |
| 421 CompleteInstall(install_result, error); | 421 CompleteInstall(install_result, error); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void WebstoreStandaloneInstaller::ShowInstallUI() { | 424 void WebstoreStandaloneInstaller::ShowInstallUI() { |
| 425 scoped_refptr<const Extension> localized_extension = | 425 scoped_refptr<const Extension> localized_extension = |
| 426 GetLocalizedExtensionForDisplay(); | 426 GetLocalizedExtensionForDisplay(); |
| 427 if (!localized_extension) { | 427 if (!localized_extension.get()) { |
| 428 CompleteInstall(webstore_install::INVALID_MANIFEST, kInvalidManifestError); | 428 CompleteInstall(webstore_install::INVALID_MANIFEST, kInvalidManifestError); |
| 429 return; | 429 return; |
| 430 } | 430 } |
| 431 | 431 |
| 432 install_ui_ = CreateInstallUI(); | 432 install_ui_ = CreateInstallUI(); |
| 433 install_ui_->ConfirmStandaloneInstall( | 433 install_ui_->ConfirmStandaloneInstall( |
| 434 this, localized_extension, &icon_, install_prompt_); | 434 this, localized_extension.get(), &icon_, install_prompt_); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { | 437 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { |
| 438 // An instance of this class is passed in as a delegate for the | 438 // An instance of this class is passed in as a delegate for the |
| 439 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and | 439 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and |
| 440 // therefore needs to remain alive until they are done. Clear the webstore | 440 // therefore needs to remain alive until they are done. Clear the webstore |
| 441 // data fetcher to avoid calling Release in AbortInstall while any of these | 441 // data fetcher to avoid calling Release in AbortInstall while any of these |
| 442 // operations are in progress. | 442 // operations are in progress. |
| 443 webstore_data_fetcher_.reset(); | 443 webstore_data_fetcher_.reset(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace extensions | 446 } // namespace extensions |
| OLD | NEW |