| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 return true; | 608 return true; |
| 609 #else | 609 #else |
| 610 return false; | 610 return false; |
| 611 #endif | 611 #endif |
| 612 } | 612 } |
| 613 | 613 |
| 614 void ExtensionService::ReloadExtension( | 614 void ExtensionService::ReloadExtension( |
| 615 // "transient" because the process of reloading may cause the reference | 615 // "transient" because the process of reloading may cause the reference |
| 616 // to become invalid. Instead, use |extension_id|, a copy. | 616 // to become invalid. Instead, use |extension_id|, a copy. |
| 617 const std::string& transient_extension_id) { | 617 const std::string& transient_extension_id, |
| 618 bool be_noisy) { |
| 618 #if defined(ENABLE_EXTENSIONS) | 619 #if defined(ENABLE_EXTENSIONS) |
| 619 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 620 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 620 | 621 |
| 621 // If the extension is already reloading, don't reload again. | 622 // If the extension is already reloading, don't reload again. |
| 622 if (extension_prefs_->GetDisableReasons(transient_extension_id) & | 623 if (extension_prefs_->GetDisableReasons(transient_extension_id) & |
| 623 Extension::DISABLE_RELOAD) { | 624 Extension::DISABLE_RELOAD) { |
| 624 return; | 625 return; |
| 625 } | 626 } |
| 626 | 627 |
| 627 // Ignore attempts to reload a blacklisted extension. Sometimes this can | 628 // Ignore attempts to reload a blacklisted extension. Sometimes this can |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 scoped_ptr<ExtensionInfo> installed_extension( | 692 scoped_ptr<ExtensionInfo> installed_extension( |
| 692 extension_prefs_->GetInstalledExtensionInfo(extension_id)); | 693 extension_prefs_->GetInstalledExtensionInfo(extension_id)); |
| 693 if (installed_extension.get() && | 694 if (installed_extension.get() && |
| 694 installed_extension->extension_manifest.get()) { | 695 installed_extension->extension_manifest.get()) { |
| 695 extensions::InstalledLoader(this).Load(*installed_extension, false); | 696 extensions::InstalledLoader(this).Load(*installed_extension, false); |
| 696 } else { | 697 } else { |
| 697 // Otherwise, the extension is unpacked (location LOAD). | 698 // Otherwise, the extension is unpacked (location LOAD). |
| 698 // We should always be able to remember the extension's path. If it's not in | 699 // We should always be able to remember the extension's path. If it's not in |
| 699 // the map, someone failed to update |unloaded_extension_paths_|. | 700 // the map, someone failed to update |unloaded_extension_paths_|. |
| 700 CHECK(!path.empty()); | 701 CHECK(!path.empty()); |
| 701 extensions::UnpackedInstaller::Create(this)->Load(path); | 702 scoped_refptr<extensions::UnpackedInstaller> unpacked_installer = |
| 703 extensions::UnpackedInstaller::Create(this); |
| 704 unpacked_installer->set_be_noisy_on_failure(be_noisy); |
| 705 unpacked_installer->Load(path); |
| 702 } | 706 } |
| 703 // When reloading is done, mark this extension as done reloading. | 707 // When reloading is done, mark this extension as done reloading. |
| 704 SetBeingReloaded(extension_id, false); | 708 SetBeingReloaded(extension_id, false); |
| 705 #endif // defined(ENABLE_EXTENSIONS) | 709 #endif // defined(ENABLE_EXTENSIONS) |
| 706 } | 710 } |
| 707 | 711 |
| 708 bool ExtensionService::UninstallExtension( | 712 bool ExtensionService::UninstallExtension( |
| 709 // "transient" because the process of uninstalling may cause the reference | 713 // "transient" because the process of uninstalling may cause the reference |
| 710 // to become invalid. Instead, use |extenson->id()|. | 714 // to become invalid. Instead, use |extenson->id()|. |
| 711 const std::string& transient_extension_id, | 715 const std::string& transient_extension_id, |
| (...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 } | 2491 } |
| 2488 | 2492 |
| 2489 void ExtensionService::OnProfileDestructionStarted() { | 2493 void ExtensionService::OnProfileDestructionStarted() { |
| 2490 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2494 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2491 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2495 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2492 it != ids_to_unload.end(); | 2496 it != ids_to_unload.end(); |
| 2493 ++it) { | 2497 ++it) { |
| 2494 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2498 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2495 } | 2499 } |
| 2496 } | 2500 } |
| OLD | NEW |