| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/external_extension_provider_impl.h" | 5 #include "chrome/browser/extensions/external_extension_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 *location = loc; | 215 *location = loc; |
| 216 | 216 |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // static | 220 // static |
| 221 void ExternalExtensionProviderImpl::CreateExternalProviders( | 221 void ExternalExtensionProviderImpl::CreateExternalProviders( |
| 222 VisitorInterface* service, | 222 VisitorInterface* service, |
| 223 Profile* profile, | 223 Profile* profile, |
| 224 ProviderCollection* provider_list) { | 224 ProviderCollection* provider_list) { |
| 225 |
| 226 // On Mac OS, items in /Library/... should be written by the superuser. |
| 227 // Check that all components of the path are writable by root only. |
| 228 ExternalPrefExtensionLoader::Options options; |
| 229 #if defined(OS_MACOSX) |
| 230 options = ExternalPrefExtensionLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; |
| 231 #else |
| 232 options = ExternalPrefExtensionLoader::NONE; |
| 233 #endif |
| 234 |
| 225 provider_list->push_back( | 235 provider_list->push_back( |
| 226 linked_ptr<ExternalExtensionProviderInterface>( | 236 linked_ptr<ExternalExtensionProviderInterface>( |
| 227 new ExternalExtensionProviderImpl( | 237 new ExternalExtensionProviderImpl( |
| 228 service, | 238 service, |
| 229 new ExternalPrefExtensionLoader( | 239 new ExternalPrefExtensionLoader( |
| 230 chrome::DIR_EXTERNAL_EXTENSIONS), | 240 chrome::DIR_EXTERNAL_EXTENSIONS, options), |
| 231 Extension::EXTERNAL_PREF, | 241 Extension::EXTERNAL_PREF, |
| 232 Extension::EXTERNAL_PREF_DOWNLOAD))); | 242 Extension::EXTERNAL_PREF_DOWNLOAD))); |
| 233 | 243 |
| 244 #if defined(OS_MACOSX) |
| 245 // Support old path to external extensions file as we migrate to the |
| 246 // new one. See crbug/67203. |
| 247 provider_list->push_back( |
| 248 linked_ptr<ExternalExtensionProviderInterface>( |
| 249 new ExternalExtensionProviderImpl( |
| 250 service, |
| 251 new ExternalPrefExtensionLoader( |
| 252 chrome::DIR_DEPRICATED_EXTERNAL_EXTENSIONS, |
| 253 ExternalPrefExtensionLoader::NONE), |
| 254 Extension::EXTERNAL_PREF, |
| 255 Extension::EXTERNAL_PREF_DOWNLOAD))); |
| 256 #endif |
| 257 |
| 234 #if defined(OS_CHROMEOS) | 258 #if defined(OS_CHROMEOS) |
| 235 // Chrome OS specific source for OEM customization. | 259 // Chrome OS specific source for OEM customization. |
| 236 provider_list->push_back( | 260 provider_list->push_back( |
| 237 linked_ptr<ExternalExtensionProviderInterface>( | 261 linked_ptr<ExternalExtensionProviderInterface>( |
| 238 new ExternalExtensionProviderImpl( | 262 new ExternalExtensionProviderImpl( |
| 239 service, | 263 service, |
| 240 new ExternalPrefExtensionLoader( | 264 new ExternalPrefExtensionLoader( |
| 241 chrome::DIR_USER_EXTERNAL_EXTENSIONS), | 265 chrome::DIR_USER_EXTERNAL_EXTENSIONS), |
| 242 Extension::EXTERNAL_PREF, | 266 Extension::EXTERNAL_PREF, |
| 243 Extension::EXTERNAL_PREF_DOWNLOAD))); | 267 Extension::EXTERNAL_PREF_DOWNLOAD))); |
| 244 #endif | 268 #endif |
| 245 #if defined(OS_WIN) | 269 #if defined(OS_WIN) |
| 246 provider_list->push_back( | 270 provider_list->push_back( |
| 247 linked_ptr<ExternalExtensionProviderInterface>( | 271 linked_ptr<ExternalExtensionProviderInterface>( |
| 248 new ExternalExtensionProviderImpl( | 272 new ExternalExtensionProviderImpl( |
| 249 service, | 273 service, |
| 250 new ExternalRegistryExtensionLoader, | 274 new ExternalRegistryExtensionLoader, |
| 251 Extension::EXTERNAL_REGISTRY, | 275 Extension::EXTERNAL_REGISTRY, |
| 252 Extension::INVALID))); | 276 Extension::INVALID))); |
| 253 #endif | 277 #endif |
| 254 provider_list->push_back( | 278 provider_list->push_back( |
| 255 linked_ptr<ExternalExtensionProviderInterface>( | 279 linked_ptr<ExternalExtensionProviderInterface>( |
| 256 new ExternalExtensionProviderImpl( | 280 new ExternalExtensionProviderImpl( |
| 257 service, | 281 service, |
| 258 new ExternalPolicyExtensionLoader(profile), | 282 new ExternalPolicyExtensionLoader(profile), |
| 259 Extension::INVALID, | 283 Extension::INVALID, |
| 260 Extension::EXTERNAL_POLICY_DOWNLOAD))); | 284 Extension::EXTERNAL_POLICY_DOWNLOAD))); |
| 261 } | 285 } |
| OLD | NEW |