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

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: Pulled garbage collection into its own class. Created 8 years, 8 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
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 <map>
10 #include <vector>
11
12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h"
14
15 class ExtensionService;
16
17 // Garbage collection for extensions. This will delete any directories in the
18 // installation directory of |extension_service_| that aren't valid, as well
19 // as removing any references in the preferences to extensions that are
20 // missing local content.
21 class ExtensionGarbageCollector
22 : public base::RefCountedThreadSafe<ExtensionGarbageCollector> {
23 public:
24 explicit ExtensionGarbageCollector(ExtensionService* extension_service);
25 virtual ~ExtensionGarbageCollector();
26
27 // Begin garbage collection; fetch the installed extensions' ids.
28 void GarbageCollectExtensions();
29
30 private:
31 // Check for invalid extension directories and for any extensions that are
32 // missing local content.
33 void CheckExtensionDirectories(
34 const std::map<std::string, FilePath>& extension_paths);
35
36 // Check the installation directory for any invalid/unused extension
37 // directories, deleting them if found.
38 void CheckInstalledDirectories(
39 const std::map<std::string, FilePath>& extension_paths);
40
41 // Remove all references to extensions which are missing local content (e.g.
42 // the extension's directory was deleted from the install directory).
43 void RemoveExtensionsMissingLocalContent(
44 const std::vector<std::string>& bad_extensions);
45
46 ExtensionService* extension_service_;
47 };
48
49 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698