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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 bool StandardManagementPolicyProvider::MustRemainEnabled( | 127 bool StandardManagementPolicyProvider::MustRemainEnabled( |
128 const Extension* extension, | 128 const Extension* extension, |
129 base::string16* error) const { | 129 base::string16* error) const { |
130 return !AdminPolicyIsModifiable(extension, error) || | 130 return !AdminPolicyIsModifiable(extension, error) || |
131 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && | 131 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && |
132 ExternalComponentLoader::IsModifiable(extension)); | 132 ExternalComponentLoader::IsModifiable(extension)); |
133 } | 133 } |
134 | 134 |
| 135 bool StandardManagementPolicyProvider::MustRemainInstalled( |
| 136 const Extension* extension, |
| 137 base::string16* error) const { |
| 138 ExtensionManagement::InstallationMode mode = |
| 139 settings_->GetInstallationMode(extension->id()); |
| 140 // Disallow removing of recommended extension, to avoid re-install it |
| 141 // again while policy is reload. But disabling of recommended extension is |
| 142 // allowed. |
| 143 if (mode == ExtensionManagement::INSTALLATION_FORCED || |
| 144 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { |
| 145 if (error) { |
| 146 *error = l10n_util::GetStringFUTF16( |
| 147 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, |
| 148 base::UTF8ToUTF16(extension->name())); |
| 149 } |
| 150 return true; |
| 151 } |
| 152 return false; |
| 153 } |
| 154 |
135 } // namespace extensions | 155 } // namespace extensions |
OLD | NEW |