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

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

Issue 714133002: Add more management policy checking after extension installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix CrOS compile 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 // Removes the extension with the given id from the list of 514 // Removes the extension with the given id from the list of
515 // terminated extensions if it is there. 515 // terminated extensions if it is there.
516 void UntrackTerminatedExtension(const std::string& id); 516 void UntrackTerminatedExtension(const std::string& id);
517 517
518 // Update preferences for a new or updated extension; notify observers that 518 // Update preferences for a new or updated extension; notify observers that
519 // the extension is installed, e.g., to update event handlers on background 519 // the extension is installed, e.g., to update event handlers on background
520 // pages; and perform other extension install tasks before calling 520 // pages; and perform other extension install tasks before calling
521 // AddExtension. 521 // AddExtension.
522 // |install_flags| is a bitmask of extensions::InstallFlags. 522 // |install_flags| is a bitmask of extensions::InstallFlags.
523 void AddNewOrUpdatedExtension(const extensions::Extension* extension, 523 void AddNewOrUpdatedExtension(
524 extensions::Extension::State initial_state, 524 const extensions::Extension* extension,
525 int install_flags, 525 extensions::Extension::State initial_state,
526 const syncer::StringOrdinal& page_ordinal, 526 extensions::Extension::DisableReason initial_disable_reason,
Finnur 2014/11/11 22:58:03 I think |initial_state| and |initial_disable_reaso
not at google - send to devlin 2014/11/12 00:54:19 This is pretty weird to look at (and looking at th
binjin 2014/11/12 16:33:18 Yes, I now followed your first proposal.
not at google - send to devlin 2014/11/12 16:38:42 Cool! If you're going with this, it would be ideal
not at google - send to devlin 2014/11/12 16:40:33 And perhaps a 3rd earlier to do the rename that Fi
527 const std::string& install_parameter); 527 int install_flags,
528 const syncer::StringOrdinal& page_ordinal,
529 const std::string& install_parameter);
528 530
529 // Handles sending notification that |extension| was loaded. 531 // Handles sending notification that |extension| was loaded.
530 void NotifyExtensionLoaded(const extensions::Extension* extension); 532 void NotifyExtensionLoaded(const extensions::Extension* extension);
531 533
532 // Handles sending notification that |extension| was unloaded. 534 // Handles sending notification that |extension| was unloaded.
533 void NotifyExtensionUnloaded( 535 void NotifyExtensionUnloaded(
534 const extensions::Extension* extension, 536 const extensions::Extension* extension,
535 extensions::UnloadedExtensionInfo::Reason reason); 537 extensions::UnloadedExtensionInfo::Reason reason);
536 538
537 // Common helper to finish installing the given extension. |was_ephemeral| 539 // Common helper to finish installing the given extension. |was_ephemeral|
538 // should be true if the extension was previously installed and ephemeral. 540 // should be true if the extension was previously installed and ephemeral.
539 void FinishInstallation(const extensions::Extension* extension, 541 void FinishInstallation(const extensions::Extension* extension,
540 bool was_ephemeral); 542 bool was_ephemeral);
541 543
542 // Disables the extension if the privilege level has increased 544 // Disables the extension if the privilege level has increased
543 // (e.g., due to an upgrade). 545 // (e.g., due to an upgrade).
544 void CheckPermissionsIncrease(const extensions::Extension* extension, 546 void CheckPermissionsIncrease(const extensions::Extension* extension,
545 bool is_extension_installed); 547 bool is_extension_installed);
546 548
547 // Helper that updates the active extension list used for crash reporting. 549 // Helper that updates the active extension list used for crash reporting.
548 void UpdateActiveExtensionsInCrashReporter(); 550 void UpdateActiveExtensionsInCrashReporter();
549 551
550 // Helper to determine whether we should initially enable an installed 552 // Helper to determine whether we should initially enable an installed
551 // (or upgraded) extension. 553 // (or upgraded) extension. If we should not initially enable the extension
552 bool ShouldEnableOnInstall(const extensions::Extension* extension); 554 // and |disable_reason| is not null, set it to be DisableReason if
555 // applicable.
Finnur 2014/11/11 22:58:03 This comment is a bit confusing. How about: |disa
binjin 2014/11/12 16:33:18 Done.
556 bool ShouldEnableOnInstall(
557 const extensions::Extension* extension,
558 extensions::Extension::DisableReason* disable_reason);
553 559
554 // Helper to determine if updating an extensions should proceed immediately, 560 // Helper to determine if updating an extensions should proceed immediately,
555 // or if we should delay the update until further notice. 561 // or if we should delay the update until further notice.
556 bool ShouldDelayExtensionUpdate(const std::string& extension_id, 562 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
557 bool install_immediately) const; 563 bool install_immediately) const;
558 564
559 // Manages the blacklisted extensions, intended as callback from 565 // Manages the blacklisted extensions, intended as callback from
560 // Blacklist::GetBlacklistedIDs. 566 // Blacklist::GetBlacklistedIDs.
561 void ManageBlacklist( 567 void ManageBlacklist(
562 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids); 568 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 734 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
729 WillNotLoadBlacklistedExtensionsFromDirectory); 735 WillNotLoadBlacklistedExtensionsFromDirectory);
730 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, ReloadBlacklistedExtension); 736 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, ReloadBlacklistedExtension);
731 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, BlacklistedInPrefsFromStartup); 737 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, BlacklistedInPrefsFromStartup);
732 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 738 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
733 GreylistedExtensionDisabled); 739 GreylistedExtensionDisabled);
734 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 740 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
735 GreylistDontEnableManuallyDisabled); 741 GreylistDontEnableManuallyDisabled);
736 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 742 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
737 GreylistUnknownDontChange); 743 GreylistUnknownDontChange);
744 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
745 ManagementPolicyProhibitsEnableOnInstalled);
738 746
739 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 747 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
740 }; 748 };
741 749
742 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 750 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698