| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 #endif | 476 #endif |
| 477 | 477 |
| 478 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 478 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 479 if (!profile->IsSupervised()) { | 479 if (!profile->IsSupervised()) { |
| 480 provider_list->push_back( | 480 provider_list->push_back( |
| 481 linked_ptr<ExternalProviderInterface>( | 481 linked_ptr<ExternalProviderInterface>( |
| 482 new ExternalProviderImpl( | 482 new ExternalProviderImpl( |
| 483 service, | 483 service, |
| 484 new ExternalPrefLoader( | 484 new ExternalPrefLoader( |
| 485 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, | 485 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, |
| 486 ExternalPrefLoader::NONE), | 486 ExternalPrefLoader::NONE, |
| 487 NULL), |
| 487 profile, | 488 profile, |
| 488 Manifest::EXTERNAL_PREF, | 489 Manifest::EXTERNAL_PREF, |
| 489 Manifest::EXTERNAL_PREF_DOWNLOAD, | 490 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 490 bundled_extension_creation_flags))); | 491 bundled_extension_creation_flags))); |
| 491 } | 492 } |
| 492 #endif | 493 #endif |
| 493 | 494 |
| 494 #if defined(OS_CHROMEOS) | 495 #if defined(OS_CHROMEOS) |
| 495 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { | 496 if (!is_chromeos_demo_session && !is_chrome_os_public_session) { |
| 496 int external_apps_path_id = profile->IsSupervised() ? | 497 int external_apps_path_id = profile->IsSupervised() ? |
| 497 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : | 498 chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS : |
| 498 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; | 499 chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS; |
| 500 ExternalPrefLoader::Options pref_load_flags = profile->IsNewProfile() ? |
| 501 ExternalPrefLoader::DELAY_LOAD_UNTIL_PRIORITY_SYNC : |
| 502 ExternalPrefLoader::NONE; |
| 499 provider_list->push_back( | 503 provider_list->push_back( |
| 500 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( | 504 linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl( |
| 501 service, | 505 service, |
| 502 new ExternalPrefLoader(external_apps_path_id, | 506 new ExternalPrefLoader(external_apps_path_id, |
| 503 ExternalPrefLoader::NONE), | 507 pref_load_flags, |
| 508 profile), |
| 504 profile, | 509 profile, |
| 505 Manifest::EXTERNAL_PREF, | 510 Manifest::EXTERNAL_PREF, |
| 506 Manifest::EXTERNAL_PREF_DOWNLOAD, | 511 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 507 bundled_extension_creation_flags))); | 512 bundled_extension_creation_flags))); |
| 508 | 513 |
| 509 // OEM default apps. | 514 // OEM default apps. |
| 510 int oem_extension_creation_flags = | 515 int oem_extension_creation_flags = |
| 511 bundled_extension_creation_flags | Extension::WAS_INSTALLED_BY_OEM; | 516 bundled_extension_creation_flags | Extension::WAS_INSTALLED_BY_OEM; |
| 512 chromeos::ServicesCustomizationDocument* customization = | 517 chromeos::ServicesCustomizationDocument* customization = |
| 513 chromeos::ServicesCustomizationDocument::GetInstance(); | 518 chromeos::ServicesCustomizationDocument::GetInstance(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 535 } | 540 } |
| 536 #endif | 541 #endif |
| 537 | 542 |
| 538 if (!profile->IsSupervised() && !is_chromeos_demo_session) { | 543 if (!profile->IsSupervised() && !is_chromeos_demo_session) { |
| 539 #if !defined(OS_WIN) | 544 #if !defined(OS_WIN) |
| 540 provider_list->push_back( | 545 provider_list->push_back( |
| 541 linked_ptr<ExternalProviderInterface>( | 546 linked_ptr<ExternalProviderInterface>( |
| 542 new ExternalProviderImpl( | 547 new ExternalProviderImpl( |
| 543 service, | 548 service, |
| 544 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, | 549 new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, |
| 545 check_admin_permissions_on_mac), | 550 check_admin_permissions_on_mac, |
| 551 NULL), |
| 546 profile, | 552 profile, |
| 547 Manifest::EXTERNAL_PREF, | 553 Manifest::EXTERNAL_PREF, |
| 548 Manifest::EXTERNAL_PREF_DOWNLOAD, | 554 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 549 bundled_extension_creation_flags))); | 555 bundled_extension_creation_flags))); |
| 550 #endif | 556 #endif |
| 551 | 557 |
| 552 // Define a per-user source of external extensions. | 558 // Define a per-user source of external extensions. |
| 553 #if defined(OS_MACOSX) | 559 #if defined(OS_MACOSX) |
| 554 provider_list->push_back( | 560 provider_list->push_back( |
| 555 linked_ptr<ExternalProviderInterface>( | 561 linked_ptr<ExternalProviderInterface>( |
| 556 new ExternalProviderImpl( | 562 new ExternalProviderImpl( |
| 557 service, | 563 service, |
| 558 new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS, | 564 new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS, |
| 559 ExternalPrefLoader::NONE), | 565 ExternalPrefLoader::NONE, |
| 566 NULL), |
| 560 profile, | 567 profile, |
| 561 Manifest::EXTERNAL_PREF, | 568 Manifest::EXTERNAL_PREF, |
| 562 Manifest::EXTERNAL_PREF_DOWNLOAD, | 569 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 563 Extension::NO_FLAGS))); | 570 Extension::NO_FLAGS))); |
| 564 #endif | 571 #endif |
| 565 | 572 |
| 566 #if defined(OS_WIN) | 573 #if defined(OS_WIN) |
| 567 provider_list->push_back( | 574 provider_list->push_back( |
| 568 linked_ptr<ExternalProviderInterface>( | 575 linked_ptr<ExternalProviderInterface>( |
| 569 new ExternalProviderImpl( | 576 new ExternalProviderImpl( |
| 570 service, | 577 service, |
| 571 new ExternalRegistryLoader, | 578 new ExternalRegistryLoader, |
| 572 profile, | 579 profile, |
| 573 Manifest::EXTERNAL_REGISTRY, | 580 Manifest::EXTERNAL_REGISTRY, |
| 574 Manifest::EXTERNAL_PREF_DOWNLOAD, | 581 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 575 Extension::NO_FLAGS))); | 582 Extension::NO_FLAGS))); |
| 576 #endif | 583 #endif |
| 577 | 584 |
| 578 #if !defined(OS_CHROMEOS) | 585 #if !defined(OS_CHROMEOS) |
| 579 // The default apps are installed as INTERNAL but use the external | 586 // The default apps are installed as INTERNAL but use the external |
| 580 // extension installer codeflow. | 587 // extension installer codeflow. |
| 581 provider_list->push_back( | 588 provider_list->push_back( |
| 582 linked_ptr<ExternalProviderInterface>( | 589 linked_ptr<ExternalProviderInterface>( |
| 583 new default_apps::Provider( | 590 new default_apps::Provider( |
| 584 profile, | 591 profile, |
| 585 service, | 592 service, |
| 586 new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS, | 593 new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS, |
| 587 ExternalPrefLoader::NONE), | 594 ExternalPrefLoader::NONE, |
| 595 NULL), |
| 588 Manifest::INTERNAL, | 596 Manifest::INTERNAL, |
| 589 Manifest::INTERNAL, | 597 Manifest::INTERNAL, |
| 590 Extension::FROM_WEBSTORE | | 598 Extension::FROM_WEBSTORE | |
| 591 Extension::WAS_INSTALLED_BY_DEFAULT))); | 599 Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 592 #endif | 600 #endif |
| 593 | 601 |
| 594 provider_list->push_back( | 602 provider_list->push_back( |
| 595 linked_ptr<ExternalProviderInterface>( | 603 linked_ptr<ExternalProviderInterface>( |
| 596 new ExternalProviderImpl( | 604 new ExternalProviderImpl( |
| 597 service, | 605 service, |
| 598 new ExternalComponentLoader(profile), | 606 new ExternalComponentLoader(profile), |
| 599 profile, | 607 profile, |
| 600 Manifest::INVALID_LOCATION, | 608 Manifest::INVALID_LOCATION, |
| 601 Manifest::EXTERNAL_COMPONENT, | 609 Manifest::EXTERNAL_COMPONENT, |
| 602 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 610 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 603 } | 611 } |
| 604 } | 612 } |
| 605 | 613 |
| 606 } // namespace extensions | 614 } // namespace extensions |
| OLD | NEW |