| 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 <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <iterator> | 10 #include <iterator> | 
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 511 | 511 | 
| 512   const extensions::PendingExtensionInfo* pending_extension_info = | 512   const extensions::PendingExtensionInfo* pending_extension_info = | 
| 513       pending_extension_manager()->GetById(id); | 513       pending_extension_manager()->GetById(id); | 
| 514 | 514 | 
| 515   const Extension* extension = GetInstalledExtension(id); | 515   const Extension* extension = GetInstalledExtension(id); | 
| 516   if (!pending_extension_info && !extension) { | 516   if (!pending_extension_info && !extension) { | 
| 517     LOG(WARNING) << "Will not update extension " << id | 517     LOG(WARNING) << "Will not update extension " << id | 
| 518                  << " because it is not installed or pending"; | 518                  << " because it is not installed or pending"; | 
| 519     // Delete extension_path since we're not creating a CrxInstaller | 519     // Delete extension_path since we're not creating a CrxInstaller | 
| 520     // that would do it for us. | 520     // that would do it for us. | 
| 521     if (file_ownership_passed && | 521     if (!GetFileTaskRunner()->PostTask( | 
| 522         !GetFileTaskRunner()->PostTask( |  | 
| 523             FROM_HERE, | 522             FROM_HERE, | 
| 524             base::Bind(&extensions::file_util::DeleteFile, file.path, false))) | 523             base::Bind(&extensions::file_util::DeleteFile, file.path, false))) | 
| 525       NOTREACHED(); | 524       NOTREACHED(); | 
| 526 | 525 | 
| 527     return false; | 526     return false; | 
| 528   } | 527   } | 
| 529 | 528 | 
| 530   scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); | 529   scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); | 
| 531   installer->set_expected_id(id); | 530   installer->set_expected_id(id); | 
| 532   installer->set_expected_hash(file.expected_hash); | 531   installer->set_expected_hash(file.expected_hash); | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 685     // the map, someone failed to update |unloaded_extension_paths_|. | 684     // the map, someone failed to update |unloaded_extension_paths_|. | 
| 686     CHECK(!path.empty()); | 685     CHECK(!path.empty()); | 
| 687     scoped_refptr<extensions::UnpackedInstaller> unpacked_installer = | 686     scoped_refptr<extensions::UnpackedInstaller> unpacked_installer = | 
| 688         extensions::UnpackedInstaller::Create(this); | 687         extensions::UnpackedInstaller::Create(this); | 
| 689     unpacked_installer->set_be_noisy_on_failure(be_noisy); | 688     unpacked_installer->set_be_noisy_on_failure(be_noisy); | 
| 690     unpacked_installer->Load(path); | 689     unpacked_installer->Load(path); | 
| 691   } | 690   } | 
| 692 } | 691 } | 
| 693 | 692 | 
| 694 void ExtensionService::ReloadExtension(const std::string& extension_id) { | 693 void ExtensionService::ReloadExtension(const std::string& extension_id) { | 
| 695   ReloadExtensionImpl(extension_id, true);  // be_noisy | 694   ReloadExtensionImpl(extension_id, true); // be_noisy | 
| 696 } | 695 } | 
| 697 | 696 | 
| 698 void ExtensionService::ReloadExtensionWithQuietFailure( | 697 void ExtensionService::ReloadExtensionWithQuietFailure( | 
| 699     const std::string& extension_id) { | 698     const std::string& extension_id) { | 
| 700   ReloadExtensionImpl(extension_id, false);  // be_noisy | 699   ReloadExtensionImpl(extension_id, false); // be_noisy | 
| 701 } | 700 } | 
| 702 | 701 | 
| 703 bool ExtensionService::UninstallExtension( | 702 bool ExtensionService::UninstallExtension( | 
| 704     // "transient" because the process of uninstalling may cause the reference | 703     // "transient" because the process of uninstalling may cause the reference | 
| 705     // to become invalid. Instead, use |extenson->id()|. | 704     // to become invalid. Instead, use |extenson->id()|. | 
| 706     const std::string& transient_extension_id, | 705     const std::string& transient_extension_id, | 
| 707     extensions::UninstallReason reason, | 706     extensions::UninstallReason reason, | 
| 708     const base::Closure& deletion_done_callback, | 707     const base::Closure& deletion_done_callback, | 
| 709     base::string16* error) { | 708     base::string16* error) { | 
| 710   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 709   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2426 } | 2425 } | 
| 2427 | 2426 | 
| 2428 void ExtensionService::OnProfileDestructionStarted() { | 2427 void ExtensionService::OnProfileDestructionStarted() { | 
| 2429   ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2428   ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 
| 2430   for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2429   for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 
| 2431        it != ids_to_unload.end(); | 2430        it != ids_to_unload.end(); | 
| 2432        ++it) { | 2431        ++it) { | 
| 2433     UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2432     UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 
| 2434   } | 2433   } | 
| 2435 } | 2434 } | 
| OLD | NEW | 
|---|