Index: chrome/browser/extensions/extension_garbage_collector.h |
diff --git a/chrome/browser/extensions/extension_garbage_collector.h b/chrome/browser/extensions/extension_garbage_collector.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7075990259e7993648636fc99a1e5e64b66ebb23 |
--- /dev/null |
+++ b/chrome/browser/extensions/extension_garbage_collector.h |
@@ -0,0 +1,45 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
+#pragma once |
+ |
+#include <set> |
+ |
+#include "base/file_path.h" |
+#include "base/memory/ref_counted.h" |
+ |
+class ExtensionService; |
+ |
+// Garbage collection for extensions. This will delete any directories in the |
+// installation directory of |extension_service_| that aren't valid, as well |
+// as removing any references in the preferences to extensions that are |
+// missing local content. |
+class ExtensionGarbageCollector |
+ : public base::RefCountedThreadSafe<ExtensionGarbageCollector> { |
+ public: |
+ explicit ExtensionGarbageCollector(ExtensionService* extension_service); |
+ virtual ~ExtensionGarbageCollector(); |
+ |
+ // Begin garbage collection; fetch the installed extensions' ids. |
+ void GarbageCollectExtensions(); |
+ |
+ private: |
+ // Check the installation directory for directories with invalid extension |
+ // ids, deleting them if found. Call CheckExtensionPreferences with a list of |
+ // present directories. |
+ void CheckExtensionDirectories(const FilePath& installation_directory); |
Aaron Boodman
2012/04/05 21:53:14
Can you add "OnBackgroundThread" to the methods th
Aaron Boodman
2012/04/07 18:01:03
You forgot this bit.
Devlin
2012/04/14 18:13:21
Whoops, done.
|
+ |
+ // Check for any extension directories which: |
+ // - Are an old version of a current extension; |
+ // - Are present in the preferences but not on the file system; |
+ // - Are present on the file system, but not in the preferences |
+ // and delete them if found. |
+ void CheckExtensionPreferences(const std::set<FilePath>& extension_paths); |
+ |
+ ExtensionService* extension_service_; |
+}; |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |