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