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

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

Issue 159345: Implement mimetype sniffing for extensions. (Closed)
Patch Set: rebase Created 11 years, 5 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/browser/download/save_package.cc ('k') | chrome/common/extensions/extension.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // The name of the manifest inside an extension. 57 // The name of the manifest inside an extension.
58 static const char kManifestFilename[]; 58 static const char kManifestFilename[];
59 59
60 #if defined(OS_WIN) 60 #if defined(OS_WIN)
61 static const char* kExtensionRegistryPath; 61 static const char* kExtensionRegistryPath;
62 #endif 62 #endif
63 63
64 // The number of bytes in a legal id. 64 // The number of bytes in a legal id.
65 static const size_t kIdSize; 65 static const size_t kIdSize;
66 66
67 // The mimetype used for extensions.
68 static const char kMimeType[];
69
67 Extension() : location_(INVALID), is_theme_(false) {} 70 Extension() : location_(INVALID), is_theme_(false) {}
68 explicit Extension(const FilePath& path); 71 explicit Extension(const FilePath& path);
69 virtual ~Extension(); 72 virtual ~Extension();
70 73
71 // Returns true if the specified file is an extension.
72 static bool IsExtension(const FilePath& file_name);
73
74 // Resets the id counter. This is only useful for unit tests. 74 // Resets the id counter. This is only useful for unit tests.
75 static void ResetGeneratedIdCounter() { 75 static void ResetGeneratedIdCounter() {
76 id_counter_ = 0; 76 id_counter_ = 0;
77 } 77 }
78 78
79 // Checks to see if the extension has a valid ID. 79 // Checks to see if the extension has a valid ID.
80 static bool IdIsValid(const std::string& id); 80 static bool IdIsValid(const std::string& id);
81 81
82 // Returns true if the specified file is an extension.
83 static bool IsExtension(const FilePath& file_name);
84
82 // Whether the |location| is external or not. 85 // Whether the |location| is external or not.
83 static inline bool IsExternalLocation(Location location) { 86 static inline bool IsExternalLocation(Location location) {
84 return location == Extension::EXTERNAL_PREF || 87 return location == Extension::EXTERNAL_PREF ||
85 location == Extension::EXTERNAL_REGISTRY; 88 location == Extension::EXTERNAL_REGISTRY;
86 } 89 }
87 90
88 // Returns an absolute url to a resource inside of an extension. The 91 // Returns an absolute url to a resource inside of an extension. The
89 // |extension_url| argument should be the url() from an Extension object. The 92 // |extension_url| argument should be the url() from an Extension object. The
90 // |relative_path| can be untrusted user input. The returned URL will either 93 // |relative_path| can be untrusted user input. The returned URL will either
91 // be invalid() or a child of |extension_url|. 94 // be invalid() or a child of |extension_url|.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 270
268 // URL for fetching an update manifest 271 // URL for fetching an update manifest
269 GURL update_url_; 272 GURL update_url_;
270 273
271 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); 274 FRIEND_TEST(ExtensionTest, LoadPageActionHelper);
272 275
273 DISALLOW_COPY_AND_ASSIGN(Extension); 276 DISALLOW_COPY_AND_ASSIGN(Extension);
274 }; 277 };
275 278
276 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 279 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698