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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 browser_terminating_ = value; | 449 browser_terminating_ = value; |
| 450 } | 450 } |
| 451 | 451 |
| 452 // Set a callback to be called when all external providers are ready and their | 452 // Set a callback to be called when all external providers are ready and their |
| 453 // extensions have been installed. | 453 // extensions have been installed. |
| 454 void set_external_updates_finished_callback_for_test( | 454 void set_external_updates_finished_callback_for_test( |
| 455 const base::Closure& callback) { | 455 const base::Closure& callback) { |
| 456 external_updates_finished_callback_ = callback; | 456 external_updates_finished_callback_ = callback; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void AddExtensionToWhitelist(const std::string& extensionId) { | |
|
Devlin
2016/07/27 17:00:59
"Whitelist" here is still pretty vague. But this
catmullings
2016/08/04 22:59:30
Done.
| |
| 460 enabled_extensions_whitelist_.insert(extensionId); | |
| 461 } | |
| 462 | |
| 463 bool IsExtensionWhitelisted(const std::string& extensionId) { | |
| 464 return enabled_extensions_whitelist_.find(extensionId) != | |
| 465 enabled_extensions_whitelist_.end(); | |
| 466 } | |
| 467 | |
| 459 private: | 468 private: |
| 460 // Reloads the specified extension, sending the onLaunched() event to it if it | 469 // Reloads the specified extension, sending the onLaunched() event to it if it |
| 461 // currently has any window showing. |be_noisy| determines whether noisy | 470 // currently has any window showing. |be_noisy| determines whether noisy |
| 462 // failures are allowed for unpacked extension installs. | 471 // failures are allowed for unpacked extension installs. |
| 463 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); | 472 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
| 464 | 473 |
| 465 // content::NotificationObserver implementation: | 474 // content::NotificationObserver implementation: |
| 466 void Observe(int type, | 475 void Observe(int type, |
| 467 const content::NotificationSource& source, | 476 const content::NotificationSource& source, |
| 468 const content::NotificationDetails& details) override; | 477 const content::NotificationDetails& details) override; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 extensions::ExtensionRegistry* registry_ = nullptr; | 618 extensions::ExtensionRegistry* registry_ = nullptr; |
| 610 | 619 |
| 611 // Set of greylisted extensions. These extensions are disabled if they are | 620 // Set of greylisted extensions. These extensions are disabled if they are |
| 612 // already installed in Chromium at the time when they are added to | 621 // already installed in Chromium at the time when they are added to |
| 613 // the greylist. Unlike blacklisted extensions, greylisted ones are visible | 622 // the greylist. Unlike blacklisted extensions, greylisted ones are visible |
| 614 // to the user and if user re-enables such an extension, they remain enabled. | 623 // to the user and if user re-enables such an extension, they remain enabled. |
| 615 // | 624 // |
| 616 // These extensions should appear in registry_. | 625 // These extensions should appear in registry_. |
| 617 extensions::ExtensionSet greylist_; | 626 extensions::ExtensionSet greylist_; |
| 618 | 627 |
| 628 // Set of whitelisted enabled extensions loaded from the | |
| 629 // --disable-extensions-except command line flag. | |
| 630 std::set<std::string> enabled_extensions_whitelist_; | |
| 631 | |
| 619 // The list of extension installs delayed for various reasons. The reason | 632 // The list of extension installs delayed for various reasons. The reason |
| 620 // for delayed install is stored in ExtensionPrefs. These are not part of | 633 // for delayed install is stored in ExtensionPrefs. These are not part of |
| 621 // ExtensionRegistry because they are not yet installed. | 634 // ExtensionRegistry because they are not yet installed. |
| 622 extensions::ExtensionSet delayed_installs_; | 635 extensions::ExtensionSet delayed_installs_; |
| 623 | 636 |
| 624 // Hold the set of pending extensions. | 637 // Hold the set of pending extensions. |
| 625 extensions::PendingExtensionManager pending_extension_manager_; | 638 extensions::PendingExtensionManager pending_extension_manager_; |
| 626 | 639 |
| 627 // The full path to the directory where extensions are installed. | 640 // The full path to the directory where extensions are installed. |
| 628 base::FilePath install_directory_; | 641 base::FilePath install_directory_; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 GreylistUnknownDontChange); | 752 GreylistUnknownDontChange); |
| 740 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 753 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 741 ManagementPolicyProhibitsEnableOnInstalled); | 754 ManagementPolicyProhibitsEnableOnInstalled); |
| 742 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 755 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 743 BlockAndUnblockBlacklistedExtension); | 756 BlockAndUnblockBlacklistedExtension); |
| 744 | 757 |
| 745 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 758 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 746 }; | 759 }; |
| 747 | 760 |
| 748 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 761 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |