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) { | |
460 whitelist_.insert(extensionId); | |
461 } | |
462 | |
463 bool IsExtensionWhitelisted(const std::string& extensionId) { | |
464 return whitelist_.find(extensionId) != whitelist_.end(); | |
465 } | |
466 | |
459 private: | 467 private: |
460 // Reloads the specified extension, sending the onLaunched() event to it if it | 468 // Reloads the specified extension, sending the onLaunched() event to it if it |
461 // currently has any window showing. |be_noisy| determines whether noisy | 469 // currently has any window showing. |be_noisy| determines whether noisy |
462 // failures are allowed for unpacked extension installs. | 470 // failures are allowed for unpacked extension installs. |
463 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); | 471 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
464 | 472 |
465 // content::NotificationObserver implementation: | 473 // content::NotificationObserver implementation: |
466 void Observe(int type, | 474 void Observe(int type, |
467 const content::NotificationSource& source, | 475 const content::NotificationSource& source, |
468 const content::NotificationDetails& details) override; | 476 const content::NotificationDetails& details) override; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
609 extensions::ExtensionRegistry* registry_ = nullptr; | 617 extensions::ExtensionRegistry* registry_ = nullptr; |
610 | 618 |
611 // Set of greylisted extensions. These extensions are disabled if they are | 619 // Set of greylisted extensions. These extensions are disabled if they are |
612 // already installed in Chromium at the time when they are added to | 620 // already installed in Chromium at the time when they are added to |
613 // the greylist. Unlike blacklisted extensions, greylisted ones are visible | 621 // the greylist. Unlike blacklisted extensions, greylisted ones are visible |
614 // to the user and if user re-enables such an extension, they remain enabled. | 622 // to the user and if user re-enables such an extension, they remain enabled. |
615 // | 623 // |
616 // These extensions should appear in registry_. | 624 // These extensions should appear in registry_. |
617 extensions::ExtensionSet greylist_; | 625 extensions::ExtensionSet greylist_; |
618 | 626 |
627 // Set of whitelisted extensions. | |
628 std::set<std::string> whitelist_; | |
Devlin
2016/07/25 19:10:29
Whitelisted for what?
catmullings
2016/07/27 01:29:45
WDYT of enabled_extensions_whitelist_ ?
I could b
Devlin
2016/07/27 17:00:59
enabled_extensions_whitelist still sounds a little
catmullings
2016/08/04 22:59:30
Done.
catmullings
2016/08/04 22:59:30
I like disable_flag_exempted_extensions_. I'll go
| |
629 | |
619 // The list of extension installs delayed for various reasons. The reason | 630 // The list of extension installs delayed for various reasons. The reason |
620 // for delayed install is stored in ExtensionPrefs. These are not part of | 631 // for delayed install is stored in ExtensionPrefs. These are not part of |
621 // ExtensionRegistry because they are not yet installed. | 632 // ExtensionRegistry because they are not yet installed. |
622 extensions::ExtensionSet delayed_installs_; | 633 extensions::ExtensionSet delayed_installs_; |
623 | 634 |
624 // Hold the set of pending extensions. | 635 // Hold the set of pending extensions. |
625 extensions::PendingExtensionManager pending_extension_manager_; | 636 extensions::PendingExtensionManager pending_extension_manager_; |
626 | 637 |
627 // The full path to the directory where extensions are installed. | 638 // The full path to the directory where extensions are installed. |
628 base::FilePath install_directory_; | 639 base::FilePath install_directory_; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 GreylistUnknownDontChange); | 750 GreylistUnknownDontChange); |
740 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 751 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
741 ManagementPolicyProhibitsEnableOnInstalled); | 752 ManagementPolicyProhibitsEnableOnInstalled); |
742 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 753 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
743 BlockAndUnblockBlacklistedExtension); | 754 BlockAndUnblockBlacklistedExtension); |
744 | 755 |
745 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 756 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
746 }; | 757 }; |
747 | 758 |
748 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 759 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |