| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 30 #include "extensions/browser/extension_system.h" | 30 #include "extensions/browser/extension_system.h" |
| 31 #include "extensions/browser/external_provider_interface.h" | 31 #include "extensions/browser/external_provider_interface.h" |
| 32 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
| 33 #include "extensions/common/manifest.h" | 33 #include "extensions/common/manifest.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 35 | 35 |
| 36 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 37 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 37 #include "chrome/browser/chromeos/customization_document.h" | 38 #include "chrome/browser/chromeos/customization_document.h" |
| 38 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" | 39 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" |
| 39 #include "chrome/browser/chromeos/login/users/user.h" | 40 #include "chrome/browser/chromeos/login/users/user.h" |
| 40 #include "chrome/browser/chromeos/login/users/user_manager.h" | 41 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 41 #include "chrome/browser/chromeos/policy/app_pack_updater.h" | 42 #include "chrome/browser/chromeos/policy/app_pack_updater.h" |
| 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 43 #include "chrome/browser/chromeos/policy/device_local_account.h" | 44 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 44 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 45 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 45 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 46 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 46 #else | 47 #else |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 linked_ptr<ExternalProviderInterface>( | 392 linked_ptr<ExternalProviderInterface>( |
| 392 new ExternalProviderImpl( | 393 new ExternalProviderImpl( |
| 393 service, | 394 service, |
| 394 external_loader, | 395 external_loader, |
| 395 profile, | 396 profile, |
| 396 crx_location, | 397 crx_location, |
| 397 Manifest::EXTERNAL_POLICY_DOWNLOAD, | 398 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
| 398 Extension::NO_FLAGS))); | 399 Extension::NO_FLAGS))); |
| 399 } | 400 } |
| 400 | 401 |
| 402 // Load the KioskAppExternalProvider when running in kiosk mode. |
| 403 if (chrome::IsRunningInForcedAppMode()) { |
| 404 #if defined(OS_CHROMEOS) |
| 405 chromeos::KioskAppManager* kiosk_app_manager = |
| 406 chromeos::KioskAppManager::Get(); |
| 407 DCHECK(kiosk_app_manager); |
| 408 if (kiosk_app_manager && !kiosk_app_manager->external_loader_created()) { |
| 409 provider_list->push_back(linked_ptr<ExternalProviderInterface>( |
| 410 new ExternalProviderImpl(service, |
| 411 kiosk_app_manager->CreateExternalLoader(), |
| 412 profile, |
| 413 Manifest::EXTERNAL_PREF, |
| 414 Manifest::INVALID_LOCATION, |
| 415 Extension::NO_FLAGS))); |
| 416 } |
| 417 #endif |
| 418 return; |
| 419 } |
| 420 |
| 401 // In tests don't install extensions from default external sources. | 421 // In tests don't install extensions from default external sources. |
| 402 // It would only slowdown tests and make them flaky. | 422 // It would only slowdown tests and make them flaky. |
| 403 if (CommandLine::ForCurrentProcess()->HasSwitch( | 423 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 404 switches::kDisableDefaultApps)) | 424 switches::kDisableDefaultApps)) |
| 405 return; | 425 return; |
| 406 | 426 |
| 407 // No external app install in app mode. | |
| 408 if (chrome::IsRunningInForcedAppMode()) | |
| 409 return; | |
| 410 | |
| 411 // On Mac OS, items in /Library/... should be written by the superuser. | 427 // On Mac OS, items in /Library/... should be written by the superuser. |
| 412 // Check that all components of the path are writable by root only. | 428 // Check that all components of the path are writable by root only. |
| 413 ExternalPrefLoader::Options check_admin_permissions_on_mac; | 429 ExternalPrefLoader::Options check_admin_permissions_on_mac; |
| 414 #if defined(OS_MACOSX) | 430 #if defined(OS_MACOSX) |
| 415 check_admin_permissions_on_mac = | 431 check_admin_permissions_on_mac = |
| 416 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; | 432 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; |
| 417 #else | 433 #else |
| 418 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; | 434 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; |
| 419 #endif | 435 #endif |
| 420 | 436 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 service, | 567 service, |
| 552 new ExternalComponentLoader(profile), | 568 new ExternalComponentLoader(profile), |
| 553 profile, | 569 profile, |
| 554 Manifest::INVALID_LOCATION, | 570 Manifest::INVALID_LOCATION, |
| 555 Manifest::EXTERNAL_COMPONENT, | 571 Manifest::EXTERNAL_COMPONENT, |
| 556 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 572 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 557 } | 573 } |
| 558 } | 574 } |
| 559 | 575 |
| 560 } // namespace extensions | 576 } // namespace extensions |
| OLD | NEW |