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/string_tokenizer.h" | 20 #include "base/strings/string_tokenizer.h" |
19 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
21 #include "base/threading/sequenced_worker_pool.h" | 23 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 pending_extension_manager()->Remove(id); | 1761 pending_extension_manager()->Remove(id); |
1760 } else { | 1762 } else { |
1761 // We explicitly want to re-enable an uninstalled external | 1763 // We explicitly want to re-enable an uninstalled external |
1762 // extension; if we're here, that means the user is manually | 1764 // extension; if we're here, that means the user is manually |
1763 // installing the extension. | 1765 // installing the extension. |
1764 if (extension_prefs_->IsExternalExtensionUninstalled(id)) { | 1766 if (extension_prefs_->IsExternalExtensionUninstalled(id)) { |
1765 disable_reasons = Extension::DISABLE_NONE; | 1767 disable_reasons = Extension::DISABLE_NONE; |
1766 } | 1768 } |
1767 } | 1769 } |
1768 | 1770 |
| 1771 // If the old version of the extension was disabled due to corruption, this |
| 1772 // new install may correct the problem. |
| 1773 disable_reasons &= ~Extension::DISABLE_CORRUPTED; |
| 1774 |
1769 // Unsupported requirements overrides the management policy. | 1775 // Unsupported requirements overrides the management policy. |
1770 if (install_flags & extensions::kInstallFlagHasRequirementErrors) { | 1776 if (install_flags & extensions::kInstallFlagHasRequirementErrors) { |
1771 disable_reasons |= Extension::DISABLE_UNSUPPORTED_REQUIREMENT; | 1777 disable_reasons |= Extension::DISABLE_UNSUPPORTED_REQUIREMENT; |
1772 } else { | 1778 } else { |
1773 // Requirement is supported now, remove the corresponding disable reason | 1779 // Requirement is supported now, remove the corresponding disable reason |
1774 // instead. | 1780 // instead. |
1775 disable_reasons &= ~Extension::DISABLE_UNSUPPORTED_REQUIREMENT; | 1781 disable_reasons &= ~Extension::DISABLE_UNSUPPORTED_REQUIREMENT; |
1776 } | 1782 } |
1777 | 1783 |
1778 // Check if the extension was disabled because of the minimum version | 1784 // Check if the extension was disabled because of the minimum version |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 } | 2479 } |
2474 | 2480 |
2475 void ExtensionService::OnProfileDestructionStarted() { | 2481 void ExtensionService::OnProfileDestructionStarted() { |
2476 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2482 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2477 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2483 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2478 it != ids_to_unload.end(); | 2484 it != ids_to_unload.end(); |
2479 ++it) { | 2485 ++it) { |
2480 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2486 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2481 } | 2487 } |
2482 } | 2488 } |
OLD | NEW |