| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // Check that all components of the path are writable by root only. | 458 // Check that all components of the path are writable by root only. |
| 459 ExternalPrefLoader::Options check_admin_permissions_on_mac; | 459 ExternalPrefLoader::Options check_admin_permissions_on_mac; |
| 460 #if defined(OS_MACOSX) | 460 #if defined(OS_MACOSX) |
| 461 check_admin_permissions_on_mac = | 461 check_admin_permissions_on_mac = |
| 462 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; | 462 ExternalPrefLoader::ENSURE_PATH_CONTROLLED_BY_ADMIN; |
| 463 #else | 463 #else |
| 464 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; | 464 check_admin_permissions_on_mac = ExternalPrefLoader::NONE; |
| 465 #endif | 465 #endif |
| 466 | 466 |
| 467 bool is_chromeos_demo_session = false; | 467 bool is_chromeos_demo_session = false; |
| 468 #if !defined(OS_WIN) |
| 468 int bundled_extension_creation_flags = Extension::NO_FLAGS; | 469 int bundled_extension_creation_flags = Extension::NO_FLAGS; |
| 470 #endif |
| 469 #if defined(OS_CHROMEOS) | 471 #if defined(OS_CHROMEOS) |
| 470 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 472 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 471 is_chromeos_demo_session = | 473 is_chromeos_demo_session = |
| 472 user_manager && user_manager->IsLoggedInAsDemoUser() && | 474 user_manager && user_manager->IsLoggedInAsDemoUser() && |
| 473 connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK; | 475 connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK; |
| 474 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | | 476 bundled_extension_creation_flags = Extension::FROM_WEBSTORE | |
| 475 Extension::WAS_INSTALLED_BY_DEFAULT; | 477 Extension::WAS_INSTALLED_BY_DEFAULT; |
| 476 #endif | |
| 477 | 478 |
| 478 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
| 479 if (!profile->IsSupervised()) { | |
| 480 provider_list->push_back( | |
| 481 linked_ptr<ExternalProviderInterface>( | |
| 482 new ExternalProviderImpl( | |
| 483 service, | |
| 484 new ExternalPrefLoader( | |
| 485 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, | |
| 486 ExternalPrefLoader::NONE, | |
| 487 NULL), | |
| 488 profile, | |
| 489 Manifest::EXTERNAL_PREF, | |
| 490 Manifest::EXTERNAL_PREF_DOWNLOAD, | |
| 491 bundled_extension_creation_flags))); | |
| 492 } | |
| 493 #endif | |
| 494 | |
| 495 #if defined(OS_CHROMEOS) | |
| 496 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { | 479 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { |
| 497 int external_apps_path_id = profile->IsSupervised() ? | 480 int external_apps_path_id = profile->IsSupervised() ? |
| 498 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : | 481 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : |
| 499 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; | 482 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; |
| 500 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ? | 483 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ? |
| 501 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC : | 484 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC : |
| 502 ExternalPrefLoader::NONE; | 485 ExternalPrefLoader::NONE; |
| 503 provider_list->push_back( | 486 provider_list->push_back( |
| 504 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( | 487 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( |
| 505 service, | 488 service, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 531 provider_list->push_back( | 514 provider_list->push_back( |
| 532 linked_ptr<ExternalProviderInterface>( | 515 linked_ptr<ExternalProviderInterface>( |
| 533 new ExternalProviderImpl( | 516 new ExternalProviderImpl( |
| 534 service, | 517 service, |
| 535 app_pack_updater->CreateExternalLoader(), | 518 app_pack_updater->CreateExternalLoader(), |
| 536 profile, | 519 profile, |
| 537 Manifest::EXTERNAL_PREF, | 520 Manifest::EXTERNAL_PREF, |
| 538 Manifest::INVALID_LOCATION, | 521 Manifest::INVALID_LOCATION, |
| 539 Extension::NO_FLAGS))); | 522 Extension::NO_FLAGS))); |
| 540 } | 523 } |
| 524 #elif defined(OS_LINUX) |
| 525 if (!profile->IsSupervised()) { |
| 526 provider_list->push_back( |
| 527 linked_ptr<ExternalProviderInterface>( |
| 528 new ExternalProviderImpl( |
| 529 service, |
| 530 new ExternalPrefLoader( |
| 531 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, |
| 532 ExternalPrefLoader::NONE, |
| 533 NULL), |
| 534 profile, |
| 535 Manifest::EXTERNAL_PREF, |
| 536 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 537 bundled_extension_creation_flags))); |
| 538 } |
| 541 #endif | 539 #endif |
| 542 | 540 |
| 543 if (!profile->IsSupervised() && !is_chromeos_demo_session) { | 541 if (!profile->IsSupervised() && !is_chromeos_demo_session) { |
| 544 #if !defined(OS_WIN) | 542 #if defined(OS_WIN) |
| 545 provider_list->push_back( | 543 provider_list->push_back( |
| 546 linked_ptr<ExternalProviderInterface>( | 544 linked_ptr<ExternalProviderInterface>( |
| 547 new ExternalProviderImpl( | 545 new ExternalProviderImpl( |
| 546 service, |
| 547 new ExternalRegistryLoader, |
| 548 profile, |
| 549 Manifest::EXTERNAL_REGISTRY, |
| 550 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 551 Extension::NO_FLAGS))); |
| 552 #else |
| 553 provider_list->push_back( |
| 554 linked_ptr<ExternalProviderInterface>( |
| 555 new ExternalProviderImpl( |
| 548 service, | 556 service, |
| 549 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, | 557 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, |
| 550 check_admin_permissions_on_mac, | 558 check_admin_permissions_on_mac, |
| 551 NULL), | 559 NULL), |
| 552 profile, | 560 profile, |
| 553 Manifest::EXTERNAL_PREF, | 561 Manifest::EXTERNAL_PREF, |
| 554 Manifest::EXTERNAL_PREF_DOWNLOAD, | 562 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 555 bundled_extension_creation_flags))); | 563 bundled_extension_creation_flags))); |
| 556 #endif | |
| 557 | 564 |
| 558 // Define a per-user source of external extensions. | 565 // Define a per-user source of external extensions. |
| 559 #if defined(OS_MACOSX) | 566 #if defined(OS_MACOSX) |
| 560 provider_list->push_back( | 567 provider_list->push_back( |
| 561 linked_ptr<ExternalProviderInterface>( | 568 linked_ptr<ExternalProviderInterface>( |
| 562 new ExternalProviderImpl( | 569 new ExternalProviderImpl( |
| 563 service, | 570 service, |
| 564 new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS, | 571 new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS, |
| 565 ExternalPrefLoader::NONE, | 572 ExternalPrefLoader::NONE, |
| 566 NULL), | 573 NULL), |
| 567 profile, | 574 profile, |
| 568 Manifest::EXTERNAL_PREF, | 575 Manifest::EXTERNAL_PREF, |
| 569 Manifest::EXTERNAL_PREF_DOWNLOAD, | 576 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 570 Extension::NO_FLAGS))); | 577 Extension::NO_FLAGS))); |
| 571 #endif | 578 #endif |
| 572 | |
| 573 #if defined(OS_WIN) | |
| 574 provider_list->push_back( | |
| 575 linked_ptr<ExternalProviderInterface>( | |
| 576 new ExternalProviderImpl( | |
| 577 service, | |
| 578 new ExternalRegistryLoader, | |
| 579 profile, | |
| 580 Manifest::EXTERNAL_REGISTRY, | |
| 581 Manifest::EXTERNAL_PREF_DOWNLOAD, | |
| 582 Extension::NO_FLAGS))); | |
| 583 #endif | 579 #endif |
| 584 | 580 |
| 585 #if !defined(OS_CHROMEOS) | 581 #if !defined(OS_CHROMEOS) |
| 586 // The default apps are installed as INTERNAL but use the external | 582 // The default apps are installed as INTERNAL but use the external |
| 587 // extension installer codeflow. | 583 // extension installer codeflow. |
| 588 provider_list->push_back( | 584 provider_list->push_back( |
| 589 linked_ptr<ExternalProviderInterface>( | 585 linked_ptr<ExternalProviderInterface>( |
| 590 new default_apps::Provider( | 586 new default_apps::Provider( |
| 591 profile, | 587 profile, |
| 592 service, | 588 service, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 605 service, | 601 service, |
| 606 new ExternalComponentLoader(profile), | 602 new ExternalComponentLoader(profile), |
| 607 profile, | 603 profile, |
| 608 Manifest::INVALID_LOCATION, | 604 Manifest::INVALID_LOCATION, |
| 609 Manifest::EXTERNAL_COMPONENT, | 605 Manifest::EXTERNAL_COMPONENT, |
| 610 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 606 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 611 } | 607 } |
| 612 } | 608 } |
| 613 | 609 |
| 614 } // namespace extensions | 610 } // namespace extensions |
| OLD | NEW |