| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ | 5 #ifndef EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| 6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ | 6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // above, if they wish to completely lock in an extension. | 67 // above, if they wish to completely lock in an extension. |
| 68 virtual bool MustRemainEnabled(const Extension* extension, | 68 virtual bool MustRemainEnabled(const Extension* extension, |
| 69 base::string16* error) const; | 69 base::string16* error) const; |
| 70 | 70 |
| 71 // Similar to MustRemainEnabled, but for whether an extension must remain | 71 // Similar to MustRemainEnabled, but for whether an extension must remain |
| 72 // disabled, and returns an error and/or reason if the caller needs it. | 72 // disabled, and returns an error and/or reason if the caller needs it. |
| 73 virtual bool MustRemainDisabled(const Extension* extension, | 73 virtual bool MustRemainDisabled(const Extension* extension, |
| 74 Extension::DisableReason* reason, | 74 Extension::DisableReason* reason, |
| 75 base::string16* error) const; | 75 base::string16* error) const; |
| 76 | 76 |
| 77 // Similar to MustRemainEnabled, but for whether an extension must remain |
| 78 // installed, and returns an error and/or reason if the caller needs it. |
| 79 virtual bool MustRemainInstalled(const Extension* extension, |
| 80 base::string16* error) const; |
| 81 |
| 77 private: | 82 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(Provider); | 83 DISALLOW_COPY_AND_ASSIGN(Provider); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 ManagementPolicy(); | 86 ManagementPolicy(); |
| 82 ~ManagementPolicy(); | 87 ~ManagementPolicy(); |
| 83 | 88 |
| 84 // Registers or unregisters a provider, causing it to be added to or removed | 89 // Registers or unregisters a provider, causing it to be added to or removed |
| 85 // from the list of providers queried. Ownership of the provider remains with | 90 // from the list of providers queried. Ownership of the provider remains with |
| 86 // the caller. Providers do not need to be unregistered on shutdown. | 91 // the caller. Providers do not need to be unregistered on shutdown. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 // message. | 107 // message. |
| 103 bool MustRemainEnabled(const Extension* extension, | 108 bool MustRemainEnabled(const Extension* extension, |
| 104 base::string16* error) const; | 109 base::string16* error) const; |
| 105 | 110 |
| 106 // Returns true immediately if any registered provider's MustRemainDisabled | 111 // Returns true immediately if any registered provider's MustRemainDisabled |
| 107 // function returns true. | 112 // function returns true. |
| 108 bool MustRemainDisabled(const Extension* extension, | 113 bool MustRemainDisabled(const Extension* extension, |
| 109 Extension::DisableReason* reason, | 114 Extension::DisableReason* reason, |
| 110 base::string16* error) const; | 115 base::string16* error) const; |
| 111 | 116 |
| 117 // Returns true immediately if any registered provider's MustRemainInstalled |
| 118 // function returns true. |
| 119 bool MustRemainInstalled(const Extension* extension, |
| 120 base::string16* error) const; |
| 121 |
| 112 // For use in testing. | 122 // For use in testing. |
| 113 void UnregisterAllProviders(); | 123 void UnregisterAllProviders(); |
| 114 int GetNumProviders() const; | 124 int GetNumProviders() const; |
| 115 | 125 |
| 116 private: | 126 private: |
| 117 // This is a pointer to a function in the Provider interface, used in | 127 // This is a pointer to a function in the Provider interface, used in |
| 118 // ApplyToProviderList. | 128 // ApplyToProviderList. |
| 119 typedef bool (Provider::*ProviderFunction)(const Extension*, | 129 typedef bool (Provider::*ProviderFunction)(const Extension*, |
| 120 base::string16*) const; | 130 base::string16*) const; |
| 121 | 131 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 133 base::string16* error) const; | 143 base::string16* error) const; |
| 134 | 144 |
| 135 ProviderList providers_; | 145 ProviderList providers_; |
| 136 | 146 |
| 137 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy); | 147 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy); |
| 138 }; | 148 }; |
| 139 | 149 |
| 140 } // namespace extensions | 150 } // namespace extensions |
| 141 | 151 |
| 142 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ | 152 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| OLD | NEW |