Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 33 #include "extensions/browser/external_provider_interface.h" | 33 #include "extensions/browser/external_provider_interface.h" |
| 34 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/manifest.h" | 35 #include "extensions/common/manifest.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 | 37 |
| 38 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
| 39 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 39 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 40 #include "chrome/browser/chromeos/customization_document.h" | 40 #include "chrome/browser/chromeos/customization_document.h" |
| 41 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h" | 41 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h" |
| 42 #include "chrome/browser/chromeos/policy/app_pack_updater.h" | |
| 43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 44 #include "chrome/browser/chromeos/policy/device_local_account.h" | 43 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 45 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 44 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 46 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 45 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 47 #include "components/user_manager/user.h" | 46 #include "components/user_manager/user.h" |
| 48 #include "components/user_manager/user_manager.h" | 47 #include "components/user_manager/user_manager.h" |
|
bartfab (slow)
2014/10/15 09:52:21
Nit: No longer used.
rkc
2014/11/20 21:06:34
Done.
| |
| 49 #else | 48 #else |
| 50 #include "chrome/browser/extensions/default_apps.h" | 49 #include "chrome/browser/extensions/default_apps.h" |
| 51 #endif | 50 #endif |
| 52 | 51 |
| 53 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| 54 #include "chrome/browser/extensions/external_registry_loader_win.h" | 53 #include "chrome/browser/extensions/external_registry_loader_win.h" |
| 55 #endif | 54 #endif |
| 56 | 55 |
| 57 using content::BrowserThread; | 56 using content::BrowserThread; |
| 58 | 57 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 // On Mac OS, items in /Library/... should be written by the superuser. | 436 // On Mac OS, items in /Library/... should be written by the superuser. |
| 438 // Check that all components of the path are writable by root only. | 437 // Check that all components of the path are writable by root only. |
| 439 ExternalPrefLoader::Options check_admin_permissions_on_mac; | 438 ExternalPrefLoader::Options check_admin_permissions_on_mac; |
| 440 #if defined(OS_MACOSX) | 439 #if defined(OS_MACOSX) |
| 441 check_admin_permissions_on_mac = | 440 check_admin_permissions_on_mac = |
| 442 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; | 441 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; |
| 443 #else | 442 #else |
| 444 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; | 443 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; |
| 445 #endif | 444 #endif |
| 446 | 445 |
| 447 bool is_chromeos_demo_session = false; | |
| 448 int bundled_extension_creation_flags = Extension::NO_FLAGS; | 446 int bundled_extension_creation_flags = Extension::NO_FLAGS; |
| 449 #if defined(OS_CHROMEOS) | 447 #if defined(OS_CHROMEOS) |
| 450 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | |
| 451 is_chromeos_demo_session = | |
| 452 user_manager && user_manager->IsLoggedInAsDemoUser() && | |
| 453 connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK; | |
| 454 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | | 448 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | |
| 455 Extension::WAS_INSTALLED_BY_DEFAULT; | 449 Extension::WAS_INSTALLED_BY_DEFAULT; |
| 456 #endif | 450 #endif |
| 457 | 451 |
| 458 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 452 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 459 if (!profile->IsSupervised()) { | 453 if (!profile->IsSupervised()) { |
| 460 provider_list->push_back( | 454 provider_list->push_back( |
| 461 linked_ptr<ExternalProviderInterface>( | 455 linked_ptr<ExternalProviderInterface>( |
| 462 new ExternalProviderImpl( | 456 new ExternalProviderImpl( |
| 463 service, | 457 service, |
| 464 new ExternalPrefLoader( | 458 new ExternalPrefLoader( |
| 465 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, | 459 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, |
| 466 ExternalPrefLoader::NONE), | 460 ExternalPrefLoader::NONE), |
| 467 profile, | 461 profile, |
| 468 Manifest::EXTERNAL_PREF, | 462 Manifest::EXTERNAL_PREF, |
| 469 Manifest::EXTERNAL_PREF_DOWNLOAD, | 463 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 470 bundled_extension_creation_flags))); | 464 bundled_extension_creation_flags))); |
| 471 } | 465 } |
| 472 #endif | 466 #endif |
| 473 | 467 |
| 474 #if defined(OS_CHROMEOS) | 468 #if defined(OS_CHROMEOS) |
| 475 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { | 469 if (!is_chrome_os_public_session) { |
| 476 int external_apps_path_id = profile->IsSupervised() ? | 470 int external_apps_path_id = profile->IsSupervised() ? |
| 477 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : | 471 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : |
| 478 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; | 472 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; |
| 479 provider_list->push_back( | 473 provider_list->push_back( |
| 480 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( | 474 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( |
| 481 service, | 475 service, |
| 482 new ExternalPrefLoader(external_apps_path_id, | 476 new ExternalPrefLoader(external_apps_path_id, |
| 483 ExternalPrefLoader::NONE), | 477 ExternalPrefLoader::NONE), |
| 484 profile, | 478 profile, |
| 485 Manifest::EXTERNAL_PREF, | 479 Manifest::EXTERNAL_PREF, |
| 486 Manifest::EXTERNAL_PREF_DOWNLOAD, | 480 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 487 bundled_extension_creation_flags))); | 481 bundled_extension_creation_flags))); |
| 488 | 482 |
| 489 // OEM default apps. | 483 // OEM default apps. |
| 490 int oem_extension_creation_flags = | 484 int oem_extension_creation_flags = |
| 491 bundled_extension_creation_flags | Extension::WAS_INSTALLED_BY_OEM; | 485 bundled_extension_creation_flags | Extension::WAS_INSTALLED_BY_OEM; |
| 492 chromeos::ServicesCustomizationDocument* customization = | 486 chromeos::ServicesCustomizationDocument* customization = |
| 493 chromeos::ServicesCustomizationDocument::GetInstance(); | 487 chromeos::ServicesCustomizationDocument::GetInstance(); |
| 494 provider_list->push_back(linked_ptr<ExternalProviderInterface>( | 488 provider_list->push_back(linked_ptr<ExternalProviderInterface>( |
| 495 new ExternalProviderImpl(service, | 489 new ExternalProviderImpl(service, |
| 496 customization->CreateExternalLoader(profile), | 490 customization->CreateExternalLoader(profile), |
| 497 profile, | 491 profile, |
| 498 Manifest::EXTERNAL_PREF, | 492 Manifest::EXTERNAL_PREF, |
| 499 Manifest::EXTERNAL_PREF_DOWNLOAD, | 493 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 500 oem_extension_creation_flags))); | 494 oem_extension_creation_flags))); |
| 501 } | 495 } |
| 502 | |
| 503 policy::AppPackUpdater* app_pack_updater = connector->GetAppPackUpdater(); | |
| 504 if (is_chromeos_demo_session && app_pack_updater && | |
| 505 !app_pack_updater->created_external_loader()) { | |
| 506 provider_list->push_back( | |
| 507 linked_ptr<ExternalProviderInterface>( | |
| 508 new ExternalProviderImpl( | |
| 509 service, | |
| 510 app_pack_updater->CreateExternalLoader(), | |
| 511 profile, | |
| 512 Manifest::EXTERNAL_PREF, | |
| 513 Manifest::INVALID_LOCATION, | |
| 514 Extension::NO_FLAGS))); | |
| 515 } | |
| 516 #endif | 496 #endif |
| 517 | 497 |
| 518 if (!profile->IsSupervised() && !is_chromeos_demo_session) { | 498 if (!profile->IsSupervised()) { |
| 519 #if !defined(OS_WIN) | 499 #if !defined(OS_WIN) |
| 520 provider_list->push_back( | 500 provider_list->push_back( |
| 521 linked_ptr<ExternalProviderInterface>( | 501 linked_ptr<ExternalProviderInterface>( |
| 522 new ExternalProviderImpl( | 502 new ExternalProviderImpl( |
| 523 service, | 503 service, |
| 524 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, | 504 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, |
| 525 check_admin_permissions_on_mac), | 505 check_admin_permissions_on_mac), |
| 526 profile, | 506 profile, |
| 527 Manifest::EXTERNAL_PREF, | 507 Manifest::EXTERNAL_PREF, |
| 528 Manifest::EXTERNAL_PREF_DOWNLOAD, | 508 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 service, | 557 service, |
| 578 new ExternalComponentLoader(profile), | 558 new ExternalComponentLoader(profile), |
| 579 profile, | 559 profile, |
| 580 Manifest::INVALID_LOCATION, | 560 Manifest::INVALID_LOCATION, |
| 581 Manifest::EXTERNAL_COMPONENT, | 561 Manifest::EXTERNAL_COMPONENT, |
| 582 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 562 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 583 } | 563 } |
| 584 } | 564 } |
| 585 | 565 |
| 586 } // namespace extensions | 566 } // namespace extensions |
| OLD | NEW |