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 if (!UserMayModifySettings(extension, error)) | |
139 return true; | |
140 ExtensionManagement::InstallationMode mode = | |
141 settings_->GetInstallationMode(extension->id()); | |
142 // Disallowing removing of recommended extension, to avoid re-install it | |
Finnur
2014/10/06 14:01:42
nit: s/Disallowing/Disallow/
binjin
2014/10/06 18:48:47
Done.
| |
143 // again while policy is reload. But disabling of recommended extension is | |
144 // allowed. | |
145 if (mode == ExtensionManagement::INSTALLATION_FORCED || | |
146 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { | |
147 if (error) { | |
148 *error = l10n_util::GetStringFUTF16( | |
149 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, | |
150 base::UTF8ToUTF16(extension->name())); | |
151 } | |
152 return true; | |
153 } | |
154 return false; | |
155 } | |
156 | |
135 } // namespace extensions | 157 } // namespace extensions |
OLD | NEW |