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

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

Issue 11198067: Move extension unpack intermediate dir to Extensions/Temp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: standardize names Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_paths.cc ('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 <string> 8 #include <string>
9 #include <map> 9 #include <map>
10 10
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/message_bundle.h" 12 #include "chrome/common/extensions/message_bundle.h"
13 13
14 class FilePath; 14 class FilePath;
15 class GURL; 15 class GURL;
16 16
17 namespace base { 17 namespace base {
18 class DictionaryValue; 18 class DictionaryValue;
19 } 19 }
20 20
21 namespace extensions { 21 namespace extensions {
22 class MessageBundle; 22 class MessageBundle;
23 } 23 }
24 24
25 // Utilities for manipulating the on-disk storage of extensions. 25 // Utilities for manipulating the on-disk storage of extensions.
26 namespace extension_file_util { 26 namespace extension_file_util {
27 27
28 // The name of the directory inside the profile that we store installed
29 // extension in.
30 extern const char kInstallDirectoryName[];
31
32 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. 28 // Copies |unpacked_source_dir| into the right location under |extensions_dir|.
33 // The destination directory is returned on success, or empty path is returned 29 // The destination directory is returned on success, or empty path is returned
34 // on failure. 30 // on failure.
35 FilePath InstallExtension(const FilePath& unpacked_source_dir, 31 FilePath InstallExtension(const FilePath& unpacked_source_dir,
36 const std::string& id, 32 const std::string& id,
37 const std::string& version, 33 const std::string& version,
38 const FilePath& extensions_dir); 34 const FilePath& extensions_dir);
39 35
40 // Removes all versions of the extension with |id| from |extensions_dir|. 36 // Removes all versions of the extension with |id| from |extensions_dir|.
41 void UninstallExtension(const FilePath& extensions_dir, 37 void UninstallExtension(const FilePath& extensions_dir,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 bool CheckForIllegalFilenames(const FilePath& extension_path, 108 bool CheckForIllegalFilenames(const FilePath& extension_path,
113 std::string* error); 109 std::string* error);
114 110
115 // Get a relative file path from a chrome-extension:// URL. 111 // Get a relative file path from a chrome-extension:// URL.
116 FilePath ExtensionURLToRelativeFilePath(const GURL& url); 112 FilePath ExtensionURLToRelativeFilePath(const GURL& url);
117 113
118 // Get a full file path from a chrome-extension-resource:// URL, If the URL 114 // Get a full file path from a chrome-extension-resource:// URL, If the URL
119 // points a file outside of root, this function will return empty FilePath. 115 // points a file outside of root, this function will return empty FilePath.
120 FilePath ExtensionResourceURLToFilePath(const GURL& url, const FilePath& root); 116 FilePath ExtensionResourceURLToFilePath(const GURL& url, const FilePath& root);
121 117
122 // Get a path to a temp directory for unpacking an extension. 118 // Returns a path to a temporary directory for unpacking an extension that will
123 // This is essentially PathService::Get(chrome::DIR_USER_DATA_TEMP, ...), 119 // be installed into |extensions_dir|. Creates the directory if necessary.
124 // with a histogram that allows us to understand why it is failing. 120 // The directory will be on the same file system as |extensions_dir| so
125 // Return an empty file path on failure. 121 // that the extension directory can be efficiently renamed into place. Returns
126 FilePath GetUserDataTempDir(); 122 // an empty file path on failure.
123 FilePath GetInstallTempDir(const FilePath& extensions_dir);
127 124
128 // Helper function to delete files. This is used to avoid ugly casts which 125 // Helper function to delete files. This is used to avoid ugly casts which
129 // would be necessary with PostMessage since file_util::Delete is overloaded. 126 // would be necessary with PostMessage since file_util::Delete is overloaded.
130 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. 127 // TODO(skerner): Make a version of Delete that is not overloaded in file_util.
131 void DeleteFile(const FilePath& path, bool recursive); 128 void DeleteFile(const FilePath& path, bool recursive);
132 129
133 } // namespace extension_file_util 130 } // namespace extension_file_util
134 131
135 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 132 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths.cc ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698