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

Side by Side Diff: chrome/common/extensions/extension_file_util.h

Issue 217233004: Revert of Remove ExtensionService Garbage-Collecting methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
13 #include "chrome/common/extensions/message_bundle.h" 12 #include "chrome/common/extensions/message_bundle.h"
14 #include "extensions/common/manifest.h" 13 #include "extensions/common/manifest.h"
15 14
16 class ExtensionIconSet; 15 class ExtensionIconSet;
17 16
18 namespace base { 17 namespace base {
19 class DictionaryValue; 18 class DictionaryValue;
20 class FilePath; 19 class FilePath;
21 } 20 }
22 21
23 namespace extensions { 22 namespace extensions {
24 class Extension; 23 class Extension;
25 class MessageBundle; 24 class MessageBundle;
26 struct InstallWarning; 25 struct InstallWarning;
27 } 26 }
28 27
29 // Utilities for manipulating the on-disk storage of extensions. 28 // Utilities for manipulating the on-disk storage of extensions.
30 namespace extension_file_util { 29 namespace extension_file_util {
31 30
32 extern const base::FilePath::CharType kTempDirectoryName[];
33
34 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. 31 // Copies |unpacked_source_dir| into the right location under |extensions_dir|.
35 // The destination directory is returned on success, or empty path is returned 32 // The destination directory is returned on success, or empty path is returned
36 // on failure. 33 // on failure.
37 base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir, 34 base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir,
38 const std::string& id, 35 const std::string& id,
39 const std::string& version, 36 const std::string& version,
40 const base::FilePath& extensions_dir); 37 const base::FilePath& extensions_dir);
41 38
42 // Removes all versions of the extension with |id| from |extensions_dir|. 39 // Removes all versions of the extension with |id| from |extensions_dir|.
43 void UninstallExtension(const base::FilePath& extensions_dir, 40 void UninstallExtension(const base::FilePath& extensions_dir,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Returns a list of paths (relative to the extension dir) for images that 84 // Returns a list of paths (relative to the extension dir) for images that
88 // the browser might load (like themes and page action icons) for the given 85 // the browser might load (like themes and page action icons) for the given
89 // extension. 86 // extension.
90 std::set<base::FilePath> GetBrowserImagePaths( 87 std::set<base::FilePath> GetBrowserImagePaths(
91 const extensions::Extension* extension); 88 const extensions::Extension* extension);
92 89
93 // Returns a list of files that contain private keys inside |extension_dir|. 90 // Returns a list of files that contain private keys inside |extension_dir|.
94 std::vector<base::FilePath> FindPrivateKeyFiles( 91 std::vector<base::FilePath> FindPrivateKeyFiles(
95 const base::FilePath& extension_dir); 92 const base::FilePath& extension_dir);
96 93
94 // Cleans up the extension install directory. It can end up with garbage in it
95 // if extensions can't initially be removed when they are uninstalled (eg if a
96 // file is in use).
97 //
98 // |extensions_dir| is the install directory to look in. |extension_paths| is a
99 // map from extension id to full installation path.
100 //
101 // Obsolete version directories are removed, as are directories that aren't
102 // found in |extension_paths|.
103 //
104 // The "Temp" directory that is used during extension installation only gets
105 // removed if |clean_temp_dir| is true.
106 void GarbageCollectExtensions(
107 const base::FilePath& extensions_dir,
108 const std::multimap<std::string, base::FilePath>& extension_paths,
109 bool clean_temp_dir);
110
97 // Loads extension message catalogs and returns message bundle. 111 // Loads extension message catalogs and returns message bundle.
98 // Returns NULL on error, or if extension is not localized. 112 // Returns NULL on error, or if extension is not localized.
99 extensions::MessageBundle* LoadMessageBundle( 113 extensions::MessageBundle* LoadMessageBundle(
100 const base::FilePath& extension_path, 114 const base::FilePath& extension_path,
101 const std::string& default_locale, 115 const std::string& default_locale,
102 std::string* error); 116 std::string* error);
103 117
104 // Loads the extension message bundle substitution map. Contains at least 118 // Loads the extension message bundle substitution map. Contains at least
105 // extension_id item. 119 // extension_id item.
106 extensions::MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMap( 120 extensions::MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMap(
(...skipping 16 matching lines...) Expand all
123 base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir); 137 base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir);
124 138
125 // Helper function to delete files. This is used to avoid ugly casts which 139 // Helper function to delete files. This is used to avoid ugly casts which
126 // would be necessary with PostMessage since base::Delete is overloaded. 140 // would be necessary with PostMessage since base::Delete is overloaded.
127 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. 141 // TODO(skerner): Make a version of Delete that is not overloaded in file_util.
128 void DeleteFile(const base::FilePath& path, bool recursive); 142 void DeleteFile(const base::FilePath& path, bool recursive);
129 143
130 } // namespace extension_file_util 144 } // namespace extension_file_util
131 145
132 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 146 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698