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

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

Issue 8659002: Adding the --load-component-extension flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding comment to ScopedAllowIO.wq Created 9 years 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/extensions/extension.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <map> 10 #include <map>
11 11
12 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/extension_message_bundle.h" 13 #include "chrome/common/extensions/extension_message_bundle.h"
14 14
15 class Extension; 15 class Extension;
16 class ExtensionMessageBundle; 16 class ExtensionMessageBundle;
17 class FilePath; 17 class FilePath;
18 class GURL; 18 class GURL;
19 namespace base {
20 class DictionaryValue;
21 }
19 22
20 // Utilties for manipulating the on-disk storage of extensions. 23 // Utilties for manipulating the on-disk storage of extensions.
21 namespace extension_file_util { 24 namespace extension_file_util {
22 25
23 // The name of the directory inside the profile that we store installed 26 // The name of the directory inside the profile that we store installed
24 // extension in. 27 // extension in.
25 extern const char kInstallDirectoryName[]; 28 extern const char kInstallDirectoryName[];
26 29
27 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. 30 // Copies |unpacked_source_dir| into the right location under |extensions_dir|.
28 // The destination directiory is returned on success, or empty path is returned 31 // The destination directiory is returned on success, or empty path is returned
29 // on failure. 32 // on failure.
30 FilePath InstallExtension(const FilePath& unpacked_source_dir, 33 FilePath InstallExtension(const FilePath& unpacked_source_dir,
31 const std::string& id, 34 const std::string& id,
32 const std::string& version, 35 const std::string& version,
33 const FilePath& extensions_dir); 36 const FilePath& extensions_dir);
34 37
35 // Removes all versions of the extension with |id| from |extensions_dir|. 38 // Removes all versions of the extension with |id| from |extensions_dir|.
36 void UninstallExtension(const FilePath& extensions_dir, 39 void UninstallExtension(const FilePath& extensions_dir,
37 const std::string& id); 40 const std::string& id);
38 41
39 // Loads and validates an extension from the specified directory. Returns NULL 42 // Loads and validates an extension from the specified directory. Returns NULL
40 // on failure, with a description of the error in |error|. 43 // on failure, with a description of the error in |error|.
41 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, 44 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root,
42 Extension::Location location, 45 Extension::Location location,
43 int flags, 46 int flags,
44 std::string* error); 47 std::string* error);
45 48
49 // Loads an extension manifest from the specified directory. Returns NULL
50 // on failure, with a description of the error in |error|.
51 base::DictionaryValue* LoadManifest(const FilePath& extension_root,
52 std::string* error);
53
46 // Returns true if the given extension object is valid and consistent. 54 // Returns true if the given extension object is valid and consistent.
47 // Otherwise, a description of the error is returned in |error|. 55 // Otherwise, a description of the error is returned in |error|.
48 bool ValidateExtension(const Extension* extension, std::string* error); 56 bool ValidateExtension(const Extension* extension, std::string* error);
49 57
50 // Cleans up the extension install directory. It can end up with garbage in it 58 // Cleans up the extension install directory. It can end up with garbage in it
51 // if extensions can't initially be removed when they are uninstalled (eg if a 59 // if extensions can't initially be removed when they are uninstalled (eg if a
52 // file is in use). 60 // file is in use).
53 // 61 //
54 // |extensions_dir| is the install directory to look in. |extension_paths| is a 62 // |extensions_dir| is the install directory to look in. |extension_paths| is a
55 // map from extension id to full installation path. 63 // map from extension id to full installation path.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 FilePath GetUserDataTempDir(); 100 FilePath GetUserDataTempDir();
93 101
94 // Helper function to delete files. This is used to avoid ugly casts which 102 // Helper function to delete files. This is used to avoid ugly casts which
95 // would be necessary with PostMessage since file_util::Delete is overloaded. 103 // would be necessary with PostMessage since file_util::Delete is overloaded.
96 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. 104 // TODO(skerner): Make a version of Delete that is not overloaded in file_util.
97 void DeleteFile(const FilePath& path, bool recursive); 105 void DeleteFile(const FilePath& path, bool recursive);
98 106
99 } // namespace extension_file_util 107 } // namespace extension_file_util
100 108
101 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 109 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698