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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 451 } |
452 | 452 |
453 // Set a callback to be called when all external providers are ready and their | 453 // Set a callback to be called when all external providers are ready and their |
454 // extensions have been installed. | 454 // extensions have been installed. |
455 void set_external_updates_finished_callback_for_test( | 455 void set_external_updates_finished_callback_for_test( |
456 const base::Closure& callback) { | 456 const base::Closure& callback) { |
457 external_updates_finished_callback_ = callback; | 457 external_updates_finished_callback_ = callback; |
458 } | 458 } |
459 | 459 |
460 private: | 460 private: |
| 461 // Loads extensions specified via a command line flag/switch. |
| 462 void LoadExtensionsFromCommandLineFlag(const char* switch_name); |
| 463 |
461 // Reloads the specified extension, sending the onLaunched() event to it if it | 464 // Reloads the specified extension, sending the onLaunched() event to it if it |
462 // currently has any window showing. |be_noisy| determines whether noisy | 465 // currently has any window showing. |be_noisy| determines whether noisy |
463 // failures are allowed for unpacked extension installs. | 466 // failures are allowed for unpacked extension installs. |
464 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); | 467 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
465 | 468 |
466 // content::NotificationObserver implementation: | 469 // content::NotificationObserver implementation: |
467 void Observe(int type, | 470 void Observe(int type, |
468 const content::NotificationSource& source, | 471 const content::NotificationSource& source, |
469 const content::NotificationDetails& details) override; | 472 const content::NotificationDetails& details) override; |
470 | 473 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // the actual profile objects to be destroyed. | 590 // the actual profile objects to be destroyed. |
588 void OnProfileDestructionStarted(); | 591 void OnProfileDestructionStarted(); |
589 | 592 |
590 // Called on file task runner thread to uninstall extension. | 593 // Called on file task runner thread to uninstall extension. |
591 static void UninstallExtensionOnFileThread( | 594 static void UninstallExtensionOnFileThread( |
592 const std::string& id, | 595 const std::string& id, |
593 Profile* profile, | 596 Profile* profile, |
594 const base::FilePath& install_dir, | 597 const base::FilePath& install_dir, |
595 const base::FilePath& extension_path); | 598 const base::FilePath& extension_path); |
596 | 599 |
| 600 const base::CommandLine* command_line_ = nullptr; |
| 601 |
597 // The normal profile associated with this ExtensionService. | 602 // The normal profile associated with this ExtensionService. |
598 Profile* profile_ = nullptr; | 603 Profile* profile_ = nullptr; |
599 | 604 |
600 // The ExtensionSystem for the profile above. | 605 // The ExtensionSystem for the profile above. |
601 extensions::ExtensionSystem* system_ = nullptr; | 606 extensions::ExtensionSystem* system_ = nullptr; |
602 | 607 |
603 // Preferences for the owning profile. | 608 // Preferences for the owning profile. |
604 extensions::ExtensionPrefs* extension_prefs_ = nullptr; | 609 extensions::ExtensionPrefs* extension_prefs_ = nullptr; |
605 | 610 |
606 // Blacklist for the owning profile. | 611 // Blacklist for the owning profile. |
607 extensions::Blacklist* blacklist_ = nullptr; | 612 extensions::Blacklist* blacklist_ = nullptr; |
608 | 613 |
609 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. | 614 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. |
610 extensions::ExtensionRegistry* registry_ = nullptr; | 615 extensions::ExtensionRegistry* registry_ = nullptr; |
611 | 616 |
612 // Set of greylisted extensions. These extensions are disabled if they are | 617 // Set of greylisted extensions. These extensions are disabled if they are |
613 // already installed in Chromium at the time when they are added to | 618 // already installed in Chromium at the time when they are added to |
614 // the greylist. Unlike blacklisted extensions, greylisted ones are visible | 619 // the greylist. Unlike blacklisted extensions, greylisted ones are visible |
615 // to the user and if user re-enables such an extension, they remain enabled. | 620 // to the user and if user re-enables such an extension, they remain enabled. |
616 // | 621 // |
617 // These extensions should appear in registry_. | 622 // These extensions should appear in registry_. |
618 extensions::ExtensionSet greylist_; | 623 extensions::ExtensionSet greylist_; |
619 | 624 |
| 625 // Set of whitelisted enabled extensions loaded from the |
| 626 // --disable-extensions-except command line flag. |
| 627 std::set<std::string> disable_flag_exempted_extensions_; |
| 628 |
620 // The list of extension installs delayed for various reasons. The reason | 629 // The list of extension installs delayed for various reasons. The reason |
621 // for delayed install is stored in ExtensionPrefs. These are not part of | 630 // for delayed install is stored in ExtensionPrefs. These are not part of |
622 // ExtensionRegistry because they are not yet installed. | 631 // ExtensionRegistry because they are not yet installed. |
623 extensions::ExtensionSet delayed_installs_; | 632 extensions::ExtensionSet delayed_installs_; |
624 | 633 |
625 // Hold the set of pending extensions. | 634 // Hold the set of pending extensions. |
626 extensions::PendingExtensionManager pending_extension_manager_; | 635 extensions::PendingExtensionManager pending_extension_manager_; |
627 | 636 |
628 // The full path to the directory where extensions are installed. | 637 // The full path to the directory where extensions are installed. |
629 base::FilePath install_directory_; | 638 base::FilePath install_directory_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 GreylistUnknownDontChange); | 755 GreylistUnknownDontChange); |
747 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 756 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
748 ManagementPolicyProhibitsEnableOnInstalled); | 757 ManagementPolicyProhibitsEnableOnInstalled); |
749 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 758 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
750 BlockAndUnblockBlacklistedExtension); | 759 BlockAndUnblockBlacklistedExtension); |
751 | 760 |
752 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 761 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
753 }; | 762 }; |
754 | 763 |
755 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 764 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |