blob: 1420f59c34f152688d9098da1281c5da32964349 [file] [log] [blame]
[email protected]225c8f52010-02-05 22:23:201// Copyright (c) 2010 The Chromium Authors. All rights reserved.
[email protected]7713d632008-12-02 07:52:332// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]5b1a0e22009-05-26 19:00:585#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6#define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
[email protected]7713d632008-12-02 07:52:337
[email protected]300cc58db2009-08-19 20:45:148#include <map>
[email protected]facd7a7652009-06-05 23:15:029#include <set>
[email protected]7713d632008-12-02 07:52:3310#include <string>
11#include <vector>
12
[email protected]6014d672008-12-05 00:38:2513#include "base/file_path.h"
[email protected]cc655912009-01-29 23:19:1914#include "base/scoped_ptr.h"
[email protected]7713d632008-12-02 07:52:3315#include "base/values.h"
[email protected]cc655912009-01-29 23:19:1916#include "base/version.h"
[email protected]e2eb43112009-05-29 21:19:5417#include "chrome/browser/extensions/user_script_master.h"
[email protected]ba69a7d2009-09-28 21:09:5618#include "chrome/common/extensions/extension_action.h"
[email protected]ecabe6ee2009-10-07 22:49:1019#include "chrome/common/extensions/extension_resource.h"
[email protected]42b6f0f82009-09-18 21:07:3920#include "chrome/common/extensions/user_script.h"
[email protected]7197f4992009-03-23 05:05:4921#include "chrome/common/extensions/url_pattern.h"
[email protected]eab9b452009-01-23 20:48:5922#include "googleurl/src/gurl.h"
23
[email protected]c533bb22009-06-03 19:06:1124// Represents a Chrome extension.
[email protected]7713d632008-12-02 07:52:3325class Extension {
26 public:
[email protected]b30e0dd2010-01-29 23:33:2127 typedef std::vector<URLPattern> URLPatternList;
[email protected]d3cfa482009-10-17 13:54:5728 typedef std::map<const std::string, GURL> URLOverrideMap;
[email protected]b24d8312009-08-27 06:47:4629
[email protected]631cf822009-05-15 07:01:2530 // What an extension was loaded from.
31 enum Location {
32 INVALID,
[email protected]25b34332009-06-05 21:53:1933 INTERNAL, // A crx file from the internal Extensions directory.
34 EXTERNAL_PREF, // A crx file from an external directory (via prefs).
35 EXTERNAL_REGISTRY, // A crx file from an external directory (via eg the
36 // registry on Windows).
37 LOAD // --load-extension.
38 };
39
40 enum State {
[email protected]0c6da502009-08-14 22:32:3941 DISABLED = 0,
[email protected]25b34332009-06-05 21:53:1942 ENABLED,
43 KILLBIT, // Don't install/upgrade (applies to external extensions only).
[email protected]0c6da502009-08-14 22:32:3944
45 NUM_STATES
[email protected]631cf822009-05-15 07:01:2546 };
[email protected]7713d632008-12-02 07:52:3347
[email protected]fbcc40302009-06-12 20:45:4548 enum InstallType {
[email protected]ab6f2b22009-07-28 23:28:3749 INSTALL_ERROR,
[email protected]fbcc40302009-06-12 20:45:4550 DOWNGRADE,
51 REINSTALL,
52 UPGRADE,
53 NEW_INSTALL
54 };
55
[email protected]d2817012009-08-04 06:46:2156 // NOTE: If you change this list, you should also change kIconSizes in the cc
57 // file.
58 enum Icons {
59 EXTENSION_ICON_LARGE = 128,
60 EXTENSION_ICON_MEDIUM = 48,
61 EXTENSION_ICON_SMALL = 32,
62 EXTENSION_ICON_BITTY = 16,
63 };
64
[email protected]28375ae2010-02-05 04:45:5065 enum AppLaunchWindowType {
66 APP,
67 PANEL
68 };
69
[email protected]c3e3def742009-07-17 07:51:0670 // Icon sizes used by the extension system.
[email protected]d2817012009-08-04 06:46:2171 static const int kIconSizes[];
[email protected]c3e3def742009-07-17 07:51:0672
[email protected]4c4f8192009-10-17 01:03:2673 // Max size (both dimensions) for browser and page actions.
74 static const int kPageActionIconMaxSize;
75 static const int kBrowserActionIconMaxSize;
76
[email protected]35506352009-08-07 18:58:1977 // Each permission is a module that the extension is permitted to use.
[email protected]aeb53b32009-10-29 07:34:4578 static const char* kTabPermission;
79 static const char* kBookmarkPermission;
[email protected]0faf2aa82009-11-24 22:10:4980 static const char* kNotificationPermission;
[email protected]ea99c3a2010-01-07 00:40:1981 static const char* kExperimentalPermission;
[email protected]aeb53b32009-10-29 07:34:4582
[email protected]35506352009-08-07 18:58:1983 static const char* kPermissionNames[];
84 static const size_t kNumPermissions;
85
[email protected]c533bb22009-06-03 19:06:1186 // An NPAPI plugin included in the extension.
87 struct PluginInfo {
88 FilePath path; // Path to the plugin.
89 bool is_public; // False if only this extension can load this plugin.
90 };
91
[email protected]bbc945542009-07-26 00:11:4292 // A toolstrip and its associated mole.
93 struct ToolstripInfo {
94 ToolstripInfo() : mole_height(0) {}
95
96 GURL toolstrip;
97 GURL mole;
98 int mole_height;
99 };
100
[email protected]6014d672008-12-05 00:38:25101 // The name of the manifest inside an extension.
[email protected]99efb7b12009-12-18 02:39:16102 static const FilePath::CharType kManifestFilename[];
[email protected]6014d672008-12-05 00:38:25103
[email protected]300cc58db2009-08-19 20:45:14104 // The name of locale folder inside an extension.
[email protected]99efb7b12009-12-18 02:39:16105 static const FilePath::CharType kLocaleFolder[];
[email protected]300cc58db2009-08-19 20:45:14106
107 // The name of the messages file inside an extension.
[email protected]99efb7b12009-12-18 02:39:16108 static const FilePath::CharType kMessagesFilename[];
[email protected]300cc58db2009-08-19 20:45:14109
[email protected]25b34332009-06-05 21:53:19110#if defined(OS_WIN)
111 static const char* kExtensionRegistryPath;
112#endif
113
[email protected]37eeb5a2009-02-26 23:36:17114 // The number of bytes in a legal id.
[email protected]fe0e7822009-02-26 23:51:48115 static const size_t kIdSize;
[email protected]37eeb5a2009-02-26 23:36:17116
[email protected]e435d6b72009-07-25 03:15:58117 // The mimetype used for extensions.
118 static const char kMimeType[];
119
[email protected]631cf822009-05-15 07:01:25120 explicit Extension(const FilePath& path);
[email protected]631cf822009-05-15 07:01:25121 virtual ~Extension();
122
[email protected]25b34332009-06-05 21:53:19123 // Checks to see if the extension has a valid ID.
124 static bool IdIsValid(const std::string& id);
125
[email protected]e435d6b72009-07-25 03:15:58126 // Returns true if the specified file is an extension.
127 static bool IsExtension(const FilePath& file_name);
128
[email protected]25b34332009-06-05 21:53:19129 // Whether the |location| is external or not.
130 static inline bool IsExternalLocation(Location location) {
131 return location == Extension::EXTERNAL_PREF ||
132 location == Extension::EXTERNAL_REGISTRY;
133 }
134
[email protected]07c00d992009-03-04 20:27:04135 // Returns an absolute url to a resource inside of an extension. The
[email protected]eab9b452009-01-23 20:48:59136 // |extension_url| argument should be the url() from an Extension object. The
137 // |relative_path| can be untrusted user input. The returned URL will either
138 // be invalid() or a child of |extension_url|.
139 // NOTE: Static so that it can be used from multiple threads.
140 static GURL GetResourceURL(const GURL& extension_url,
141 const std::string& relative_path);
[email protected]3cfbd0e2009-03-18 21:26:24142 GURL GetResourceURL(const std::string& relative_path) {
143 return GetResourceURL(url(), relative_path);
144 }
[email protected]eab9b452009-01-23 20:48:59145
[email protected]99efb7b12009-12-18 02:39:16146 // Returns an extension resource object. |relative_path| should be UTF8
147 // encoded.
148 ExtensionResource GetResource(const std::string& relative_path);
149
150 // As above, but with |relative_path| following the file system's encoding.
151 ExtensionResource GetResource(const FilePath& relative_path);
[email protected]eab9b452009-01-23 20:48:59152
[email protected]a17f9462009-06-09 02:56:41153 // |input| is expected to be the text of an rsa public or private key. It
154 // tolerates the presence or absence of bracking header/footer like this:
155 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
156 // and may contain newlines.
157 static bool ParsePEMKeyBytes(const std::string& input, std::string* output);
158
159 // Does a simple base64 encoding of |input| into |output|.
160 static bool ProducePEM(const std::string& input, std::string* output);
161
[email protected]84ac7f32009-10-06 06:17:54162 // Generates an extension ID from arbitrary input. The same input string will
163 // always generate the same output ID.
164 static bool GenerateId(const std::string& input, std::string* output);
[email protected]fbcc40302009-06-12 20:45:45165
[email protected]a17f9462009-06-09 02:56:41166 // Expects base64 encoded |input| and formats into |output| including
167 // the appropriate header & footer.
168 static bool FormatPEMForFileOutput(const std::string input,
169 std::string* output, bool is_public);
170
[email protected]2a409532009-08-28 19:39:44171 // Determine whether |new_extension| has increased privileges compared to
172 // |old_extension|.
173 static bool IsPrivilegeIncrease(Extension* old_extension,
174 Extension* new_extension);
[email protected]b24d8312009-08-27 06:47:46175
[email protected]c690a9812009-12-17 05:55:32176 // Given an extension and icon size, read it if present and decode it into
177 // result.
178 static void DecodeIcon(Extension* extension,
179 Icons icon_size,
180 scoped_ptr<SkBitmap>* result);
181
182 // Given an icon_path and icon size, read it if present and decode it into
183 // result.
184 static void DecodeIconFromPath(const FilePath& icon_path,
185 Icons icon_size,
186 scoped_ptr<SkBitmap>* result);
187
[email protected]4a8d3272009-03-10 19:15:08188 // Initialize the extension from a parsed manifest.
[email protected]5bfb1eb0a2009-04-08 18:33:30189 // If |require_id| is true, will return an error if the "id" key is missing
190 // from the value.
191 bool InitFromValue(const DictionaryValue& value, bool require_id,
192 std::string* error);
[email protected]4a8d3272009-03-10 19:15:08193
[email protected]82891262008-12-24 00:21:26194 const FilePath& path() const { return path_; }
[email protected]af1277b2009-07-28 00:47:53195 void set_path(const FilePath& path) { path_ = path; }
[email protected]5bfb1eb0a2009-04-08 18:33:30196 const GURL& url() const { return extension_url_; }
[email protected]225c8f52010-02-05 22:23:20197 Location location() const { return location_; }
[email protected]631cf822009-05-15 07:01:25198 void set_location(Location location) { location_ = location; }
[email protected]4a8d3272009-03-10 19:15:08199 const std::string& id() const { return id_; }
200 const Version* version() const { return version_.get(); }
201 // String representation of the version number.
202 const std::string VersionString() const;
203 const std::string& name() const { return name_; }
[email protected]fbcc40302009-06-12 20:45:45204 const std::string& public_key() const { return public_key_; }
[email protected]4a8d3272009-03-10 19:15:08205 const std::string& description() const { return description_; }
[email protected]6657afa62009-11-04 02:15:20206 bool converted_from_user_script() const {
207 return converted_from_user_script_;
208 }
[email protected]4a8d3272009-03-10 19:15:08209 const UserScriptList& content_scripts() const { return content_scripts_; }
[email protected]5d246db22009-10-27 06:17:57210 ExtensionAction* page_action() const { return page_action_.get(); }
211 ExtensionAction* browser_action() const { return browser_action_.get(); }
[email protected]c533bb22009-06-03 19:06:11212 const std::vector<PluginInfo>& plugins() const { return plugins_; }
[email protected]c64631652009-04-29 22:24:31213 const GURL& background_url() const { return background_url_; }
[email protected]43919ac92009-10-16 18:34:28214 const GURL& options_url() const { return options_url_; }
[email protected]bbc945542009-07-26 00:11:42215 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; }
[email protected]35506352009-08-07 18:58:19216 const std::vector<std::string>& api_permissions() const {
217 return api_permissions_;
218 }
[email protected]b30e0dd2010-01-29 23:33:21219 const URLPatternList& host_permissions() const {
[email protected]c7ad50f2009-09-11 06:28:15220 return host_permissions_;
221 }
222
223 // Returns true if the extension has permission to access the host for the
224 // specified URL.
225 bool CanAccessHost(const GURL& url) const;
[email protected]b24d8312009-08-27 06:47:46226
[email protected]aeb53b32009-10-29 07:34:45227 // Returns true if the extension has the specified API permission.
228 bool HasApiPermission(const std::string& permission) const {
229 return std::find(api_permissions_.begin(), api_permissions_.end(),
230 permission) != api_permissions_.end();
231 }
232
[email protected]b24d8312009-08-27 06:47:46233 // Returns the set of hosts that the extension effectively has access to. This
234 // is used in the permissions UI and is a combination of the hosts accessible
235 // through content scripts and the hosts accessible through XHR.
236 const std::set<std::string> GetEffectiveHostPermissions() const;
237
238 // Whether the extension has access to all hosts. This is true if there is
239 // a content script that matches all hosts, or if there is a host permission
240 // for all hosts.
241 bool HasAccessToAllHosts() const;
242
[email protected]b29682ba22009-06-18 19:53:56243 const GURL& update_url() const { return update_url_; }
[email protected]0cb5f502009-10-21 21:35:47244 const std::map<int, std::string>& icons() const { return icons_; }
[email protected]4a8d3272009-03-10 19:15:08245
[email protected]25b34332009-06-05 21:53:19246 // Returns the origin of this extension. This function takes a |registry_path|
247 // so that the registry location can be overwritten during testing.
248 Location ExternalExtensionInstallType(std::string registry_path);
249
250 // Theme-related.
[email protected]631cf822009-05-15 07:01:25251 DictionaryValue* GetThemeImages() const { return theme_images_.get(); }
252 DictionaryValue* GetThemeColors() const { return theme_colors_.get(); }
253 DictionaryValue* GetThemeTints() const { return theme_tints_.get(); }
[email protected]7895ea22009-06-02 20:53:50254 DictionaryValue* GetThemeDisplayProperties() const {
255 return theme_display_properties_.get();
256 }
[email protected]66da08b2009-10-19 22:27:00257 bool IsTheme() const { return is_theme_; }
[email protected]631cf822009-05-15 07:01:25258
[email protected]facd7a7652009-06-05 23:15:02259 // Returns a list of paths (relative to the extension dir) for images that
260 // the browser might load (like themes and page action icons).
261 std::set<FilePath> GetBrowserImages();
262
[email protected]866930682009-08-18 22:53:47263 // Returns an absolute path to the given icon inside of the extension. Returns
264 // an empty FilePath if the extension does not have that icon.
[email protected]ecabe6ee2009-10-07 22:49:10265 ExtensionResource GetIconPath(Icons icon);
[email protected]866930682009-08-18 22:53:47266
[email protected]b6ab96d2009-08-20 18:58:19267 const DictionaryValue* manifest_value() const {
268 return manifest_value_.get();
269 }
270
[email protected]9428edc2009-11-18 18:02:47271 const std::string default_locale() const { return default_locale_; }
272
[email protected]86c008e82009-08-28 20:26:05273 // Chrome URL overrides (see ExtensionOverrideUI).
[email protected]d3cfa482009-10-17 13:54:57274 const URLOverrideMap& GetChromeURLOverrides() const {
275 return chrome_url_overrides_;
[email protected]86c008e82009-08-28 20:26:05276 }
277
[email protected]e95ad332009-08-03 19:44:25278 // Runtime data:
279 // Put dynamic data about the state of a running extension below.
280
281 // Whether the background page, if any, is ready. We don't load other
282 // components until then. If there is no background page, we consider it to
283 // be ready.
284 bool GetBackgroundPageReady();
285 void SetBackgroundPageReady();
286
[email protected]1e8c93f2010-02-08 22:58:31287 // Getter and setter for the flag that specifies whether the extension is
288 // being upgraded.
289 bool being_upgraded() const { return being_upgraded_; }
290 void set_being_upgraded(bool value) { being_upgraded_ = value; }
291
[email protected]92bcd162010-01-15 08:47:48292 // App stuff.
[email protected]b30e0dd2010-01-29 23:33:21293 const URLPatternList& app_extent() const { return app_extent_; }
[email protected]92bcd162010-01-15 08:47:48294 const GURL& app_launch_url() const { return app_launch_url_; }
295 bool IsApp() const { return !app_launch_url_.is_empty(); }
[email protected]28375ae2010-02-05 04:45:50296 AppLaunchWindowType app_launch_window_type() {
297 return app_launch_window_type_;
298 }
[email protected]581b0ad2010-01-12 21:54:38299
[email protected]4a8d3272009-03-10 19:15:08300 private:
[email protected]3cfbd0e2009-03-18 21:26:24301 // Helper method that loads a UserScript object from a
302 // dictionary in the content_script list of the manifest.
303 bool LoadUserScriptHelper(const DictionaryValue* content_script,
304 int definition_index,
305 std::string* error,
306 UserScript* result);
[email protected]f7f3a5f2009-05-01 22:02:34307
[email protected]6657afa62009-11-04 02:15:20308 // Helper method that loads either the include_globs or exclude_globs list
309 // from an entry in the content_script lists of the manifest.
310 bool LoadGlobsHelper(const DictionaryValue* content_script,
311 int content_script_index,
312 const wchar_t* globs_property_name,
313 std::string* error,
[email protected]11f4857282009-11-13 19:56:17314 void(UserScript::*add_method)(const std::string& glob),
[email protected]6657afa62009-11-04 02:15:20315 UserScript *instance);
316
[email protected]5d246db22009-10-27 06:17:57317 // Helper method to load an ExtensionAction from the page_action or
[email protected]92c6f9b92009-10-24 04:35:08318 // browser_action entries in the manifest.
[email protected]5d246db22009-10-27 06:17:57319 ExtensionAction* LoadExtensionActionHelper(
[email protected]92c6f9b92009-10-24 04:35:08320 const DictionaryValue* extension_action, std::string* error);
321
[email protected]e2eb43112009-05-29 21:19:54322 // Figures out if a source contains keys not associated with themes - we
323 // don't want to allow scripts and such to be bundled with themes.
324 bool ContainsNonThemeKeys(const DictionaryValue& source);
325
[email protected]581b0ad2010-01-12 21:54:38326 // Apps don't have access to all extension features. This enforces those
327 // restrictions.
328 bool ContainsNonAppKeys(const DictionaryValue& source);
329
330 // Helper method to verify the app section of the manifest.
331 bool LoadAppHelper(const DictionaryValue* app, std::string* error);
332
[email protected]4a8d3272009-03-10 19:15:08333 // The absolute path to the directory the extension is stored in.
334 FilePath path_;
335
336 // The base extension url for the extension.
337 GURL extension_url_;
[email protected]eab9b452009-01-23 20:48:59338
[email protected]631cf822009-05-15 07:01:25339 // The location the extension was loaded from.
340 Location location_;
341
[email protected]7713d632008-12-02 07:52:33342 // A human-readable ID for the extension. The convention is to use something
343 // like 'com.example.myextension', but this is not currently enforced. An
344 // extension's ID is used in things like directory structures and URLs, and
345 // is expected to not change across versions. In the case of conflicts,
346 // updates will only be allowed if the extension can be validated using the
347 // previous version's update key.
[email protected]e1cec06c2008-12-18 01:22:23348 std::string id_;
[email protected]82891262008-12-24 00:21:26349
[email protected]64a02b802009-01-12 19:36:42350 // The extension's version.
[email protected]cc655912009-01-29 23:19:19351 scoped_ptr<Version> version_;
[email protected]64a02b802009-01-12 19:36:42352
[email protected]82891262008-12-24 00:21:26353 // The extension's human-readable name.
[email protected]e1cec06c2008-12-18 01:22:23354 std::string name_;
[email protected]82891262008-12-24 00:21:26355
[email protected]4a8d3272009-03-10 19:15:08356 // An optional longer description of the extension.
[email protected]e1cec06c2008-12-18 01:22:23357 std::string description_;
[email protected]82891262008-12-24 00:21:26358
[email protected]6657afa62009-11-04 02:15:20359 // True if the extension was generated from a user script. (We show slightly
360 // different UI if so).
361 bool converted_from_user_script_;
362
[email protected]82891262008-12-24 00:21:26363 // Paths to the content scripts the extension contains.
[email protected]34aa8dc2009-02-19 07:03:05364 UserScriptList content_scripts_;
[email protected]7713d632008-12-02 07:52:33365
[email protected]37e960e2009-10-13 23:17:50366 // The extension's page action, if any.
[email protected]5d246db22009-10-27 06:17:57367 scoped_ptr<ExtensionAction> page_action_;
[email protected]671e6c1ce2009-09-26 03:18:46368
369 // The extension's browser action, if any.
[email protected]5d246db22009-10-27 06:17:57370 scoped_ptr<ExtensionAction> browser_action_;
[email protected]ec9ac0df2009-10-01 18:06:47371
[email protected]c533bb22009-06-03 19:06:11372 // Optional list of NPAPI plugins and associated properties.
373 std::vector<PluginInfo> plugins_;
[email protected]367230c52009-02-21 01:44:30374
[email protected]c64631652009-04-29 22:24:31375 // Optional URL to a master page of which a single instance should be always
376 // loaded in the background.
377 GURL background_url_;
378
[email protected]43919ac92009-10-16 18:34:28379 // Optional URL to a page for setting options/preferences.
380 GURL options_url_;
381
[email protected]bbc945542009-07-26 00:11:42382 // Optional list of toolstrips_ and associated properties.
383 std::vector<ToolstripInfo> toolstrips_;
[email protected]4a8d3272009-03-10 19:15:08384
[email protected]fbcc40302009-06-12 20:45:45385 // The public key ('key' in the manifest) used to sign the contents of the
386 // crx package ('signature' in the manifest)
387 std::string public_key_;
[email protected]cc655912009-01-29 23:19:19388
[email protected]07c00d992009-03-04 20:27:04389 // A map of resource id's to relative file paths.
[email protected]bbb436f2009-05-09 16:51:07390 scoped_ptr<DictionaryValue> theme_images_;
[email protected]4a190632009-05-09 01:07:42391
392 // A map of color names to colors.
[email protected]bbb436f2009-05-09 16:51:07393 scoped_ptr<DictionaryValue> theme_colors_;
[email protected]4a190632009-05-09 01:07:42394
395 // A map of color names to colors.
[email protected]bbb436f2009-05-09 16:51:07396 scoped_ptr<DictionaryValue> theme_tints_;
[email protected]4a190632009-05-09 01:07:42397
[email protected]7895ea22009-06-02 20:53:50398 // A map of display properties.
399 scoped_ptr<DictionaryValue> theme_display_properties_;
400
[email protected]4a190632009-05-09 01:07:42401 // Whether the extension is a theme - if it is, certain things are disabled.
402 bool is_theme_;
[email protected]07c00d992009-03-04 20:27:04403
[email protected]35506352009-08-07 18:58:19404 // The set of module-level APIs this extension can use.
405 std::vector<std::string> api_permissions_;
406
[email protected]c64631652009-04-29 22:24:31407 // The sites this extension has permission to talk to (using XHR, etc).
[email protected]b30e0dd2010-01-29 23:33:21408 URLPatternList host_permissions_;
[email protected]7197f4992009-03-23 05:05:49409
[email protected]c3e3def742009-07-17 07:51:06410 // The paths to the icons the extension contains mapped by their width.
411 std::map<int, std::string> icons_;
412
[email protected]b29682ba22009-06-18 19:53:56413 // URL for fetching an update manifest
414 GURL update_url_;
[email protected]d6336a92009-08-13 17:25:12415
[email protected]b6ab96d2009-08-20 18:58:19416 // A copy of the manifest that this extension was created from.
417 scoped_ptr<DictionaryValue> manifest_value_;
418
[email protected]9428edc2009-11-18 18:02:47419 // Default locale for fall back. Can be empty if extension is not localized.
420 std::string default_locale_;
421
[email protected]86c008e82009-08-28 20:26:05422 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs
423 // which override the handling of those URLs.
[email protected]d3cfa482009-10-17 13:54:57424 URLOverrideMap chrome_url_overrides_;
[email protected]86c008e82009-08-28 20:26:05425
[email protected]b30e0dd2010-01-29 23:33:21426 // Describes the space of URLs that are displayed in the app's custom frame.
427 URLPatternList app_extent_;
[email protected]581b0ad2010-01-12 21:54:38428
[email protected]92bcd162010-01-15 08:47:48429 // The URL an app should launch to.
430 GURL app_launch_url_;
[email protected]3b355642010-02-05 16:01:49431
[email protected]28375ae2010-02-05 04:45:50432 // The type of window to start when the application is launched.
433 AppLaunchWindowType app_launch_window_type_;
[email protected]3b355642010-02-05 16:01:49434
[email protected]e95ad332009-08-03 19:44:25435 // Runtime data:
436
437 // True if the background page is ready.
438 bool background_page_ready_;
[email protected]b29682ba22009-06-18 19:53:56439
[email protected]1e8c93f2010-02-08 22:58:31440 // True while the extension is being upgraded.
441 bool being_upgraded_;
442
[email protected]ae7fe712009-07-02 20:33:58443 FRIEND_TEST(ExtensionTest, LoadPageActionHelper);
[email protected]3b355642010-02-05 16:01:49444 FRIEND_TEST(TabStripModelTest, Apps);
[email protected]ae7fe712009-07-02 20:33:58445
[email protected]894bb502009-05-21 22:39:57446 DISALLOW_COPY_AND_ASSIGN(Extension);
[email protected]7713d632008-12-02 07:52:33447};
448
[email protected]b1748b1d82009-11-30 20:32:56449typedef std::vector<Extension*> ExtensionList;
450
[email protected]c6d474f82009-12-16 21:11:06451// Handy struct to pass core extension info around.
452struct ExtensionInfo {
453 ExtensionInfo(const DictionaryValue* manifest,
454 const std::string& id,
455 const FilePath& path,
456 Extension::Location location)
457 : extension_id(id),
458 extension_path(path),
459 extension_location(location) {
460 if (manifest)
461 extension_manifest.reset(
462 static_cast<DictionaryValue*>(manifest->DeepCopy()));
463 }
464
465 scoped_ptr<DictionaryValue> extension_manifest;
466 std::string extension_id;
467 FilePath extension_path;
468 Extension::Location extension_location;
469
470 private:
471 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo);
472};
473
[email protected]5b1a0e22009-05-26 19:00:58474#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_