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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 installer->set_delete_source(file_ownership_passed); | 588 installer->set_delete_source(file_ownership_passed); |
589 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); | 589 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); |
590 installer->InstallCrx(extension_path); | 590 installer->InstallCrx(extension_path); |
591 | 591 |
592 if (out_crx_installer) | 592 if (out_crx_installer) |
593 *out_crx_installer = installer.get(); | 593 *out_crx_installer = installer.get(); |
594 | 594 |
595 return true; | 595 return true; |
596 } | 596 } |
597 | 597 |
598 void ExtensionService::ReloadExtension(const std::string extension_id) { | 598 void ExtensionService::ReloadExtension(const std::string& extension_id) { |
599 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 599 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
600 | 600 |
601 // If the extension is already reloading, don't reload again. | 601 // If the extension is already reloading, don't reload again. |
602 if (extension_prefs_->GetDisableReasons(extension_id) & | 602 if (extension_prefs_->GetDisableReasons(extension_id) & |
603 Extension::DISABLE_RELOAD) { | 603 Extension::DISABLE_RELOAD) { |
604 return; | 604 return; |
605 } | 605 } |
606 | 606 |
| 607 // Ignore attempts to reload a blacklisted extension. Sometimes this can |
| 608 // happen in a convoluted reload sequence triggered by the termination of a |
| 609 // blacklisted extension and a naive attempt to reload it. For an example see |
| 610 // http://crbug.com/373842. |
| 611 if (registry_->blacklisted_extensions().Contains(extension_id)) |
| 612 return; |
| 613 |
607 base::FilePath path; | 614 base::FilePath path; |
608 const Extension* current_extension = GetExtensionById(extension_id, false); | 615 const Extension* current_extension = GetExtensionById(extension_id, false); |
609 | 616 |
610 // Disable the extension if it's loaded. It might not be loaded if it crashed. | 617 // Disable the extension if it's loaded. It might not be loaded if it crashed. |
611 if (current_extension) { | 618 if (current_extension) { |
612 // If the extension has an inspector open for its background page, detach | 619 // If the extension has an inspector open for its background page, detach |
613 // the inspector and hang onto a cookie for it, so that we can reattach | 620 // the inspector and hang onto a cookie for it, so that we can reattach |
614 // later. | 621 // later. |
615 // TODO(yoz): this is not incognito-safe! | 622 // TODO(yoz): this is not incognito-safe! |
616 extensions::ProcessManager* manager = system_->process_manager(); | 623 extensions::ProcessManager* manager = system_->process_manager(); |
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 } | 2444 } |
2438 | 2445 |
2439 void ExtensionService::OnProfileDestructionStarted() { | 2446 void ExtensionService::OnProfileDestructionStarted() { |
2440 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2447 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2441 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2448 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2442 it != ids_to_unload.end(); | 2449 it != ids_to_unload.end(); |
2443 ++it) { | 2450 ++it) { |
2444 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2451 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2445 } | 2452 } |
2446 } | 2453 } |
OLD | NEW |