Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 695133005: Temporarily disable extensions and sync while a profile is locked - Profiles Approach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove BLOCKED state. Other kalman@ comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // cannot be disabled, does nothing. 288 // cannot be disabled, does nothing.
289 virtual void DisableExtension( 289 virtual void DisableExtension(
290 const std::string& extension_id, 290 const std::string& extension_id,
291 extensions::Extension::DisableReason disable_reason); 291 extensions::Extension::DisableReason disable_reason);
292 292
293 // Disable non-default and non-managed extensions with ids not in 293 // Disable non-default and non-managed extensions with ids not in
294 // |except_ids|. Default extensions are those from the Web Store with 294 // |except_ids|. Default extensions are those from the Web Store with
295 // |was_installed_by_default| flag. 295 // |was_installed_by_default| flag.
296 void DisableUserExtensions(const std::vector<std::string>& except_ids); 296 void DisableUserExtensions(const std::vector<std::string>& except_ids);
297 297
298 // Puts all extensions in a blocked state: Unloading every extension, and
299 // preventing them from ever loading until UnlockAllExtensions is called. This
not at google - send to devlin 2014/11/19 20:20:41 Seeing the "lock" word here not "block" (which is
Mike Lerman 2014/11/20 17:18:33 Changed to block.
300 // state is stored in preferences, so persists until Chrome restarts.
301 //
302 // Component, external component and whitelisted policy installed extensions
303 // are exempt from beck Blocked (see CanBlockExtension).
not at google - send to devlin 2014/11/19 20:20:41 beck --> being
Mike Lerman 2014/11/20 17:18:33 Done.
304 void BlockAllExtensions();
305
306 // All blocked extensions are reverted to their previous state, and are
307 // reloaded. Newly added extensions are no longer automatically blocked.
308 void UnblockAllExtensions();
309
298 // Updates the |extension|'s granted permissions lists to include all 310 // Updates the |extension|'s granted permissions lists to include all
299 // permissions in the |extension|'s manifest and re-enables the 311 // permissions in the |extension|'s manifest and re-enables the
300 // extension. 312 // extension.
301 void GrantPermissionsAndEnableExtension( 313 void GrantPermissionsAndEnableExtension(
302 const extensions::Extension* extension); 314 const extensions::Extension* extension);
303 315
304 // Updates the |extension|'s granted permissions lists to include all 316 // Updates the |extension|'s granted permissions lists to include all
305 // permissions in the |extensions|'s manifest. 317 // permissions in the |extensions|'s manifest.
306 void GrantPermissions(const extensions::Extension* extension); 318 void GrantPermissions(const extensions::Extension* extension);
307 319
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 void CheckPermissionsIncrease(const extensions::Extension* extension, 556 void CheckPermissionsIncrease(const extensions::Extension* extension,
545 bool is_extension_installed); 557 bool is_extension_installed);
546 558
547 // Helper that updates the active extension list used for crash reporting. 559 // Helper that updates the active extension list used for crash reporting.
548 void UpdateActiveExtensionsInCrashReporter(); 560 void UpdateActiveExtensionsInCrashReporter();
549 561
550 // Helper to determine whether we should initially enable an installed 562 // Helper to determine whether we should initially enable an installed
551 // (or upgraded) extension. 563 // (or upgraded) extension.
552 bool ShouldEnableOnInstall(const extensions::Extension* extension); 564 bool ShouldEnableOnInstall(const extensions::Extension* extension);
553 565
566 // Helper method to determine if an extension can be blocked.
567 bool CanBlockExtension(const extensions::Extension* extension) const;
Mike Lerman 2014/11/19 14:54:34 Made this const so it can be called from IsExtensi
not at google - send to devlin 2014/11/19 20:20:41 Thanks. There are a lot of functions that should b
568
554 // Helper to determine if updating an extensions should proceed immediately, 569 // Helper to determine if updating an extensions should proceed immediately,
555 // or if we should delay the update until further notice. 570 // or if we should delay the update until further notice.
556 bool ShouldDelayExtensionUpdate(const std::string& extension_id, 571 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
557 bool install_immediately) const; 572 bool install_immediately) const;
558 573
559 // Manages the blacklisted extensions, intended as callback from 574 // Manages the blacklisted extensions, intended as callback from
560 // Blacklist::GetBlacklistedIDs. 575 // Blacklist::GetBlacklistedIDs.
561 void ManageBlacklist( 576 void ManageBlacklist(
562 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids); 577 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
563 578
564 // Add extensions in |blocked| to blacklisted_extensions, remove extensions 579 // Add extensions in |blacklisted| to blacklisted_extensions, remove
565 // that are neither in |blocked|, nor in |unchanged|. 580 // extensions that are neither in |blacklisted|, nor in |unchanged|.
566 void UpdateBlockedExtensions(const extensions::ExtensionIdSet& blocked, 581 void UpdateBlacklistedExtensions(
567 const extensions::ExtensionIdSet& unchanged); 582 const extensions::ExtensionIdSet& to_blacklist,
583 const extensions::ExtensionIdSet& unchanged);
568 584
569 void UpdateGreylistedExtensions( 585 void UpdateGreylistedExtensions(
570 const extensions::ExtensionIdSet& greylist, 586 const extensions::ExtensionIdSet& greylist,
571 const extensions::ExtensionIdSet& unchanged, 587 const extensions::ExtensionIdSet& unchanged,
572 const extensions::Blacklist::BlacklistStateMap& state_map); 588 const extensions::Blacklist::BlacklistStateMap& state_map);
573 589
574 // Used only by test code. 590 // Used only by test code.
575 void UnloadAllExtensionsInternal(); 591 void UnloadAllExtensionsInternal();
576 592
577 // Disable apps & extensions now to stop them from running after a profile 593 // Disable apps & extensions now to stop them from running after a profile
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 // allow background processing of garbage collection of on-disk state without 698 // allow background processing of garbage collection of on-disk state without
683 // needing to worry about race conditions caused by extension installation and 699 // needing to worry about race conditions caused by extension installation and
684 // reinstallation. 700 // reinstallation.
685 bool installs_delayed_for_gc_; 701 bool installs_delayed_for_gc_;
686 702
687 // Set to true if this is the first time this ExtensionService has run. 703 // Set to true if this is the first time this ExtensionService has run.
688 // Used for specially handling external extensions that are installed the 704 // Used for specially handling external extensions that are installed the
689 // first time. 705 // first time.
690 bool is_first_run_; 706 bool is_first_run_;
691 707
708 // Set to true if extensions are all to be blocked.
709 bool block_extensions_;
710
692 // Store the ids of reloading extensions. We use this to re-enable extensions 711 // Store the ids of reloading extensions. We use this to re-enable extensions
693 // which were disabled for a reload. 712 // which were disabled for a reload.
694 std::set<std::string> reloading_extensions_; 713 std::set<std::string> reloading_extensions_;
695 714
696 // A set of the extension ids currently being terminated. We use this to 715 // A set of the extension ids currently being terminated. We use this to
697 // avoid trying to unload the same extension twice. 716 // avoid trying to unload the same extension twice.
698 std::set<std::string> extensions_being_terminated_; 717 std::set<std::string> extensions_being_terminated_;
699 718
700 // The controller for the UI that alerts the user about any blacklisted 719 // The controller for the UI that alerts the user about any blacklisted
701 // extensions. 720 // extensions.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 GreylistedExtensionDisabled); 752 GreylistedExtensionDisabled);
734 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 753 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
735 GreylistDontEnableManuallyDisabled); 754 GreylistDontEnableManuallyDisabled);
736 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 755 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
737 GreylistUnknownDontChange); 756 GreylistUnknownDontChange);
738 757
739 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 758 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
740 }; 759 };
741 760
742 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 761 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698