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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 bool StandardManagementPolicyProvider::MustRemainEnabled( | 136 bool StandardManagementPolicyProvider::MustRemainEnabled( |
137 const Extension* extension, | 137 const Extension* extension, |
138 base::string16* error) const { | 138 base::string16* error) const { |
139 return !AdminPolicyIsModifiable(extension, error) || | 139 return !AdminPolicyIsModifiable(extension, error) || |
140 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && | 140 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && |
141 ExternalComponentLoader::IsModifiable(extension)); | 141 ExternalComponentLoader::IsModifiable(extension)); |
142 } | 142 } |
143 | 143 |
| 144 bool StandardManagementPolicyProvider::MustRemainInstalled( |
| 145 const Extension* extension, |
| 146 base::string16* error) const { |
| 147 if (!UserMayModifySettings(extension, error)) |
| 148 return true; |
| 149 ExtensionManagement::InstallationMode mode = |
| 150 settings_->ReadById(extension->id()).installation_mode; |
| 151 // Disallowing removing of recommended extension, to avoid re-install it |
| 152 // again while policy is reload. But disabling of recommended extension is |
| 153 // allowed. |
| 154 if (mode == ExtensionManagement::INSTALLATION_FORCED || |
| 155 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { |
| 156 if (error) { |
| 157 *error = l10n_util::GetStringFUTF16( |
| 158 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, |
| 159 base::UTF8ToUTF16(extension->name())); |
| 160 } |
| 161 return true; |
| 162 } |
| 163 return false; |
| 164 } |
| 165 |
144 } // namespace extensions | 166 } // namespace extensions |
OLD | NEW |