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 #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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 browser_terminating_ = value; | 450 browser_terminating_ = value; |
| 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 void AddExtensionToExemptedFromDisableFlag(const std::string& extensionId) { | |
|
Devlin
2016/08/10 19:22:31
A few notes here.
- These functions are pretty sim
catmullings
2016/08/29 20:42:27
I'll go with the first option.
Done.
| |
| 461 disable_flag_exempted_extensions_.insert(extensionId); | |
| 462 } | |
| 463 | |
| 464 bool IsExtensionExemptedFromDisableFlag(const std::string& extensionId) { | |
| 465 return disable_flag_exempted_extensions_.find(extensionId) != | |
| 466 disable_flag_exempted_extensions_.end(); | |
| 467 } | |
| 468 | |
| 460 private: | 469 private: |
| 470 void LoadExtensionsFromCommandLineFlag(const char* switch_name); | |
| 471 | |
| 461 // Reloads the specified extension, sending the onLaunched() event to it if it | 472 // Reloads the specified extension, sending the onLaunched() event to it if it |
| 462 // currently has any window showing. |be_noisy| determines whether noisy | 473 // currently has any window showing. |be_noisy| determines whether noisy |
| 463 // failures are allowed for unpacked extension installs. | 474 // failures are allowed for unpacked extension installs. |
| 464 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); | 475 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
| 465 | 476 |
| 466 // content::NotificationObserver implementation: | 477 // content::NotificationObserver implementation: |
| 467 void Observe(int type, | 478 void Observe(int type, |
| 468 const content::NotificationSource& source, | 479 const content::NotificationSource& source, |
| 469 const content::NotificationDetails& details) override; | 480 const content::NotificationDetails& details) override; |
| 470 | 481 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 // the actual profile objects to be destroyed. | 598 // the actual profile objects to be destroyed. |
| 588 void OnProfileDestructionStarted(); | 599 void OnProfileDestructionStarted(); |
| 589 | 600 |
| 590 // Called on file task runner thread to uninstall extension. | 601 // Called on file task runner thread to uninstall extension. |
| 591 static void UninstallExtensionOnFileThread( | 602 static void UninstallExtensionOnFileThread( |
| 592 const std::string& id, | 603 const std::string& id, |
| 593 Profile* profile, | 604 Profile* profile, |
| 594 const base::FilePath& install_dir, | 605 const base::FilePath& install_dir, |
| 595 const base::FilePath& extension_path); | 606 const base::FilePath& extension_path); |
| 596 | 607 |
| 608 const base::CommandLine* command_line_ = nullptr; | |
| 609 | |
| 597 // The normal profile associated with this ExtensionService. | 610 // The normal profile associated with this ExtensionService. |
| 598 Profile* profile_ = nullptr; | 611 Profile* profile_ = nullptr; |
| 599 | 612 |
| 600 // The ExtensionSystem for the profile above. | 613 // The ExtensionSystem for the profile above. |
| 601 extensions::ExtensionSystem* system_ = nullptr; | 614 extensions::ExtensionSystem* system_ = nullptr; |
| 602 | 615 |
| 603 // Preferences for the owning profile. | 616 // Preferences for the owning profile. |
| 604 extensions::ExtensionPrefs* extension_prefs_ = nullptr; | 617 extensions::ExtensionPrefs* extension_prefs_ = nullptr; |
| 605 | 618 |
| 606 // Blacklist for the owning profile. | 619 // Blacklist for the owning profile. |
| 607 extensions::Blacklist* blacklist_ = nullptr; | 620 extensions::Blacklist* blacklist_ = nullptr; |
| 608 | 621 |
| 609 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. | 622 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. |
| 610 extensions::ExtensionRegistry* registry_ = nullptr; | 623 extensions::ExtensionRegistry* registry_ = nullptr; |
| 611 | 624 |
| 612 // Set of greylisted extensions. These extensions are disabled if they are | 625 // Set of greylisted extensions. These extensions are disabled if they are |
| 613 // already installed in Chromium at the time when they are added to | 626 // already installed in Chromium at the time when they are added to |
| 614 // the greylist. Unlike blacklisted extensions, greylisted ones are visible | 627 // the greylist. Unlike blacklisted extensions, greylisted ones are visible |
| 615 // to the user and if user re-enables such an extension, they remain enabled. | 628 // to the user and if user re-enables such an extension, they remain enabled. |
| 616 // | 629 // |
| 617 // These extensions should appear in registry_. | 630 // These extensions should appear in registry_. |
| 618 extensions::ExtensionSet greylist_; | 631 extensions::ExtensionSet greylist_; |
| 619 | 632 |
| 633 // Set of whitelisted enabled extensions loaded from the | |
| 634 // --disable-extensions-except command line flag. | |
| 635 std::set<std::string> disable_flag_exempted_extensions_; | |
| 636 | |
| 620 // The list of extension installs delayed for various reasons. The reason | 637 // The list of extension installs delayed for various reasons. The reason |
| 621 // for delayed install is stored in ExtensionPrefs. These are not part of | 638 // for delayed install is stored in ExtensionPrefs. These are not part of |
| 622 // ExtensionRegistry because they are not yet installed. | 639 // ExtensionRegistry because they are not yet installed. |
| 623 extensions::ExtensionSet delayed_installs_; | 640 extensions::ExtensionSet delayed_installs_; |
| 624 | 641 |
| 625 // Hold the set of pending extensions. | 642 // Hold the set of pending extensions. |
| 626 extensions::PendingExtensionManager pending_extension_manager_; | 643 extensions::PendingExtensionManager pending_extension_manager_; |
| 627 | 644 |
| 628 // The full path to the directory where extensions are installed. | 645 // The full path to the directory where extensions are installed. |
| 629 base::FilePath install_directory_; | 646 base::FilePath install_directory_; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 GreylistUnknownDontChange); | 763 GreylistUnknownDontChange); |
| 747 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 764 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 748 ManagementPolicyProhibitsEnableOnInstalled); | 765 ManagementPolicyProhibitsEnableOnInstalled); |
| 749 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 766 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 750 BlockAndUnblockBlacklistedExtension); | 767 BlockAndUnblockBlacklistedExtension); |
| 751 | 768 |
| 752 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 769 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 753 }; | 770 }; |
| 754 | 771 |
| 755 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 772 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |