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

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

Issue 9429066: Coverity: Fix a few pass-by-values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert one. Created 8 years, 10 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 | « no previous file | 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 #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 { 19 namespace base {
20 class DictionaryValue; 20 class DictionaryValue;
21 } 21 }
22 22
23 // Utilties for manipulating the on-disk storage of extensions. 23 // Utilities for manipulating the on-disk storage of extensions.
24 namespace extension_file_util { 24 namespace extension_file_util {
25 25
26 // 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
27 // extension in. 27 // extension in.
28 extern const char kInstallDirectoryName[]; 28 extern const char kInstallDirectoryName[];
29 29
30 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. 30 // Copies |unpacked_source_dir| into the right location under |extensions_dir|.
31 // The destination directiory is returned on success, or empty path is returned 31 // The destination directory is returned on success, or empty path is returned
32 // on failure. 32 // on failure.
33 FilePath InstallExtension(const FilePath& unpacked_source_dir, 33 FilePath InstallExtension(const FilePath& unpacked_source_dir,
34 const std::string& id, 34 const std::string& id,
35 const std::string& version, 35 const std::string& version,
36 const FilePath& extensions_dir); 36 const FilePath& extensions_dir);
37 37
38 // Removes all versions of the extension with |id| from |extensions_dir|. 38 // Removes all versions of the extension with |id| from |extensions_dir|.
39 void UninstallExtension(const FilePath& extensions_dir, 39 void UninstallExtension(const FilePath& extensions_dir,
40 const std::string& id); 40 const std::string& id);
41 41
42 // Loads and validates an extension from the specified directory. Returns NULL 42 // Loads and validates an extension from the specified directory. Returns NULL
43 // on failure, with a description of the error in |error|. 43 // on failure, with a description of the error in |error|.
44 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, 44 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root,
45 Extension::Location location, 45 Extension::Location location,
46 int flags, 46 int flags,
47 std::string* error); 47 std::string* error);
48 48
49 // The same as LoadExtension except use the provided |extension_id|. 49 // The same as LoadExtension except use the provided |extension_id|.
50 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, 50 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root,
51 std::string extension_id, 51 const std::string& extension_id,
52 Extension::Location location, 52 Extension::Location location,
53 int flags, 53 int flags,
54 std::string* error); 54 std::string* error);
55 55
56 // Loads an extension manifest from the specified directory. Returns NULL 56 // Loads an extension manifest from the specified directory. Returns NULL
57 // on failure, with a description of the error in |error|. 57 // on failure, with a description of the error in |error|.
58 base::DictionaryValue* LoadManifest(const FilePath& extension_root, 58 base::DictionaryValue* LoadManifest(const FilePath& extension_root,
59 std::string* error); 59 std::string* error);
60 60
61 // Returns true if the given extension object is valid and consistent. 61 // Returns true if the given extension object is valid and consistent.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 FilePath GetUserDataTempDir(); 107 FilePath GetUserDataTempDir();
108 108
109 // Helper function to delete files. This is used to avoid ugly casts which 109 // Helper function to delete files. This is used to avoid ugly casts which
110 // would be necessary with PostMessage since file_util::Delete is overloaded. 110 // would be necessary with PostMessage since file_util::Delete is overloaded.
111 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. 111 // TODO(skerner): Make a version of Delete that is not overloaded in file_util.
112 void DeleteFile(const FilePath& path, bool recursive); 112 void DeleteFile(const FilePath& path, bool recursive);
113 113
114 } // namespace extension_file_util 114 } // namespace extension_file_util
115 115
116 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ 116 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698