OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/standard_management_policy_provider.h" | 5 #include "chrome/browser/extensions/standard_management_policy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 bool StandardManagementPolicyProvider::MustRemainEnabled( | 133 bool StandardManagementPolicyProvider::MustRemainEnabled( |
134 const Extension* extension, | 134 const Extension* extension, |
135 base::string16* error) const { | 135 base::string16* error) const { |
136 return !AdminPolicyIsModifiable(extension, error) || | 136 return !AdminPolicyIsModifiable(extension, error) || |
137 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && | 137 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && |
138 ExternalComponentLoader::IsModifiable(extension)); | 138 ExternalComponentLoader::IsModifiable(extension)); |
139 } | 139 } |
140 | 140 |
| 141 bool StandardManagementPolicyProvider::MustRemainDisabled( |
| 142 const Extension* extension, |
| 143 Extension::DisableReason* reason, |
| 144 base::string16* error) const { |
| 145 std::string required_version; |
| 146 if (!settings_->CheckMinimumVersionRequirement(extension, |
| 147 &required_version)) { |
| 148 if (reason) |
| 149 *reason = Extension::DISABLE_UPDATE_REQUIRED_BY_POLICY; |
| 150 if (error) { |
| 151 *error = l10n_util::GetStringFUTF16( |
| 152 IDS_EXTENSION_DISABLED_UPDATE_REQUIRED_BY_POLICY, |
| 153 base::UTF8ToUTF16(extension->name()), |
| 154 base::ASCIIToUTF16(required_version)); |
| 155 } |
| 156 return true; |
| 157 } |
| 158 return false; |
| 159 } |
| 160 |
141 bool StandardManagementPolicyProvider::MustRemainInstalled( | 161 bool StandardManagementPolicyProvider::MustRemainInstalled( |
142 const Extension* extension, | 162 const Extension* extension, |
143 base::string16* error) const { | 163 base::string16* error) const { |
144 ExtensionManagement::InstallationMode mode = | 164 ExtensionManagement::InstallationMode mode = |
145 settings_->GetInstallationMode(extension); | 165 settings_->GetInstallationMode(extension); |
146 // Disallow removing of recommended extension, to avoid re-install it | 166 // Disallow removing of recommended extension, to avoid re-install it |
147 // again while policy is reload. But disabling of recommended extension is | 167 // again while policy is reload. But disabling of recommended extension is |
148 // allowed. | 168 // allowed. |
149 if (mode == ExtensionManagement::INSTALLATION_FORCED || | 169 if (mode == ExtensionManagement::INSTALLATION_FORCED || |
150 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { | 170 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { |
151 if (error) { | 171 if (error) { |
152 *error = l10n_util::GetStringFUTF16( | 172 *error = l10n_util::GetStringFUTF16( |
153 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, | 173 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, |
154 base::UTF8ToUTF16(extension->name())); | 174 base::UTF8ToUTF16(extension->name())); |
155 } | 175 } |
156 return true; | 176 return true; |
157 } | 177 } |
158 return false; | 178 return false; |
159 } | 179 } |
160 | 180 |
161 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |