Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Devlin Cronin | bffe949eb | 2018-01-12 03:03:40 | [diff] [blame] | 5 | #ifndef EXTENSIONS_BROWSER_DISABLE_REASON_H_ |
| 6 | #define EXTENSIONS_BROWSER_DISABLE_REASON_H_ |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 7 | |
Karan Bhatia | 2a11723 | 2017-08-23 00:24:56 | [diff] [blame] | 8 | #include <limits> |
| 9 | |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 10 | namespace extensions { |
| 11 | namespace disable_reason { |
| 12 | |
| 13 | // Reasons a Chrome extension may be disabled. These are used in histograms, so |
| 14 | // do not remove/reorder entries - only add at the end just before |
| 15 | // DISABLE_REASON_LAST (and update the shift value for it). Also remember to |
| 16 | // update the enum listing in tools/metrics/histograms.xml. |
| 17 | // Also carefully consider if your reason should sync to other devices, and if |
| 18 | // so, add it to kKnownSyncableDisableReasons in |
| 19 | // chrome/browser/extensions/extension_sync_service.cc. |
Samuel Huang | 7987ebd | 2019-04-08 13:01:37 | [diff] [blame] | 20 | // Finally, consider whether your disable reason applies to component |
| 21 | // extensions. Reference/update the existing list of applicable reasons in |
| 22 | // ExtensionsPrefs::ClearInapplicableDisableReasonsForComponentExtension. |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 23 | enum DisableReason { |
| 24 | DISABLE_NONE = 0, |
| 25 | DISABLE_USER_ACTION = 1 << 0, |
| 26 | DISABLE_PERMISSIONS_INCREASE = 1 << 1, |
| 27 | DISABLE_RELOAD = 1 << 2, |
| 28 | DISABLE_UNSUPPORTED_REQUIREMENT = 1 << 3, |
| 29 | DISABLE_SIDELOAD_WIPEOUT = 1 << 4, |
| 30 | DEPRECATED_DISABLE_UNKNOWN_FROM_SYNC = 1 << 5, |
| 31 | // DISABLE_PERMISSIONS_CONSENT = 1 << 6, // Deprecated. |
| 32 | // DISABLE_KNOWN_DISABLED = 1 << 7, // Deprecated. |
| 33 | // Disabled because we could not verify the install. |
| 34 | DISABLE_NOT_VERIFIED = 1 << 8, |
| 35 | DISABLE_GREYLIST = 1 << 9, |
| 36 | DISABLE_CORRUPTED = 1 << 10, |
| 37 | DISABLE_REMOTE_INSTALL = 1 << 11, |
| 38 | // DISABLE_INACTIVE_EPHEMERAL_APP = 1 << 12, // Deprecated. |
| 39 | // External extensions might be disabled for user prompting. |
| 40 | DISABLE_EXTERNAL_EXTENSION = 1 << 13, |
| 41 | // Doesn't meet minimum version requirement. |
| 42 | DISABLE_UPDATE_REQUIRED_BY_POLICY = 1 << 14, |
| 43 | // Supervised user needs approval by custodian. |
| 44 | DISABLE_CUSTODIAN_APPROVAL_REQUIRED = 1 << 15, |
Karan Bhatia | 2a11723 | 2017-08-23 00:24:56 | [diff] [blame] | 45 | // Blocked due to management policy. |
| 46 | DISABLE_BLOCKED_BY_POLICY = 1 << 16, |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 47 | // This should always be the last value. |
Karan Bhatia | 2a11723 | 2017-08-23 00:24:56 | [diff] [blame] | 48 | DISABLE_REASON_LAST = 1LL << 17, |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 49 | }; |
| 50 | |
Karan Bhatia | 2a11723 | 2017-08-23 00:24:56 | [diff] [blame] | 51 | static_assert(DISABLE_REASON_LAST - 1 <= std::numeric_limits<int>::max(), |
| 52 | "The DisableReason bitmask cannot be stored in an int."); |
| 53 | |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 54 | } // namespace disable_reason |
| 55 | } // namespace extensions |
| 56 | |
Devlin Cronin | bffe949eb | 2018-01-12 03:03:40 | [diff] [blame] | 57 | #endif // EXTENSIONS_BROWSER_DISABLE_REASON_H_ |