diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:01:25 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:01:25 +0000 |
commit | 631cf822bd6e64cf469544b42c9975f5602c29a6 (patch) | |
tree | b6038ba798fe06b216931a051c3167bd3b30c02b /chrome/browser/extensions/extensions_service.h | |
parent | e9a4513ccdb40e341a699285d174b60f20736966 (diff) | |
download | chromium_src-631cf822bd6e64cf469544b42c9975f5602c29a6.zip chromium_src-631cf822bd6e64cf469544b42c9975f5602c29a6.tar.gz chromium_src-631cf822bd6e64cf469544b42c9975f5602c29a6.tar.bz2 |
Add ExtensionsService::Uninstall() plus unit tests.
Haven't hooked this up to anything yet though. Still trying to figure out the best way to shut everything down, so I figured I'd send this easy part out alone.
Review URL: http://codereview.chromium.org/113376
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service.h')
-rw-r--r-- | chrome/browser/extensions/extensions_service.h | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index 31b8f90e..481cdd2 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -33,15 +33,6 @@ class ExtensionsServiceFrontendInterface // The message loop to invoke the frontend's methods on. virtual MessageLoop* GetMessageLoop() = 0; - // 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 - // immediately loaded. - virtual void InstallExtension(const FilePath& extension_path) = 0; - - // Load the extension from the directory |extension_path|. - virtual void LoadExtension(const FilePath& extension_path) = 0; - // Called when extensions are loaded by the backend. The frontend takes // ownership of the list. virtual void OnExtensionsLoaded(ExtensionList* extensions) = 0; @@ -56,10 +47,6 @@ class ExtensionsServiceFrontendInterface // action using the fact that the user chose to reinstall the extension as a // signal (for example, setting the default theme to the extension). virtual void OnExtensionVersionReinstalled(const std::string& id) = 0; - - // Lookup an extension by |id|. - virtual Extension* GetExtensionByID(std::string id) = 0; - }; @@ -77,13 +64,26 @@ class ExtensionsService : public ExtensionsServiceFrontendInterface { // Initialize and start all installed extensions. bool Init(); + // 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 + // immediately loaded. + void InstallExtension(const FilePath& extension_path); + + // Uninstalls the specified extension. Callers should only call this method + // with extensions that exist and are "internal". + void UninstallExtension(const std::string& extension_id); + + // Load the extension from the directory |extension_path|. + void LoadExtension(const FilePath& extension_path); + + // Lookup an extension by |id|. + virtual Extension* GetExtensionByID(std::string id); + // ExtensionsServiceFrontendInterface virtual MessageLoop* GetMessageLoop(); - virtual void InstallExtension(const FilePath& extension_path); - virtual void LoadExtension(const FilePath& extension_path); virtual void OnExtensionsLoaded(ExtensionList* extensions); virtual void OnExtensionInstalled(Extension* extension, bool is_update); - virtual Extension* GetExtensionByID(std::string id); virtual void OnExtensionVersionReinstalled(const std::string& id); // The name of the file that the current active version number is stored in. @@ -151,6 +151,11 @@ class ExtensionsServiceBackend void CheckForExternalUpdates( scoped_refptr<ExtensionsServiceFrontendInterface> frontend); + // Deletes all versions of the extension from the filesystem. Note that only + // extensions whose location() == INTERNAL can be uninstalled. Attempting to + // uninstall other extensions will silently fail. + void UninstallExtension(const std::string& extension_id); + private: // Load a single extension from |extension_path|, the top directory of // a specific extension where its manifest file lives. @@ -217,10 +222,6 @@ class ExtensionsServiceBackend // uninstalled. bool CheckExternalUninstall(const FilePath& path, const std::string& id); - // Deletes all versions of the extension from the filesystem. - // |path| points at a specific extension version dir. - void UninstallExtension(const FilePath& path); - // Should an extension of |id| and |version| be installed? // Returns true if no extension of type |id| is installed or if |version| // is greater than the current installed version. |