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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #endif | 69 #endif |
70 } | 70 } |
71 | 71 |
72 bool StandardManagementPolicyProvider::UserMayLoad( | 72 bool StandardManagementPolicyProvider::UserMayLoad( |
73 const Extension* extension, | 73 const Extension* extension, |
74 base::string16* error) const { | 74 base::string16* error) const { |
75 // Component extensions are always allowed. | 75 // Component extensions are always allowed. |
76 if (Manifest::IsComponentLocation(extension->location())) | 76 if (Manifest::IsComponentLocation(extension->location())) |
77 return true; | 77 return true; |
78 | 78 |
| 79 // Shared modules are always allowed too: they only contain resources that |
| 80 // are used by other extensions. The extension that depends on the shared |
| 81 // module may be filtered by policy. |
| 82 if (extension->is_shared_module()) |
| 83 return true; |
| 84 |
79 ExtensionManagement::InstallationMode installation_mode = | 85 ExtensionManagement::InstallationMode installation_mode = |
80 settings_->GetInstallationMode(extension->id()); | 86 settings_->GetInstallationMode(extension->id()); |
81 | 87 |
82 // Force-installed extensions cannot be overwritten manually. | 88 // Force-installed extensions cannot be overwritten manually. |
83 if (!Manifest::IsPolicyLocation(extension->location()) && | 89 if (!Manifest::IsPolicyLocation(extension->location()) && |
84 installation_mode == ExtensionManagement::INSTALLATION_FORCED) { | 90 installation_mode == ExtensionManagement::INSTALLATION_FORCED) { |
85 return ReturnLoadError(extension, error); | 91 return ReturnLoadError(extension, error); |
86 } | 92 } |
87 | 93 |
88 // Check whether the extension type is allowed. | 94 // Check whether the extension type is allowed. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 *error = l10n_util::GetStringFUTF16( | 152 *error = l10n_util::GetStringFUTF16( |
147 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, | 153 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, |
148 base::UTF8ToUTF16(extension->name())); | 154 base::UTF8ToUTF16(extension->name())); |
149 } | 155 } |
150 return true; | 156 return true; |
151 } | 157 } |
152 return false; | 158 return false; |
153 } | 159 } |
154 | 160 |
155 } // namespace extensions | 161 } // namespace extensions |
OLD | NEW |