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

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

Issue 202063: Implemented the rest of loading/parsing logic for extension i18n:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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/extension_message_bundle.h"
18 #include "chrome/browser/extensions/user_script_master.h"
17 #include "chrome/common/extensions/user_script.h" 19 #include "chrome/common/extensions/user_script.h"
18 #include "chrome/browser/extensions/user_script_master.h"
19 #include "chrome/common/extensions/url_pattern.h" 20 #include "chrome/common/extensions/url_pattern.h"
20 #include "chrome/common/page_action.h" 21 #include "chrome/common/page_action.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 23
23 // Represents a Chrome extension. 24 // Represents a Chrome extension.
24 class Extension { 25 class Extension {
25 public: 26 public:
26 typedef std::vector<URLPattern> HostPermissions; 27 typedef std::vector<URLPattern> HostPermissions;
27 28
28 // What an extension was loaded from. 29 // What an extension was loaded from.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 std::set<FilePath> GetBrowserImages(); 241 std::set<FilePath> GetBrowserImages();
241 242
242 // Returns an absolute path to the given icon inside of the extension. Returns 243 // Returns an absolute path to the given icon inside of the extension. Returns
243 // an empty FilePath if the extension does not have that icon. 244 // an empty FilePath if the extension does not have that icon.
244 FilePath GetIconPath(Icons icon); 245 FilePath GetIconPath(Icons icon);
245 246
246 const DictionaryValue* manifest_value() const { 247 const DictionaryValue* manifest_value() const {
247 return manifest_value_.get(); 248 return manifest_value_.get();
248 } 249 }
249 250
250 // Returns a list of all locales supported by the extension. 251 // Getter/setter for l10n message bundle.
251 const std::set<std::string>& supported_locales() const { 252 const ExtensionMessageBundle* message_bundle() const {
252 return supported_locales_; 253 return message_bundle_.get();
253 } 254 }
254 // Add locale to the list of supported locales. 255 void set_message_bundle(ExtensionMessageBundle* message_bundle) {
255 void AddSupportedLocale(const std::string& supported_locale) { 256 message_bundle_.reset(message_bundle);
256 supported_locales_.insert(supported_locale);
257 }
258
259 // Getter/setter for a default_locale_.
260 const std::string& default_locale() const { return default_locale_; }
261 void set_default_locale(const std::string& default_locale) {
262 default_locale_ = default_locale;
263 } 257 }
264 258
265 // Chrome URL overrides (see ExtensionOverrideUI). 259 // Chrome URL overrides (see ExtensionOverrideUI).
266 DictionaryValue* GetChromeURLOverrides() const { 260 DictionaryValue* GetChromeURLOverrides() const {
267 return chrome_url_overrides_.get(); 261 return chrome_url_overrides_.get();
268 } 262 }
269 263
270 // Runtime data: 264 // Runtime data:
271 // Put dynamic data about the state of a running extension below. 265 // Put dynamic data about the state of a running extension below.
272 266
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 368
375 // The paths to the icons the extension contains mapped by their width. 369 // The paths to the icons the extension contains mapped by their width.
376 std::map<int, std::string> icons_; 370 std::map<int, std::string> icons_;
377 371
378 // URL for fetching an update manifest 372 // URL for fetching an update manifest
379 GURL update_url_; 373 GURL update_url_;
380 374
381 // A copy of the manifest that this extension was created from. 375 // A copy of the manifest that this extension was created from.
382 scoped_ptr<DictionaryValue> manifest_value_; 376 scoped_ptr<DictionaryValue> manifest_value_;
383 377
384 // List of all locales extension supports. 378 // Handles the l10n messages replacement and parsing.
385 std::set<std::string> supported_locales_; 379 scoped_ptr<ExtensionMessageBundle> message_bundle_;
386
387 // Default locale, used for fallback.
388 std::string default_locale_;
389 380
390 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs 381 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs
391 // which override the handling of those URLs. 382 // which override the handling of those URLs.
392 scoped_ptr<DictionaryValue> chrome_url_overrides_; 383 scoped_ptr<DictionaryValue> chrome_url_overrides_;
393 384
394 // Runtime data: 385 // Runtime data:
395 386
396 // True if the background page is ready. 387 // True if the background page is ready.
397 bool background_page_ready_; 388 bool background_page_ready_;
398 389
399 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); 390 FRIEND_TEST(ExtensionTest, LoadPageActionHelper);
400 391
401 DISALLOW_COPY_AND_ASSIGN(Extension); 392 DISALLOW_COPY_AND_ASSIGN(Extension);
402 }; 393 };
403 394
404 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 395 #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