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

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

Issue 118328: chrome.exe --package-extension (Closed)
Patch Set: final Created 11 years, 6 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/common/chrome_switches.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 30 matching lines...) Expand all
41 // An NPAPI plugin included in the extension. 41 // An NPAPI plugin included in the extension.
42 struct PluginInfo { 42 struct PluginInfo {
43 FilePath path; // Path to the plugin. 43 FilePath path; // Path to the plugin.
44 bool is_public; // False if only this extension can load this plugin. 44 bool is_public; // False if only this extension can load this plugin.
45 }; 45 };
46 46
47 // The name of the manifest inside an extension. 47 // The name of the manifest inside an extension.
48 static const char kManifestFilename[]; 48 static const char kManifestFilename[];
49 49
50 // Keys used in JSON representation of extensions. 50 // Keys used in JSON representation of extensions.
51 static const wchar_t* kBackgroundKey;
51 static const wchar_t* kContentScriptsKey; 52 static const wchar_t* kContentScriptsKey;
52 static const wchar_t* kCssKey; 53 static const wchar_t* kCssKey;
53 static const wchar_t* kDescriptionKey; 54 static const wchar_t* kDescriptionKey;
54 static const wchar_t* kIconPathKey; 55 static const wchar_t* kIconPathKey;
55 static const wchar_t* kIdKey; 56 static const wchar_t* kIdKey;
56 static const wchar_t* kJsKey; 57 static const wchar_t* kJsKey;
57 static const wchar_t* kMatchesKey; 58 static const wchar_t* kMatchesKey;
58 static const wchar_t* kNameKey; 59 static const wchar_t* kNameKey;
59 static const wchar_t* kPageActionsKey; 60 static const wchar_t* kPageActionsKey;
60 static const wchar_t* kPermissionsKey; 61 static const wchar_t* kPermissionsKey;
61 static const wchar_t* kPluginsKey; 62 static const wchar_t* kPluginsKey;
62 static const wchar_t* kPluginsPathKey; 63 static const wchar_t* kPluginsPathKey;
63 static const wchar_t* kPluginsPublicKey; 64 static const wchar_t* kPluginsPublicKey;
64 65 static const wchar_t* kPublicKeyKey;
65 static const wchar_t* kBackgroundKey; 66 static const wchar_t* kSignatureKey;
66 static const wchar_t* kRunAtKey; 67 static const wchar_t* kRunAtKey;
67 static const wchar_t* kThemeKey; 68 static const wchar_t* kThemeKey;
68 static const wchar_t* kThemeImagesKey; 69 static const wchar_t* kThemeImagesKey;
69 static const wchar_t* kThemeColorsKey; 70 static const wchar_t* kThemeColorsKey;
70 static const wchar_t* kThemeTintsKey; 71 static const wchar_t* kThemeTintsKey;
71 static const wchar_t* kThemeDisplayPropertiesKey; 72 static const wchar_t* kThemeDisplayPropertiesKey;
72 static const wchar_t* kToolstripsKey; 73 static const wchar_t* kToolstripsKey;
73 static const wchar_t* kTooltipKey; 74 static const wchar_t* kTooltipKey;
74 static const wchar_t* kTypeKey; 75 static const wchar_t* kTypeKey;
75 static const wchar_t* kVersionKey; 76 static const wchar_t* kVersionKey;
76 static const wchar_t* kZipHashKey;
77 77
78 // Some values expected in manifests. 78 // Some values expected in manifests.
79 static const char* kRunAtDocumentStartValue; 79 static const char* kRunAtDocumentStartValue;
80 static const char* kRunAtDocumentEndValue; 80 static const char* kRunAtDocumentEndValue;
81 static const char* kPageActionTypeTab; 81 static const char* kPageActionTypeTab;
82 static const char* kPageActionTypePermanent; 82 static const char* kPageActionTypePermanent;
83 83
84 // Error messages returned from InitFromValue(). 84 // Error messages returned from InitFromValue().
85 static const char* kInvalidContentScriptError; 85 static const char* kInvalidContentScriptError;
86 static const char* kInvalidContentScriptsListError; 86 static const char* kInvalidContentScriptsListError;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // |extension_path| argument should be the path() from an Extension object. 157 // |extension_path| argument should be the path() from an Extension object.
158 // The |relative_path| can be untrusted user input. The returned path will 158 // The |relative_path| can be untrusted user input. The returned path will
159 // either be empty or a child of extension_path. 159 // either be empty or a child of extension_path.
160 // NOTE: Static so that it can be used from multiple threads. 160 // NOTE: Static so that it can be used from multiple threads.
161 static FilePath GetResourcePath(const FilePath& extension_path, 161 static FilePath GetResourcePath(const FilePath& extension_path,
162 const std::string& relative_path); 162 const std::string& relative_path);
163 FilePath GetResourcePath(const std::string& relative_path) { 163 FilePath GetResourcePath(const std::string& relative_path) {
164 return GetResourcePath(path(), relative_path); 164 return GetResourcePath(path(), relative_path);
165 } 165 }
166 166
167 // |input| is expected to be the text of an rsa public or private key. It
168 // tolerates the presence or absence of bracking header/footer like this:
169 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
170 // and may contain newlines.
171 static bool ParsePEMKeyBytes(const std::string& input, std::string* output);
172
173 // Does a simple base64 encoding of |input| into |output|.
174 static bool ProducePEM(const std::string& input, std::string* output);
175
176 // Expects base64 encoded |input| and formats into |output| including
177 // the appropriate header & footer.
178 static bool FormatPEMForFileOutput(const std::string input,
179 std::string* output, bool is_public);
180
167 // Initialize the extension from a parsed manifest. 181 // Initialize the extension from a parsed manifest.
168 // If |require_id| is true, will return an error if the "id" key is missing 182 // If |require_id| is true, will return an error if the "id" key is missing
169 // from the value. 183 // from the value.
170 bool InitFromValue(const DictionaryValue& value, bool require_id, 184 bool InitFromValue(const DictionaryValue& value, bool require_id,
171 std::string* error); 185 std::string* error);
172 186
173 const FilePath& path() const { return path_; } 187 const FilePath& path() const { return path_; }
174 const GURL& url() const { return extension_url_; } 188 const GURL& url() const { return extension_url_; }
175 const Location location() const { return location_; } 189 const Location location() const { return location_; }
176 void set_location(Location location) { location_ = location; } 190 void set_location(Location location) { location_ = location; }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Whether the extension is a theme - if it is, certain things are disabled. 301 // Whether the extension is a theme - if it is, certain things are disabled.
288 bool is_theme_; 302 bool is_theme_;
289 303
290 // The sites this extension has permission to talk to (using XHR, etc). 304 // The sites this extension has permission to talk to (using XHR, etc).
291 std::vector<URLPattern> permissions_; 305 std::vector<URLPattern> permissions_;
292 306
293 DISALLOW_COPY_AND_ASSIGN(Extension); 307 DISALLOW_COPY_AND_ASSIGN(Extension);
294 }; 308 };
295 309
296 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 310 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698