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

Side by Side Diff: chrome/browser/extensions/extension_garbage_collector.h

Issue 9817018: Cleaning Up Extensions When Local Content Removed (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated with newest master Created 8 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_garbage_collector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 CheckExtensionDirectoriesOnBackgroundThread(
34 const FilePath& installation_directory);
35
36 // Check for any extension directories which:
37 // - Are an old version of a current extension;
38 // - Are present in the preferences but not on the file system;
39 // - Are present on the file system, but not in the preferences
40 // and delete them if found.
41 void CheckExtensionPreferences(const std::set<FilePath>& extension_paths);
42
43 // Helper function to cleanup any old versions of an extension in the
44 // extension's base directory.
45 void CleanupOldVersionsOnBackgroundThread(
46 const FilePath& path, const FilePath& current_version);
47
48 ExtensionService* extension_service_;
49 };
50
51 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_garbage_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698