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

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

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/chrome.gyp ('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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "base/version.h" 16 #include "base/version.h"
17 #include "chrome/browser/extensions/user_script_master.h" 17 #include "chrome/browser/extensions/user_script_master.h"
18 #include "chrome/common/extensions/extension_action.h" 18 #include "chrome/common/extensions/extension_action.h"
19 #include "chrome/common/extensions/extension_message_bundle.h" 19 #include "chrome/common/extensions/extension_message_bundle.h"
20 #include "chrome/common/extensions/extension_resource.h"
20 #include "chrome/common/extensions/user_script.h" 21 #include "chrome/common/extensions/user_script.h"
21 #include "chrome/common/extensions/url_pattern.h" 22 #include "chrome/common/extensions/url_pattern.h"
22 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
23 24
24 // Represents a Chrome extension. 25 // Represents a Chrome extension.
25 class Extension { 26 class Extension {
26 public: 27 public:
27 typedef std::vector<URLPattern> HostPermissions; 28 typedef std::vector<URLPattern> HostPermissions;
28 29
29 // What an extension was loaded from. 30 // What an extension was loaded from.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // |extension_url| argument should be the url() from an Extension object. The 126 // |extension_url| argument should be the url() from an Extension object. The
126 // |relative_path| can be untrusted user input. The returned URL will either 127 // |relative_path| can be untrusted user input. The returned URL will either
127 // be invalid() or a child of |extension_url|. 128 // be invalid() or a child of |extension_url|.
128 // NOTE: Static so that it can be used from multiple threads. 129 // NOTE: Static so that it can be used from multiple threads.
129 static GURL GetResourceURL(const GURL& extension_url, 130 static GURL GetResourceURL(const GURL& extension_url,
130 const std::string& relative_path); 131 const std::string& relative_path);
131 GURL GetResourceURL(const std::string& relative_path) { 132 GURL GetResourceURL(const std::string& relative_path) {
132 return GetResourceURL(url(), relative_path); 133 return GetResourceURL(url(), relative_path);
133 } 134 }
134 135
135 // Returns an absolute path to a resource inside of an extension. The 136 // Returns an extension resource object. The |extension_path| argument should
136 // |extension_path| argument should be the path() from an Extension object. 137 // be the path() from an Extension object.
137 // The |relative_path| can be untrusted user input. The returned path will 138 // The |relative_path| can be untrusted user input.
138 // either be empty or a child of extension_path.
139 // NOTE: Static so that it can be used from multiple threads. 139 // NOTE: Static so that it can be used from multiple threads.
140 static FilePath GetResourcePath(const FilePath& extension_path, 140 static ExtensionResource GetResource(const FilePath& extension_path,
141 const std::string& relative_path); 141 const std::string& relative_path);
142 FilePath GetResourcePath(const std::string& relative_path) { 142 ExtensionResource GetResource(const std::string& relative_path) {
143 return GetResourcePath(path(), relative_path); 143 return GetResource(path(), relative_path);
144 } 144 }
145 145
146 // |input| is expected to be the text of an rsa public or private key. It 146 // |input| is expected to be the text of an rsa public or private key. It
147 // tolerates the presence or absence of bracking header/footer like this: 147 // tolerates the presence or absence of bracking header/footer like this:
148 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- 148 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
149 // and may contain newlines. 149 // and may contain newlines.
150 static bool ParsePEMKeyBytes(const std::string& input, std::string* output); 150 static bool ParsePEMKeyBytes(const std::string& input, std::string* output);
151 151
152 // Does a simple base64 encoding of |input| into |output|. 152 // Does a simple base64 encoding of |input| into |output|.
153 static bool ProducePEM(const std::string& input, std::string* output); 153 static bool ProducePEM(const std::string& input, std::string* output);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return theme_display_properties_.get(); 236 return theme_display_properties_.get();
237 } 237 }
238 bool IsTheme() { return is_theme_; } 238 bool IsTheme() { return is_theme_; }
239 239
240 // Returns a list of paths (relative to the extension dir) for images that 240 // Returns a list of paths (relative to the extension dir) for images that
241 // the browser might load (like themes and page action icons). 241 // the browser might load (like themes and page action icons).
242 std::set<FilePath> GetBrowserImages(); 242 std::set<FilePath> GetBrowserImages();
243 243
244 // Returns an absolute path to the given icon inside of the extension. Returns 244 // Returns an absolute path to the given icon inside of the extension. Returns
245 // an empty FilePath if the extension does not have that icon. 245 // an empty FilePath if the extension does not have that icon.
246 FilePath GetIconPath(Icons icon); 246 ExtensionResource GetIconPath(Icons icon);
247 247
248 const DictionaryValue* manifest_value() const { 248 const DictionaryValue* manifest_value() const {
249 return manifest_value_.get(); 249 return manifest_value_.get();
250 } 250 }
251 251
252 // Getter/setter for l10n message bundle. 252 // Getter/setter for l10n message bundle.
253 const ExtensionMessageBundle* message_bundle() const { 253 const ExtensionMessageBundle* message_bundle() const {
254 return message_bundle_.get(); 254 return message_bundle_.get();
255 } 255 }
256 void set_message_bundle(ExtensionMessageBundle* message_bundle) { 256 void set_message_bundle(ExtensionMessageBundle* message_bundle) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // True if the background page is ready. 388 // True if the background page is ready.
389 bool background_page_ready_; 389 bool background_page_ready_;
390 390
391 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); 391 FRIEND_TEST(ExtensionTest, LoadPageActionHelper);
392 392
393 DISALLOW_COPY_AND_ASSIGN(Extension); 393 DISALLOW_COPY_AND_ASSIGN(Extension);
394 }; 394 };
395 395
396 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 396 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698