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

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

Issue 165414: Disable an extension when it is upgraded to a version that requires more (Closed)
Patch Set: more comments Created 11 years, 4 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
« no previous file with comments | « chrome/browser/extensions/extension_ui_unittest.cc ('k') | chrome/browser/extensions/extensions_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service.h
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index fe0a5455de668212ec186f390d8d0039d3ff88b9..fafe97e9a507dc03bca3230c3f039ad62d3a5244 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -87,8 +87,9 @@ class ExtensionsService
virtual ~ExtensionsService();
// Gets the list of currently installed extensions.
- virtual const ExtensionList* extensions() const {
- return &extensions_;
+ virtual const ExtensionList* extensions() const { return &extensions_; }
+ virtual const ExtensionList* disabled_extensions() const {
+ return &disabled_extensions_;
}
const FilePath& install_directory() const { return install_directory_; }
@@ -96,6 +97,11 @@ class ExtensionsService
// Initialize and start all installed extensions.
void Init();
+ // Look up an extension by ID.
+ Extension* GetExtensionById(const std::string& id) {
+ return GetExtensionByIdInternal(id, true, false);
+ }
+
// Install the extension file at |extension_path|. Will install as an
// update if an older version is already installed.
// For fresh installs, this method also causes the extension to be
@@ -123,6 +129,11 @@ class ExtensionsService
void UninstallExtension(const std::string& extension_id,
bool external_uninstall);
+ // Enable a previously disabled extension and reload it. The extension should
+ // already exist in the extension prefs.
+ // TODO(mpcomplete): add DisableExtension.
+ void EnableExtension(const std::string& extension_id);
+
// Load the extension from the directory |extension_path|.
void LoadExtension(const FilePath& extension_path);
@@ -144,9 +155,6 @@ class ExtensionsService
// Scan the extension directory and clean up the cruft.
void GarbageCollectExtensions();
- // Lookup an extension by |id|.
- virtual Extension* GetExtensionById(const std::string& id);
-
// Lookup an extension by |url|. This uses the host of the URL as the id.
Extension* GetExtensionByURL(const GURL& url);
@@ -202,6 +210,12 @@ class ExtensionsService
bool is_ready() { return ready_; }
private:
+ // Look up an extension by ID, optionally including either or both of enabled
+ // and disabled extensions.
+ Extension* GetExtensionByIdInternal(const std::string& id,
+ bool include_enabled,
+ bool include_disabled);
+
// The profile this ExtensionsService is part of.
Profile* profile_;
@@ -214,6 +228,9 @@ class ExtensionsService
// The current list of installed extensions.
ExtensionList extensions_;
+ // The list of installed extensions that have been disabled.
+ ExtensionList disabled_extensions_;
+
// The full path to the directory where extensions are installed.
FilePath install_directory_;
« no previous file with comments | « chrome/browser/extensions/extension_ui_unittest.cc ('k') | chrome/browser/extensions/extensions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698