| 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> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 13 #include <utility> |
| 12 | 14 |
| 13 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 14 #include "base/location.h" | 16 #include "base/location.h" |
| 15 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
| 21 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
| (...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 pending_extension_manager()->Remove(id); | 1736 pending_extension_manager()->Remove(id); |
| 1735 } else { | 1737 } else { |
| 1736 // We explicitly want to re-enable an uninstalled external | 1738 // We explicitly want to re-enable an uninstalled external |
| 1737 // extension; if we're here, that means the user is manually | 1739 // extension; if we're here, that means the user is manually |
| 1738 // installing the extension. | 1740 // installing the extension. |
| 1739 if (extension_prefs_->IsExternalExtensionUninstalled(id)) { | 1741 if (extension_prefs_->IsExternalExtensionUninstalled(id)) { |
| 1740 disable_reasons = Extension::DISABLE_NONE; | 1742 disable_reasons = Extension::DISABLE_NONE; |
| 1741 } | 1743 } |
| 1742 } | 1744 } |
| 1743 | 1745 |
| 1746 // If the old version of the extension was disabled due to corruption, this |
| 1747 // new install may correct the problem. |
| 1748 disable_reasons &= ~Extension::DISABLE_CORRUPTED; |
| 1749 |
| 1744 // Unsupported requirements overrides the management policy. | 1750 // Unsupported requirements overrides the management policy. |
| 1745 if (install_flags & extensions::kInstallFlagHasRequirementErrors) { | 1751 if (install_flags & extensions::kInstallFlagHasRequirementErrors) { |
| 1746 disable_reasons |= Extension::DISABLE_UNSUPPORTED_REQUIREMENT; | 1752 disable_reasons |= Extension::DISABLE_UNSUPPORTED_REQUIREMENT; |
| 1747 } else { | 1753 } else { |
| 1748 // Requirement is supported now, remove the corresponding disable reason | 1754 // Requirement is supported now, remove the corresponding disable reason |
| 1749 // instead. | 1755 // instead. |
| 1750 disable_reasons &= ~Extension::DISABLE_UNSUPPORTED_REQUIREMENT; | 1756 disable_reasons &= ~Extension::DISABLE_UNSUPPORTED_REQUIREMENT; |
| 1751 } | 1757 } |
| 1752 | 1758 |
| 1753 // Check if the extension was disabled because of the minimum version | 1759 // Check if the extension was disabled because of the minimum version |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 } | 2454 } |
| 2449 | 2455 |
| 2450 void ExtensionService::OnProfileDestructionStarted() { | 2456 void ExtensionService::OnProfileDestructionStarted() { |
| 2451 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2457 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2452 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2458 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2453 it != ids_to_unload.end(); | 2459 it != ids_to_unload.end(); |
| 2454 ++it) { | 2460 ++it) { |
| 2455 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2461 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2456 } | 2462 } |
| 2457 } | 2463 } |
| OLD | NEW |