| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 *location = loc; | 307 *location = loc; |
| 308 | 308 |
| 309 return true; | 309 return true; |
| 310 } | 310 } |
| 311 | 311 |
| 312 // static | 312 // static |
| 313 void ExternalProviderImpl::CreateExternalProviders( | 313 void ExternalProviderImpl::CreateExternalProviders( |
| 314 VisitorInterface* service, | 314 VisitorInterface* service, |
| 315 Profile* profile, | 315 Profile* profile, |
| 316 ProviderCollection* provider_list) { | 316 ProviderCollection* provider_list) { |
| 317 // Policies are mandatory so they can't be skipped with command line flag. |
| 318 provider_list->push_back( |
| 319 linked_ptr<ExternalProviderInterface>( |
| 320 new ExternalProviderImpl( |
| 321 service, |
| 322 new ExternalPolicyLoader(profile), |
| 323 Extension::INVALID, |
| 324 Extension::EXTERNAL_POLICY_DOWNLOAD, |
| 325 Extension::NO_FLAGS))); |
| 326 |
| 327 // In tests don't install extensions from default external sources. |
| 328 // It would only slowdown tests and make them flaky. |
| 329 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 330 switches::kDisableDefaultApps)) |
| 331 return; |
| 317 | 332 |
| 318 // On Mac OS, items in /Library/... should be written by the superuser. | 333 // On Mac OS, items in /Library/... should be written by the superuser. |
| 319 // Check that all components of the path are writable by root only. | 334 // Check that all components of the path are writable by root only. |
| 320 ExternalPrefLoader::Options check_admin_permissions_on_mac; | 335 ExternalPrefLoader::Options check_admin_permissions_on_mac; |
| 321 #if defined(OS_MACOSX) | 336 #if defined(OS_MACOSX) |
| 322 check_admin_permissions_on_mac = | 337 check_admin_permissions_on_mac = |
| 323 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; | 338 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; |
| 324 #else | 339 #else |
| 325 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; | 340 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; |
| 326 #endif | 341 #endif |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 linked_ptr<ExternalProviderInterface>( | 393 linked_ptr<ExternalProviderInterface>( |
| 379 new ExternalProviderImpl( | 394 new ExternalProviderImpl( |
| 380 service, | 395 service, |
| 381 new ExternalPrefLoader(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, | 396 new ExternalPrefLoader(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, |
| 382 ExternalPrefLoader::NONE), | 397 ExternalPrefLoader::NONE), |
| 383 Extension::EXTERNAL_PREF, | 398 Extension::EXTERNAL_PREF, |
| 384 Extension::EXTERNAL_PREF_DOWNLOAD, | 399 Extension::EXTERNAL_PREF_DOWNLOAD, |
| 385 bundled_extension_creation_flags))); | 400 bundled_extension_creation_flags))); |
| 386 #endif | 401 #endif |
| 387 | 402 |
| 388 provider_list->push_back( | |
| 389 linked_ptr<ExternalProviderInterface>( | |
| 390 new ExternalProviderImpl( | |
| 391 service, | |
| 392 new ExternalPolicyLoader(profile), | |
| 393 Extension::INVALID, | |
| 394 Extension::EXTERNAL_POLICY_DOWNLOAD, | |
| 395 Extension::NO_FLAGS))); | |
| 396 | |
| 397 #if !defined(OS_CHROMEOS) | 403 #if !defined(OS_CHROMEOS) |
| 398 // The default apps are installed as INTERNAL but use the external | 404 // The default apps are installed as INTERNAL but use the external |
| 399 // extension installer codeflow. | 405 // extension installer codeflow. |
| 400 provider_list->push_back( | 406 provider_list->push_back( |
| 401 linked_ptr<ExternalProviderInterface>( | 407 linked_ptr<ExternalProviderInterface>( |
| 402 new default_apps::Provider( | 408 new default_apps::Provider( |
| 403 profile, | 409 profile, |
| 404 service, | 410 service, |
| 405 new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS, | 411 new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS, |
| 406 ExternalPrefLoader::NONE), | 412 ExternalPrefLoader::NONE), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 420 service, | 426 service, |
| 421 connector->GetAppPackUpdater()->CreateExternalLoader(), | 427 connector->GetAppPackUpdater()->CreateExternalLoader(), |
| 422 Extension::EXTERNAL_PREF, | 428 Extension::EXTERNAL_PREF, |
| 423 Extension::INVALID, | 429 Extension::INVALID, |
| 424 Extension::NO_FLAGS))); | 430 Extension::NO_FLAGS))); |
| 425 } | 431 } |
| 426 #endif | 432 #endif |
| 427 } | 433 } |
| 428 | 434 |
| 429 } // namespace extensions | 435 } // namespace extensions |
| OLD | NEW |