Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 | |
| 14 class ExtensionService; | |
| 15 | |
| 16 // Garbage collection for extensions. This will delete any directories in the | |
| 17 // installation directory of |extension_service_| that aren't valid, as well | |
| 18 // as removing any references in the preferences to extensions that are | |
| 19 // missing local content. | |
| 20 class ExtensionGarbageCollector | |
| 21 : public base::RefCountedThreadSafe<ExtensionGarbageCollector> { | |
| 22 public: | |
| 23 explicit ExtensionGarbageCollector(ExtensionService* extension_service); | |
| 24 virtual ~ExtensionGarbageCollector(); | |
| 25 | |
| 26 // Begin garbage collection; fetch the installed extensions' ids. | |
| 27 void GarbageCollectExtensions(); | |
| 28 | |
| 29 private: | |
| 30 // Check the installation directory for directories with invalid extension | |
| 31 // ids, deleting them if found. Call CheckExtensionPreferences with a list of | |
| 32 // present directories. | |
| 33 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.
| |
| 34 | |
| 35 // Check for any extension directories which: | |
| 36 // - Are an old version of a current extension; | |
| 37 // - Are present in the preferences but not on the file system; | |
| 38 // - Are present on the file system, but not in the preferences | |
| 39 // and delete them if found. | |
| 40 void CheckExtensionPreferences(const std::set<FilePath>& extension_paths); | |
| 41 | |
| 42 ExtensionService* extension_service_; | |
| 43 }; | |
| 44 | |
| 45 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | |
| OLD | NEW |