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

Unified Diff: chrome/browser/extensions/extension_service.h

Issue 12211029: Sanity tweaks to the extension blacklist: check all extensions at once on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 7 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.h
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index f2dc4b84f78ff79f7684e48fdb803f0d70d04d88..8df4b0907c27d25561008c202756eeaef220fdf6 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -61,7 +61,6 @@ class BrowserEventRouter;
class ComponentLoader;
class ContentSettingsStore;
class CrxInstaller;
-class Extension;
class ExtensionActionStorageManager;
class ExtensionSyncData;
class ExtensionSystem;
@@ -117,6 +116,7 @@ class ExtensionServiceInterface : public syncer::SyncableService {
// themes sync to not use it directly.
virtual void CheckForUpdatesSoon() = 0;
+ virtual void AddExtensions(const extensions::ExtensionList& extensions) = 0;
virtual void AddExtension(const extensions::Extension* extension) = 0;
virtual void AddComponentExtension(
const extensions::Extension* extension) = 0;
@@ -428,19 +428,39 @@ class ExtensionService
// Called when the initial extensions load has completed.
virtual void OnLoadedInstalledExtensions();
- // Adds |extension| to this ExtensionService and notifies observers than an
- // extension has been loaded. Called by the backend after an extension has
- // been loaded from a file and installed.
+ // Adds every extension in |extensions| to this ExtensionService and notifies
+ // observers that the extensions have been loaded, then asynchronously checks
+ // those against the blacklist.
+ //
+ // If possible, please check the blacklist ahead of time, since this method
+ // may end up loading blacklisted extensions for a short period of time.
+ virtual void AddExtensions(
+ const extensions::ExtensionList& extensions) OVERRIDE;
+
+ // Calls AddExtensions with a single extension, please see comment.
virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
// Check if we have preferences for the component extension and, if not or if
// the stored version differs, install the extension (without requirements
- // checking) before calling AddExtension.
+ // checking) before calling AddNonBlacklistedExtension.
virtual void AddComponentExtension(const extensions::Extension* extension)
OVERRIDE;
- // Called by the backend when an extension has been installed.
- void OnExtensionInstalled(
Matt Perry 2013/02/07 01:05:35 After thinking about it, I can see the reasoning b
Matt Perry 2013/02/07 01:10:23 Actually, lets just make it explicit. Keep OnExten
not at google - send to devlin 2013/02/07 02:11:37 Done.
+ // Instructs the extension service to install an extension some point in the
+ // future, then runs |on_done|.
+ //
+ // If installation succeeds the callback will be passed true. If it fails
+ // (e.g. due to blacklisting) then it will be passed false.
+ void InstallExtensionAsync(
+ const extensions::Extension* extension,
+ const syncer::StringOrdinal& page_ordinal,
+ bool has_requirement_errors,
+ bool wait_for_idle,
+ const base::Callback<void(bool /*success*/)>& on_done);
+
+ // Instructs the extension service to install an extension now. No blacklist
+ // checking is done.
+ void InstallExtensionNow(
const extensions::Extension* extension,
const syncer::StringOrdinal& page_ordinal,
bool has_requirement_errors,
@@ -756,10 +776,13 @@ class ExtensionService
// terminated extensions if it is there.
void UntrackTerminatedExtension(const std::string& id);
+ // Adds an extension to the service without checking any blacklist.
+ bool AddNonBlacklistedExtension(const extensions::Extension* extension);
+
// Update preferences for a new or updated extension; notify observers that
// the extension is installed, e.g., to update event handlers on background
// pages; and perform other extension install tasks before calling
- // AddExtension.
+ // AddNonBlacklistedExtension.
void AddNewOrUpdatedExtension(const extensions::Extension* extension,
extensions::Extension::State initial_state,
const syncer::StringOrdinal& page_ordinal);

Powered by Google App Engine
This is Rietveld 408576698