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

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

Issue 5742008: Clean up threading model of external extension providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 12 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 9e4206c5ec52c2aca46140d20b4cb2f435a0c3c2..0f54748902357228017e122d71af8927d158fd6d 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -99,6 +99,7 @@ class ExtensionService
: public base::RefCountedThreadSafe<ExtensionService,
BrowserThread::DeleteOnUIThread>,
public ExtensionUpdateService,
+ public ExternalExtensionProvider::Visitor,
public NotificationObserver {
public:
// Information about a registered component extension.
@@ -297,10 +298,6 @@ class ExtensionService
// Check for updates (or potentially new extensions from external providers)
void CheckForExternalUpdates();
- // Copies the list of force-installed extensions from the user PrefService
- // to ExternalPolicyExtensionProvider.
- void UpdateExternalPolicyExtensionProvider();
-
// Unload the specified extension.
void UnloadExtension(const std::string& extension_id,
UnloadedExtensionInfo::Reason reason);
@@ -342,13 +339,6 @@ class ExtensionService
// extension.
const SkBitmap& GetOmniboxPopupIcon(const std::string& extension_id);
- // Clear all ExternalExtensionProviders.
- void ClearProvidersForTesting();
-
- // Sets an ExternalExtensionProvider for the service to use during testing.
- // Takes ownership of |test_provider|.
- void AddProviderForTesting(ExternalExtensionProvider* test_provider);
-
// Called when the initial extensions load has completed.
virtual void OnLoadedInstalledExtensions();
@@ -358,12 +348,6 @@ class ExtensionService
// Called by the backend when an extension has been installed.
void OnExtensionInstalled(const Extension* extension);
- // Called by the backend when an external extension is found.
- void OnExternalExtensionFileFound(const std::string& id,
- const std::string& version,
- const FilePath& path,
- Extension::Location location);
-
// Checks if the privileges requested by |extension| have increased, and if
// so, disables the extension and prompts the user to approve the change.
void DisableIfPrivilegeIncrease(const Extension* extension);
@@ -425,6 +409,29 @@ class ExtensionService
// view has been created.
void DidCreateRenderViewForBackgroundPage(ExtensionHost* host);
+ // For the extension in |version_path| with |id|, check to see if it's an
+ // externally managed extension. If so, uninstall it.
+ void CheckExternalUninstall(const std::string& id);
+
+ // Clear all ExternalExtensionProviders.
+ void ClearProvidersForTesting();
+
+ // Adds an ExternalExtensionProvider for the service to use during testing.
+ // Takes ownership of |test_provider|.
+ void AddProviderForTesting(ExternalExtensionProvider* test_provider);
+
+ // ExternalExtensionProvider::Visitor implementation.
+ virtual void OnExternalExtensionFileFound(const std::string& id,
+ const Version* version,
+ const FilePath& path,
+ Extension::Location location);
+
+ virtual void OnExternalExtensionUpdateUrlFound(const std::string& id,
+ const GURL& update_url,
+ Extension::Location location);
+
+ virtual void OnExternalProviderReady();
+
// NotificationObserver
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -589,6 +596,16 @@ class ExtensionService
// Flag to make sure event routers are only initialized once.
bool event_routers_initialized_;
+ // A collection of external extension providers. Each provider reads
+ // a source of external extension information. Examples include the
+ // windows registry and external_extensions.json.
+ ProviderCollection external_extension_providers_;
+
+ // Set to true by OnExternalExtensionUpdateUrlFound() when an external
+ // extension URL is found. Used in CheckForExternalUpdates() to see
+ // if an update check is needed to install pending extensions.
+ bool external_extension_added_;
+
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
UpdatePendingExtensionAlreadyInstalled);
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,

Powered by Google App Engine
This is Rietveld 408576698