blob: 12c128939db5ac0aaa66856d647f37b2cf229bd6 [file] [log] [blame]
[email protected]eb75f7b2012-01-04 09:07:281// Copyright (c) 2012 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]8629c542012-04-20 03:40:038#include <algorithm>
[email protected]18049dc2012-06-19 23:12:559#include <iosfwd>
[email protected]300cc58db2009-08-19 20:45:1410#include <map>
[email protected]facd7a7652009-06-05 23:15:0211#include <set>
[email protected]7713d632008-12-02 07:52:3312#include <string>
[email protected]58f62cf2012-03-09 10:45:1113#include <utility>
[email protected]7713d632008-12-02 07:52:3314#include <vector>
15
[email protected]6014d672008-12-05 00:38:2516#include "base/file_path.h"
[email protected]19118d52010-07-26 22:13:4217#include "base/gtest_prod_util.h"
[email protected]8f270be2011-12-21 21:15:2218#include "base/hash_tables.h"
[email protected]b6b805e92011-04-16 09:24:1419#include "base/memory/linked_ptr.h"
[email protected]3b63f8f42011-03-28 01:54:1520#include "base/memory/ref_counted.h"
21#include "base/memory/scoped_ptr.h"
[email protected]902fd7b2011-07-27 18:42:3122#include "base/synchronization/lock.h"
[email protected]65907942012-05-22 19:59:4723#include "chrome/common/extensions/command.h"
[email protected]d83a5602010-09-16 00:22:4824#include "chrome/common/extensions/extension_constants.h"
[email protected]807871f2010-09-16 01:04:4825#include "chrome/common/extensions/extension_icon_set.h"
[email protected]bebe1d02012-08-02 20:17:0926#include "chrome/common/extensions/permissions/api_permission.h"
[email protected]1d8b79a2012-08-16 20:22:5427#include "chrome/common/extensions/permissions/api_permission_set.h"
[email protected]bebe1d02012-08-02 20:17:0928#include "chrome/common/extensions/permissions/permission_message.h"
[email protected]885c0e92012-11-13 20:27:4229#include "chrome/common/extensions/user_script.h"
30#include "extensions/common/url_pattern.h"
[email protected]e9f541a2012-11-19 21:52:3131#include "extensions/common/url_pattern_set.h"
[email protected]eab9b452009-01-23 20:48:5932#include "googleurl/src/gurl.h"
[email protected]f5532472012-02-23 13:00:5533#include "ui/base/accelerators/accelerator.h"
[email protected]08397d52011-02-05 01:53:3834#include "ui/gfx/size.h"
[email protected]eab9b452009-01-23 20:48:5935
[email protected]0f34d9082012-10-08 19:16:4436class ExtensionAction;
[email protected]942690b132010-05-11 06:42:1437class ExtensionResource;
[email protected]12802702010-07-09 19:43:0938class SkBitmap;
[email protected]daf66aa2010-08-06 06:24:2839class Version;
[email protected]942690b132010-05-11 06:42:1440
[email protected]f3a1c642011-07-12 19:15:0341namespace base {
42class DictionaryValue;
43class ListValue;
44}
45
[email protected]0f34d9082012-10-08 19:16:4446namespace gfx {
47class ImageSkia;
48}
49
[email protected]1c321ee2012-05-21 03:02:3450FORWARD_DECLARE_TEST(TabStripModelTest, Apps);
51
52namespace extensions {
53
54class Manifest;
[email protected]bebe1d02012-08-02 20:17:0955class PermissionSet;
[email protected]1c321ee2012-05-21 03:02:3456
[email protected]d4a37f1c2012-07-09 21:36:1357typedef std::set<std::string> OAuth2Scopes;
58
[email protected]f0755532010-06-22 07:27:2559// Represents a Chrome extension.
[email protected]66e4eb32010-10-27 20:37:4160class Extension : public base::RefCountedThreadSafe<Extension> {
[email protected]7713d632008-12-02 07:52:3361 public:
[email protected]1e0f45a2012-06-13 00:31:0662 struct InstallWarning;
[email protected]d356c982012-12-12 19:32:5563 struct ManifestData;
[email protected]1e0f45a2012-06-13 00:31:0664
[email protected]10fb1992010-10-08 09:00:1765 typedef std::vector<std::string> ScriptingWhitelist;
[email protected]1e0f45a2012-06-13 00:31:0666 typedef std::vector<InstallWarning> InstallWarningVector;
[email protected]d356c982012-12-12 19:32:5567 typedef std::map<const std::string, linked_ptr<ManifestData> >
68 ManifestDataMap;
[email protected]b24d8312009-08-27 06:47:4669
[email protected]631cf822009-05-15 07:01:2570 // What an extension was loaded from.
[email protected]9b217652010-10-08 22:04:2371 // NOTE: These values are stored as integers in the preferences and used
72 // in histograms so don't remove or reorder existing items. Just append
73 // to the end.
[email protected]631cf822009-05-15 07:01:2574 enum Location {
75 INVALID,
[email protected]25b34332009-06-05 21:53:1976 INTERNAL, // A crx file from the internal Extensions directory.
77 EXTERNAL_PREF, // A crx file from an external directory (via prefs).
78 EXTERNAL_REGISTRY, // A crx file from an external directory (via eg the
79 // registry on Windows).
[email protected]1952c7d2010-03-04 23:48:3480 LOAD, // --load-extension.
[email protected]8ef78fd2010-08-19 17:14:3281 COMPONENT, // An integral component of Chrome itself, which
82 // happens to be implemented as an extension. We don't
83 // show these in the management UI.
[email protected]4d2913e32010-11-30 00:28:5584 EXTERNAL_PREF_DOWNLOAD, // A crx file from an external directory (via
85 // prefs), installed from an update URL.
86 EXTERNAL_POLICY_DOWNLOAD, // A crx file from an external directory (via
87 // admin policies), installed from an update URL.
[email protected]04cb7542010-10-25 10:50:0688
89 NUM_LOCATIONS
[email protected]25b34332009-06-05 21:53:1990 };
91
92 enum State {
[email protected]0c6da502009-08-14 22:32:3993 DISABLED = 0,
[email protected]25b34332009-06-05 21:53:1994 ENABLED,
[email protected]79c833b52011-04-05 18:31:0195 // An external extension that the user uninstalled. We should not reinstall
96 // such extensions on startup.
97 EXTERNAL_EXTENSION_UNINSTALLED,
[email protected]8c484b742012-11-29 06:05:3698 // Special state for component extensions, since they are always loaded by
99 // the component loader, and should never be auto-installed on startup.
100 ENABLED_COMPONENT,
[email protected]0c6da502009-08-14 22:32:39101 NUM_STATES
[email protected]631cf822009-05-15 07:01:25102 };
[email protected]7713d632008-12-02 07:52:33103
[email protected]44d62b62012-04-11 00:06:03104 // Used to record the reason an extension was disabled.
[email protected]eb5e4f92012-08-15 23:33:28105 enum DeprecatedDisableReason {
106 DEPRECATED_DISABLE_UNKNOWN,
107 DEPRECATED_DISABLE_USER_ACTION,
108 DEPRECATED_DISABLE_PERMISSIONS_INCREASE,
109 DEPRECATED_DISABLE_RELOAD,
110 DEPRECATED_DISABLE_LAST, // Not used.
111 };
112
[email protected]44d62b62012-04-11 00:06:03113 enum DisableReason {
[email protected]eb5e4f92012-08-15 23:33:28114 DISABLE_NONE = 0,
115 DISABLE_USER_ACTION = 1 << 0,
116 DISABLE_PERMISSIONS_INCREASE = 1 << 1,
117 DISABLE_RELOAD = 1 << 2,
[email protected]215a7be2012-10-22 19:53:42118 DISABLE_UNSUPPORTED_REQUIREMENT = 1 << 3,
119 DISABLE_SIDELOAD_WIPEOUT = 1 << 4,
[email protected]f56c65ea62012-12-10 22:57:21120 DISABLE_UNKNOWN_FROM_SYNC = 1 << 5,
[email protected]44d62b62012-04-11 00:06:03121 };
122
[email protected]fbcc40302009-06-12 20:45:45123 enum InstallType {
[email protected]ab6f2b22009-07-28 23:28:37124 INSTALL_ERROR,
[email protected]fbcc40302009-06-12 20:45:45125 DOWNGRADE,
126 REINSTALL,
127 UPGRADE,
128 NEW_INSTALL
129 };
130
[email protected]7fa19f82010-12-21 19:40:08131 // Do not change the order of entries or remove entries in this list
132 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions.
133 enum Type {
[email protected]9b217652010-10-08 22:04:23134 TYPE_UNKNOWN = 0,
135 TYPE_EXTENSION,
136 TYPE_THEME,
137 TYPE_USER_SCRIPT,
138 TYPE_HOSTED_APP,
[email protected]c4f459d2012-09-28 04:40:10139 // This is marked legacy because platform apps are preferred. For
140 // backwards compatibility, we can't remove support for packaged apps
141 TYPE_LEGACY_PACKAGED_APP,
[email protected]7d3ed2f2011-11-07 23:33:19142 TYPE_PLATFORM_APP
[email protected]9b217652010-10-08 22:04:23143 };
144
[email protected]3bdba0d2011-08-23 07:17:30145 enum SyncType {
146 SYNC_TYPE_NONE = 0,
147 SYNC_TYPE_EXTENSION,
148 SYNC_TYPE_APP
149 };
150
[email protected]98270432012-09-11 20:51:24151 // Declared requirements for the extension.
152 struct Requirements {
153 Requirements();
154 ~Requirements();
155
156 bool webgl;
157 bool css3d;
158 bool npapi;
159 };
160
[email protected]92888082010-10-18 19:24:57161 // An NPAPI plugin included in the extension.
162 struct PluginInfo {
163 FilePath path; // Path to the plugin.
164 bool is_public; // False if only this extension can load this plugin.
165 };
166
[email protected]65378f52011-04-08 02:31:23167 // An NaCl module included in the extension.
168 struct NaClModuleInfo {
[email protected]84396dbc2011-04-14 06:33:42169 GURL url;
[email protected]65378f52011-04-08 02:31:23170 std::string mime_type;
171 };
172
[email protected]a79be1f2012-03-23 22:14:00173 // OAuth2 info included in the extension.
174 struct OAuth2Info {
175 OAuth2Info();
176 ~OAuth2Info();
177
[email protected]c2e66e12012-06-27 06:27:06178 OAuth2Scopes GetScopesAsSet();
[email protected]b6f38622012-04-25 03:20:19179
[email protected]a79be1f2012-03-23 22:14:00180 std::string client_id;
181 std::vector<std::string> scopes;
182 };
183
[email protected]0f34d9082012-10-08 19:16:44184 struct ActionInfo {
185 explicit ActionInfo();
186 ~ActionInfo();
187
188 // The types of extension actions.
189 enum Type {
190 TYPE_BROWSER,
191 TYPE_PAGE,
192 TYPE_SCRIPT_BADGE,
[email protected]ad12b6b2012-11-28 23:21:15193 TYPE_SYSTEM_INDICATOR,
[email protected]0f34d9082012-10-08 19:16:44194 };
195
196 // Empty implies the key wasn't present.
197 ExtensionIconSet default_icon;
198 std::string default_title;
199 GURL default_popup_url;
200 // action id -- only used with legacy page actions API.
201 std::string id;
202 };
203
[email protected]1e0f45a2012-06-13 00:31:06204 struct InstallWarning {
205 enum Format {
206 // IMPORTANT: Do not build HTML strings from user or developer-supplied
207 // input.
208 FORMAT_TEXT,
209 FORMAT_HTML,
210 };
211 InstallWarning(Format format, const std::string& message)
212 : format(format), message(message) {
213 }
[email protected]18049dc2012-06-19 23:12:55214 bool operator==(const InstallWarning& other) const;
[email protected]1e0f45a2012-06-13 00:31:06215 Format format;
216 std::string message;
217 };
218
[email protected]d356c982012-12-12 19:32:55219 // A base class for parsed manifest data that APIs want to store on
220 // the extension. Related to base::SupportsUserData, but with an immutable
221 // thread-safe interface to match Extension.
222 struct ManifestData {
223 virtual ~ManifestData() {}
224 };
225
[email protected]83048a22011-03-29 00:14:13226 enum InitFromValueFlags {
227 NO_FLAGS = 0,
228
229 // Usually, the id of an extension is generated by the "key" property of
230 // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be
231 // generated based on the path.
232 REQUIRE_KEY = 1 << 0,
233
[email protected]3f53dfe2011-11-30 01:18:29234 // Requires the extension to have an up-to-date manifest version.
235 // Typically, we'll support multiple manifest versions during a version
[email protected]26367b62012-10-04 23:03:32236 // transition. This flag signals that we want to require the most modern
[email protected]3f53dfe2011-11-30 01:18:29237 // manifest version that Chrome understands.
238 REQUIRE_MODERN_MANIFEST_VERSION = 1 << 1,
239
[email protected]3aff9ad2011-04-01 20:26:48240 // |ALLOW_FILE_ACCESS| indicates that the user is allowing this extension
241 // to have file access. If it's not present, then permissions and content
242 // scripts that match file:/// URLs will be filtered out.
[email protected]ed3b9b12012-05-31 18:37:51243 ALLOW_FILE_ACCESS = 1 << 2,
[email protected]620db1762011-07-15 21:57:34244
245 // |FROM_WEBSTORE| indicates that the extension was installed from the
246 // Chrome Web Store.
[email protected]ed3b9b12012-05-31 18:37:51247 FROM_WEBSTORE = 1 << 3,
[email protected]e805baf2011-07-26 18:23:05248
249 // |FROM_BOOKMARK| indicates the extension was created using a mock App
250 // created from a bookmark.
[email protected]ed3b9b12012-05-31 18:37:51251 FROM_BOOKMARK = 1 << 4,
[email protected]3d41d432012-04-20 20:47:58252
253 // |FOLLOW_SYMLINKS_ANYWHERE| means that resources can be symlinks to
254 // anywhere in the filesystem, rather than being restricted to the
255 // extension directory.
[email protected]ed3b9b12012-05-31 18:37:51256 FOLLOW_SYMLINKS_ANYWHERE = 1 << 5,
[email protected]ab55c2b2012-06-01 23:55:03257
258 // |ERROR_ON_PRIVATE_KEY| means that private keys inside an
259 // extension should be errors rather than warnings.
260 ERROR_ON_PRIVATE_KEY = 1 << 6,
[email protected]e33bbc22012-08-27 22:05:46261
262 // |WAS_INSTALLED_BY_DEFAULT| installed by default when the profile was
263 // created.
264 WAS_INSTALLED_BY_DEFAULT = 1 << 7,
[email protected]83048a22011-03-29 00:14:13265 };
266
[email protected]66e4eb32010-10-27 20:37:41267 static scoped_refptr<Extension> Create(const FilePath& path,
268 Location location,
[email protected]f3a1c642011-07-12 19:15:03269 const base::DictionaryValue& value,
[email protected]83048a22011-03-29 00:14:13270 int flags,
[email protected]66e4eb32010-10-27 20:37:41271 std::string* error);
272
[email protected]87c655e2011-07-01 21:42:00273 // In a few special circumstances, we want to create an Extension and give it
[email protected]f5bf1842012-02-15 02:52:26274 // an explicit id. Most consumers should just use the other Create() method.
275 static scoped_refptr<Extension> Create(const FilePath& path,
[email protected]58f62cf2012-03-09 10:45:11276 Location location,
277 const base::DictionaryValue& value,
278 int flags,
279 const std::string& explicit_id,
280 std::string* error);
[email protected]87c655e2011-07-01 21:42:00281
[email protected]145a317b2011-04-12 16:03:46282 // Given two install sources, return the one which should take priority
283 // over the other. If an extension is installed from two sources A and B,
284 // its install source should be set to GetHigherPriorityLocation(A, B).
285 static Location GetHigherPriorityLocation(Location loc1, Location loc2);
286
[email protected]4c4f8192009-10-17 01:03:26287 // Max size (both dimensions) for browser and page actions.
288 static const int kPageActionIconMaxSize;
289 static const int kBrowserActionIconMaxSize;
290
[email protected]8d888c12010-11-30 00:00:25291 // Valid schemes for web extent URLPatterns.
292 static const int kValidWebExtentSchemes;
293
[email protected]f71f7e62010-12-07 03:45:33294 // Valid schemes for host permission URLPatterns.
295 static const int kValidHostPermissionSchemes;
296
[email protected]6014d672008-12-05 00:38:25297 // The name of the manifest inside an extension.
[email protected]99efb7b12009-12-18 02:39:16298 static const FilePath::CharType kManifestFilename[];
[email protected]6014d672008-12-05 00:38:25299
[email protected]300cc58db2009-08-19 20:45:14300 // The name of locale folder inside an extension.
[email protected]99efb7b12009-12-18 02:39:16301 static const FilePath::CharType kLocaleFolder[];
[email protected]300cc58db2009-08-19 20:45:14302
303 // The name of the messages file inside an extension.
[email protected]99efb7b12009-12-18 02:39:16304 static const FilePath::CharType kMessagesFilename[];
[email protected]300cc58db2009-08-19 20:45:14305
[email protected]25b34332009-06-05 21:53:19306#if defined(OS_WIN)
[email protected]9dcf8f12010-09-02 20:39:19307 static const char kExtensionRegistryPath[];
[email protected]25b34332009-06-05 21:53:19308#endif
309
[email protected]37eeb5a2009-02-26 23:36:17310 // The number of bytes in a legal id.
[email protected]fe0e7822009-02-26 23:51:48311 static const size_t kIdSize;
[email protected]37eeb5a2009-02-26 23:36:17312
[email protected]e435d6b72009-07-25 03:15:58313 // The mimetype used for extensions.
314 static const char kMimeType[];
315
[email protected]25b34332009-06-05 21:53:19316 // Checks to see if the extension has a valid ID.
317 static bool IdIsValid(const std::string& id);
318
[email protected]4ead6f72010-10-13 19:54:18319 // Generate an ID for an extension in the given path.
[email protected]28d7479b2011-03-09 21:33:27320 // Used while developing extensions, before they have a key.
[email protected]4ead6f72010-10-13 19:54:18321 static std::string GenerateIdForPath(const FilePath& file_name);
322
[email protected]e435d6b72009-07-25 03:15:58323 // Returns true if the specified file is an extension.
324 static bool IsExtension(const FilePath& file_name);
325
[email protected]25b34332009-06-05 21:53:19326 // Whether the |location| is external or not.
327 static inline bool IsExternalLocation(Location location) {
328 return location == Extension::EXTERNAL_PREF ||
[email protected]8ef78fd2010-08-19 17:14:32329 location == Extension::EXTERNAL_REGISTRY ||
[email protected]04cb7542010-10-25 10:50:06330 location == Extension::EXTERNAL_PREF_DOWNLOAD ||
331 location == Extension::EXTERNAL_POLICY_DOWNLOAD;
332 }
333
334 // Whether extensions with |location| are auto-updatable or not.
335 static inline bool IsAutoUpdateableLocation(Location location) {
336 // Only internal and external extensions can be autoupdated.
337 return location == Extension::INTERNAL ||
338 IsExternalLocation(location);
[email protected]25b34332009-06-05 21:53:19339 }
340
[email protected]cdfca9702011-08-08 16:07:01341 // Unpacked extensions start off with file access since they are a developer
342 // feature.
343 static inline bool ShouldAlwaysAllowFileAccess(Location location) {
344 return location == Extension::LOAD;
345 }
346
[email protected]fc6b0612012-03-29 13:40:06347 // Fills the |info| dictionary with basic information about the extension.
348 // |enabled| is injected for easier testing.
349 void GetBasicInfo(bool enabled, base::DictionaryValue* info) const;
350
[email protected]7fa19f82010-12-21 19:40:08351 // See Type definition above.
352 Type GetType() const;
[email protected]9b217652010-10-08 22:04:23353
[email protected]07c00d992009-03-04 20:27:04354 // Returns an absolute url to a resource inside of an extension. The
[email protected]eab9b452009-01-23 20:48:59355 // |extension_url| argument should be the url() from an Extension object. The
356 // |relative_path| can be untrusted user input. The returned URL will either
357 // be invalid() or a child of |extension_url|.
358 // NOTE: Static so that it can be used from multiple threads.
359 static GURL GetResourceURL(const GURL& extension_url,
360 const std::string& relative_path);
[email protected]cffd7892010-08-26 17:43:28361 GURL GetResourceURL(const std::string& relative_path) const {
[email protected]3cfbd0e2009-03-18 21:26:24362 return GetResourceURL(url(), relative_path);
363 }
[email protected]eab9b452009-01-23 20:48:59364
[email protected]f59a8052012-06-20 22:25:00365 // Returns true if the resource matches a pattern in the pattern_set.
366 bool ResourceMatches(const URLPatternSet& pattern_set,
367 const std::string& resource) const;
368
[email protected]8f270be2011-12-21 21:15:22369 // Returns true if the specified resource is web accessible.
370 bool IsResourceWebAccessible(const std::string& relative_path) const;
371
[email protected]dbb24162012-06-06 01:41:22372 // Returns true if the specified page is sandboxed (served in a unique
373 // origin).
374 bool IsSandboxedPage(const std::string& relative_path) const;
375
376 // Returns the Content Security Policy that the specified resource should be
377 // served with.
378 std::string GetResourceContentSecurityPolicy(const std::string& relative_path)
379 const;
380
[email protected]8f270be2011-12-21 21:15:22381 // Returns true when 'web_accessible_resources' are defined for the extension.
382 bool HasWebAccessibleResources() const;
383
[email protected]99efb7b12009-12-18 02:39:16384 // Returns an extension resource object. |relative_path| should be UTF8
385 // encoded.
[email protected]9adb9692010-10-29 23:14:02386 ExtensionResource GetResource(const std::string& relative_path) const;
[email protected]99efb7b12009-12-18 02:39:16387
388 // As above, but with |relative_path| following the file system's encoding.
[email protected]9adb9692010-10-29 23:14:02389 ExtensionResource GetResource(const FilePath& relative_path) const;
[email protected]eab9b452009-01-23 20:48:59390
[email protected]a17f9462009-06-09 02:56:41391 // |input| is expected to be the text of an rsa public or private key. It
392 // tolerates the presence or absence of bracking header/footer like this:
393 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
394 // and may contain newlines.
395 static bool ParsePEMKeyBytes(const std::string& input, std::string* output);
396
397 // Does a simple base64 encoding of |input| into |output|.
398 static bool ProducePEM(const std::string& input, std::string* output);
399
[email protected]84ac7f32009-10-06 06:17:54400 // Generates an extension ID from arbitrary input. The same input string will
401 // always generate the same output ID.
[email protected]af9db5f2011-10-05 05:13:15402 static bool GenerateId(const std::string& input,
403 std::string* output) WARN_UNUSED_RESULT;
[email protected]fbcc40302009-06-12 20:45:45404
[email protected]a17f9462009-06-09 02:56:41405 // Expects base64 encoded |input| and formats into |output| including
406 // the appropriate header & footer.
[email protected]e0d08192011-03-29 19:02:50407 static bool FormatPEMForFileOutput(const std::string& input,
408 std::string* output,
409 bool is_public);
[email protected]a17f9462009-06-09 02:56:41410
[email protected]58f62cf2012-03-09 10:45:11411 // Given an extension, icon size, and match type, read a valid icon if present
[email protected]e3c0bc22012-02-24 01:34:15412 // and decode it into result. In the browser process, this will DCHECK if not
413 // called on the file thread. To easily load extension images on the UI
414 // thread, see ImageLoadingTracker.
415 static void DecodeIcon(const Extension* extension,
[email protected]faf87192012-08-17 00:07:59416 int icon_size,
[email protected]e3c0bc22012-02-24 01:34:15417 ExtensionIconSet::MatchType match_type,
418 scoped_ptr<SkBitmap>* result);
419
[email protected]c690a9812009-12-17 05:55:32420 // Given an extension and icon size, read it if present and decode it into
[email protected]ae2e0f92010-04-06 20:32:23421 // result. In the browser process, this will DCHECK if not called on the
422 // file thread. To easily load extension images on the UI thread, see
423 // ImageLoadingTracker.
[email protected]9adb9692010-10-29 23:14:02424 static void DecodeIcon(const Extension* extension,
[email protected]faf87192012-08-17 00:07:59425 int icon_size,
[email protected]c690a9812009-12-17 05:55:32426 scoped_ptr<SkBitmap>* result);
427
428 // Given an icon_path and icon size, read it if present and decode it into
[email protected]ae2e0f92010-04-06 20:32:23429 // result. In the browser process, this will DCHECK if not called on the
430 // file thread. To easily load extension images on the UI thread, see
431 // ImageLoadingTracker.
[email protected]c690a9812009-12-17 05:55:32432 static void DecodeIconFromPath(const FilePath& icon_path,
[email protected]faf87192012-08-17 00:07:59433 int icon_size,
[email protected]c690a9812009-12-17 05:55:32434 scoped_ptr<SkBitmap>* result);
435
[email protected]5349ac6d2011-04-05 22:20:17436 // Returns the default extension/app icon (for extensions or apps that don't
437 // have one).
[email protected]dd46a4ce2012-09-15 10:50:50438 static const gfx::ImageSkia& GetDefaultIcon(bool is_app);
[email protected]5349ac6d2011-04-05 22:20:17439
[email protected]a807bbe2010-04-14 10:51:19440 // Returns the base extension url for a given |extension_id|.
441 static GURL GetBaseURLFromExtensionId(const std::string& extension_id);
442
[email protected]be7e5cb2010-10-04 12:53:17443 // Adds an extension to the scripting whitelist. Used for testing only.
[email protected]10fb1992010-10-08 09:00:17444 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist);
[email protected]2a521c52011-01-26 18:45:21445 static const ScriptingWhitelist* GetScriptingWhitelist();
[email protected]be7e5cb2010-10-04 12:53:17446
[email protected]902fd7b2011-07-27 18:42:31447 // Parses the host and api permissions from the specified permission |key|
[email protected]d41e2152012-02-24 04:20:27448 // from |manifest_|.
449 bool ParsePermissions(const char* key,
[email protected]fc670822011-12-17 09:33:49450 string16* error,
[email protected]c2e66e12012-06-27 06:27:06451 APIPermissionSet* api_permissions,
[email protected]902fd7b2011-07-27 18:42:31452 URLPatternSet* host_permissions);
453
[email protected]d624b0b2012-12-12 04:05:19454 // Returns true if this extension has the given permission. Prefer
455 // IsExtensionWithPermissionOrSuggestInConsole when developers may be using an
456 // api that requires a permission they didn't know about, e.g. open web apis.
[email protected]c2e66e12012-06-27 06:27:06457 bool HasAPIPermission(APIPermission::ID permission) const;
[email protected]0d3e4a22011-06-23 19:02:52458 bool HasAPIPermission(const std::string& function_name) const;
[email protected]3d0e2262012-08-02 15:32:16459 bool HasAPIPermissionForTab(int tab_id, APIPermission::ID permission) const;
[email protected]583d45c12010-08-31 02:48:12460
[email protected]ecb9ad12012-08-21 13:02:15461 bool CheckAPIPermissionWithParam(APIPermission::ID permission,
462 const APIPermission::CheckParam* param) const;
[email protected]1d8b79a2012-08-16 20:22:54463
[email protected]0d3e4a22011-06-23 19:02:52464 const URLPatternSet& GetEffectiveHostPermissions() const;
[email protected]b24d8312009-08-27 06:47:46465
[email protected]902fd7b2011-07-27 18:42:31466 // Returns true if the extension can silently increase its permission level.
[email protected]0d904312012-01-25 23:00:16467 // Users must approve permissions for unpacked and packed extensions in the
468 // following situations:
469 // - when installing or upgrading packed extensions
470 // - when installing unpacked extensions that have NPAPI plugins
471 // - when either type of extension requests optional permissions
[email protected]902fd7b2011-07-27 18:42:31472 bool CanSilentlyIncreasePermissions() const;
473
[email protected]584b8e3f2010-04-10 00:23:37474 // Whether the extension has access to the given URL.
475 bool HasHostPermission(const GURL& url) const;
476
[email protected]0df165f2010-09-28 16:49:40477 // Whether the extension has effective access to all hosts. This is true if
478 // there is a content script that matches all hosts, if there is a host
479 // permission grants access to all hosts (like <all_urls>) or an api
480 // permission that effectively grants access to all hosts (e.g. proxy,
481 // network, etc.)
482 bool HasEffectiveAccessToAllHosts() const;
[email protected]b24d8312009-08-27 06:47:46483
[email protected]8d888c12010-11-30 00:00:25484 // Whether the extension effectively has all permissions (for example, by
485 // having an NPAPI plugin).
486 bool HasFullPermissions() const;
487
[email protected]902fd7b2011-07-27 18:42:31488 // Returns the full list of permission messages that this extension
489 // should display at install time.
[email protected]c2e66e12012-06-27 06:27:06490 PermissionMessages GetPermissionMessages() const;
[email protected]902fd7b2011-07-27 18:42:31491
492 // Returns the full list of permission messages that this extension
493 // should display at install time. The messages are returned as strings
494 // for convenience.
495 std::vector<string16> GetPermissionMessageStrings() const;
496
[email protected]b0d1d0b2012-11-02 21:19:03497 // Returns true if the extension does not require permission warnings
498 // to be displayed at install time.
499 bool ShouldSkipPermissionWarnings() const;
500
[email protected]902fd7b2011-07-27 18:42:31501 // Sets the active |permissions|.
[email protected]c2e66e12012-06-27 06:27:06502 void SetActivePermissions(const PermissionSet* permissions) const;
[email protected]902fd7b2011-07-27 18:42:31503
504 // Gets the extension's active permission set.
[email protected]c2e66e12012-06-27 06:27:06505 scoped_refptr<const PermissionSet> GetActivePermissions() const;
[email protected]902fd7b2011-07-27 18:42:31506
[email protected]5df6a5d2011-01-26 07:39:12507 // Whether context menu should be shown for page and browser actions.
508 bool ShowConfigureContextMenus() const;
509
[email protected]facd7a7652009-06-05 23:15:02510 // Returns a list of paths (relative to the extension dir) for images that
511 // the browser might load (like themes and page action icons).
[email protected]9adb9692010-10-29 23:14:02512 std::set<FilePath> GetBrowserImages() const;
[email protected]facd7a7652009-06-05 23:15:02513
[email protected]807871f2010-09-16 01:04:48514 // Get an extension icon as a resource or URL.
[email protected]9adb9692010-10-29 23:14:02515 ExtensionResource GetIconResource(
516 int size, ExtensionIconSet::MatchType match_type) const;
517 GURL GetIconURL(int size, ExtensionIconSet::MatchType match_type) const;
[email protected]f34e79632010-03-17 02:34:08518
[email protected]867a73e12010-03-19 20:45:46519 // Gets the fully resolved absolute launch URL.
520 GURL GetFullLaunchURL() const;
[email protected]2a521c52011-01-26 18:45:21521
[email protected]6f229e82010-11-02 17:47:26522 // Image cache related methods. These are only valid on the UI thread and
523 // not maintained by this class. See ImageLoadingTracker for usage. The
524 // |original_size| parameter should be the size of the image at |source|
525 // before any scaling may have been done to produce the pixels in |image|.
526 void SetCachedImage(const ExtensionResource& source,
527 const SkBitmap& image,
528 const gfx::Size& original_size) const;
529 bool HasCachedImage(const ExtensionResource& source,
530 const gfx::Size& max_size) const;
531 SkBitmap GetCachedImage(const ExtensionResource& source,
532 const gfx::Size& max_size) const;
[email protected]2a521c52011-01-26 18:45:21533
534 // Returns true if this extension can execute script on a page. If a
535 // UserScript object is passed, permission to run that specific script is
536 // checked (using its matches list). Otherwise, permission to execute script
537 // programmatically is checked (using the extension's host permission).
538 //
539 // This method is also aware of certain special pages that extensions are
540 // usually not allowed to run script on.
[email protected]78bdfd662012-08-23 05:53:18541 bool CanExecuteScriptOnPage(const GURL& document_url,
542 const GURL& top_document_url,
[email protected]fc5e65d6b2012-06-13 00:22:57543 int tab_id,
[email protected]3aff9ad2011-04-01 20:26:48544 const UserScript* script,
[email protected]2a521c52011-01-26 18:45:21545 std::string* error) const;
546
[email protected]6f229e82010-11-02 17:47:26547 // Returns true if this extension is a COMPONENT extension, or if it is
548 // on the whitelist of extensions that can script all pages.
549 bool CanExecuteScriptEverywhere() const;
550
[email protected]5efbfe012011-02-22 23:07:18551 // Returns true if this extension is allowed to obtain the contents of a
552 // page as an image. Since a page may contain sensitive information, this
553 // is restricted to the extension's host permissions as well as the
554 // extension page itself.
[email protected]fc5e65d6b2012-06-13 00:22:57555 bool CanCaptureVisiblePage(const GURL& page_url,
556 int tab_id,
557 std::string* error) const;
[email protected]5efbfe012011-02-22 23:07:18558
[email protected]a65882c2010-11-12 15:15:09559 // Returns true if this extension updates itself using the extension
560 // gallery.
561 bool UpdatesFromGallery() const;
562
[email protected]cca147172011-02-17 01:29:29563 // Returns true if this extension or app includes areas within |origin|.
564 bool OverlapsWithOrigin(const GURL& origin) const;
565
[email protected]3bdba0d2011-08-23 07:17:30566 // Returns the sync bucket to use for this extension.
567 SyncType GetSyncType() const;
568
[email protected]b873cd92012-02-09 21:51:48569 // Returns true if the extension should be synced.
570 bool IsSyncable() const;
571
[email protected]7e0f92b2012-11-09 03:51:04572 // Returns true if the extension requires a valid ordinal for sorting, e.g.,
573 // for displaying in a launcher or new tab page.
574 bool RequiresSortOrdinal() const;
575
576 // Returns true if the extension should be displayed in the app launcher.
577 bool ShouldDisplayInAppLauncher() const;
578
579 // Returns true if the extension should be displayed in the browser NTP.
580 bool ShouldDisplayInNewTabPage() const;
[email protected]b873cd92012-02-09 21:51:48581
[email protected]e0b3de72012-05-01 01:21:34582 // Returns true if the extension should be displayed in the extension
583 // settings page (i.e. chrome://extensions).
584 bool ShouldDisplayInExtensionSettings() const;
585
[email protected]4f886012012-05-19 03:51:10586 // Returns true if the extension has a content script declared at |url|.
587 bool HasContentScriptAtURL(const GURL& url) const;
588
[email protected]fc5e65d6b2012-06-13 00:22:57589 // Gets the tab-specific host permissions of |tab_id|, or NULL if there
590 // aren't any.
[email protected]3d0e2262012-08-02 15:32:16591 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id)
592 const;
[email protected]fc5e65d6b2012-06-13 00:22:57593
[email protected]3d0e2262012-08-02 15:32:16594 // Updates the tab-specific permissions of |tab_id| to include those from
595 // |permissions|.
[email protected]6144057e2012-08-02 19:02:37596 void UpdateTabSpecificPermissions(
597 int tab_id,
598 scoped_refptr<const PermissionSet> permissions) const;
[email protected]fc5e65d6b2012-06-13 00:22:57599
[email protected]3d0e2262012-08-02 15:32:16600 // Clears the tab-specific permissions of |tab_id|.
601 void ClearTabSpecificPermissions(int tab_id) const;
[email protected]fc5e65d6b2012-06-13 00:22:57602
[email protected]d356c982012-12-12 19:32:55603 // Get the manifest data associated with the key, or NULL if there is none.
604 // Can only be called after InitValue is finished.
605 ManifestData* GetManifestData(const std::string& key) const;
606
607 // Sets |data| to be associated with the key. Takes ownership of |data|.
608 // Can only be called before InitValue is finished. Not thread-safe;
609 // all SetManifestData calls should be on only one thread.
610 void SetManifestData(const std::string& key, ManifestData* data);
611
[email protected]6f229e82010-11-02 17:47:26612 // Accessors:
613
[email protected]98270432012-09-11 20:51:24614 const Requirements& requirements() const { return requirements_; }
[email protected]6f229e82010-11-02 17:47:26615 const FilePath& path() const { return path_; }
616 const GURL& url() const { return extension_url_; }
[email protected]d41e2152012-02-24 04:20:27617 Location location() const;
618 const std::string& id() const;
[email protected]6f229e82010-11-02 17:47:26619 const Version* version() const { return version_.get(); }
620 const std::string VersionString() const;
621 const std::string& name() const { return name_; }
[email protected]701d1e82012-05-14 05:34:19622 const std::string& non_localized_name() const { return non_localized_name_; }
[email protected]200423d2012-06-05 01:16:06623 // Base64-encoded version of the key used to sign this extension.
624 // In pseudocode, returns
625 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()).
626 const std::string& public_key() const { return public_key_; }
[email protected]6f229e82010-11-02 17:47:26627 const std::string& description() const { return description_; }
[email protected]a47c8a22011-11-17 18:40:31628 int manifest_version() const { return manifest_version_; }
[email protected]6f229e82010-11-02 17:47:26629 bool converted_from_user_script() const {
630 return converted_from_user_script_;
631 }
632 const UserScriptList& content_scripts() const { return content_scripts_; }
[email protected]0f34d9082012-10-08 19:16:44633 const ActionInfo* script_badge_info() const {
634 return script_badge_info_.get();
635 }
636 const ActionInfo* page_action_info() const { return page_action_info_.get(); }
637 const ActionInfo* browser_action_info() const {
638 return browser_action_info_.get();
639 }
[email protected]ad12b6b2012-11-28 23:21:15640 const ActionInfo* system_indicator_info() const {
641 return system_indicator_info_.get();
642 }
[email protected]6f229e82010-11-02 17:47:26643 const std::vector<PluginInfo>& plugins() const { return plugins_; }
[email protected]65378f52011-04-08 02:31:23644 const std::vector<NaClModuleInfo>& nacl_modules() const {
645 return nacl_modules_;
646 }
[email protected]7c519ab2012-05-04 10:02:51647 // The browser action command that the extension wants to use, which is not
648 // necessarily the one it can use, as it might be inactive (see also
[email protected]d179cdd2012-08-03 08:32:52649 // GetBrowserActionCommand in CommandService).
[email protected]3fc5f6a2012-05-04 14:23:59650 const extensions::Command* browser_action_command() const {
[email protected]9c8b54d2012-04-02 10:17:30651 return browser_action_command_.get();
652 }
[email protected]7c519ab2012-05-04 10:02:51653 // The page action command that the extension wants to use, which is not
654 // necessarily the one it can use, as it might be inactive (see also
[email protected]d179cdd2012-08-03 08:32:52655 // GetPageActionCommand in CommandService).
[email protected]3fc5f6a2012-05-04 14:23:59656 const extensions::Command* page_action_command() const {
[email protected]9c8b54d2012-04-02 10:17:30657 return page_action_command_.get();
658 }
[email protected]d179cdd2012-08-03 08:32:52659 // The script badge command that the extension wants to use, which is not
660 // necessarily the one it can use, as it might be inactive (see also
661 // GetScriptBadgeCommand in CommandService).
662 const extensions::Command* script_badge_command() const {
663 return script_badge_command_.get();
664 }
[email protected]7c519ab2012-05-04 10:02:51665 // The map (of command names to commands) that the extension wants to use,
[email protected]422656932012-05-03 09:31:51666 // which is not necessarily the one it can use, as they might be inactive
[email protected]d179cdd2012-08-03 08:32:52667 // (see also GetNamedCommands in CommandService).
[email protected]3fc5f6a2012-05-04 14:23:59668 const extensions::CommandMap& named_commands() const {
[email protected]9c8b54d2012-04-02 10:17:30669 return named_commands_;
[email protected]f5532472012-02-23 13:00:55670 }
[email protected]a03d4448f2012-01-10 23:25:28671 bool has_background_page() const {
672 return background_url_.is_valid() || !background_scripts_.empty();
673 }
[email protected]7b54ca02012-03-02 18:06:53674 bool allow_background_js_access() const {
675 return allow_background_js_access_;
676 }
[email protected]a03d4448f2012-01-10 23:25:28677 const std::vector<std::string>& background_scripts() const {
678 return background_scripts_;
679 }
[email protected]d2aa06b2012-03-21 20:57:26680 bool has_persistent_background_page() const {
[email protected]dd62fa802012-04-25 18:37:00681 return has_background_page() && background_page_is_persistent_;
[email protected]d2aa06b2012-03-21 20:57:26682 }
683 bool has_lazy_background_page() const {
[email protected]dd62fa802012-04-25 18:37:00684 return has_background_page() && !background_page_is_persistent_;
[email protected]d2aa06b2012-03-21 20:57:26685 }
[email protected]6f229e82010-11-02 17:47:26686 const GURL& options_url() const { return options_url_; }
[email protected]81ca71652012-08-23 22:28:26687 const GURL& details_url() const { return details_url_;}
[email protected]c2e66e12012-06-27 06:27:06688 const PermissionSet* optional_permission_set() const {
[email protected]902fd7b2011-07-27 18:42:31689 return optional_permission_set_.get();
690 }
[email protected]c2e66e12012-06-27 06:27:06691 const PermissionSet* required_permission_set() const {
[email protected]902fd7b2011-07-27 18:42:31692 return required_permission_set_.get();
[email protected]6f229e82010-11-02 17:47:26693 }
[email protected]ab55c2b2012-06-01 23:55:03694 // Appends |new_warnings| to install_warnings().
[email protected]1e0f45a2012-06-13 00:31:06695 void AddInstallWarnings(const InstallWarningVector& new_warnings);
696 const InstallWarningVector& install_warnings() const {
[email protected]8629c542012-04-20 03:40:03697 return install_warnings_;
698 }
[email protected]6f229e82010-11-02 17:47:26699 const GURL& update_url() const { return update_url_; }
700 const ExtensionIconSet& icons() const { return icons_; }
[email protected]953620b2011-12-04 00:55:32701 const extensions::Manifest* manifest() const {
[email protected]e9629d772012-08-06 19:44:46702 return manifest_.get();
[email protected]6f229e82010-11-02 17:47:26703 }
704 const std::string default_locale() const { return default_locale_; }
[email protected]6f229e82010-11-02 17:47:26705 bool incognito_split_mode() const { return incognito_split_mode_; }
[email protected]1abdf4f2011-08-16 21:11:55706 bool offline_enabled() const { return offline_enabled_; }
[email protected]a79be1f2012-03-23 22:14:00707 const OAuth2Info& oauth2_info() const { return oauth2_info_; }
[email protected]3aff9ad2011-04-01 20:26:48708 bool wants_file_access() const { return wants_file_access_; }
[email protected]2af352b2011-07-22 08:21:23709 int creation_flags() const { return creation_flags_; }
710 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; }
[email protected]e805baf2011-07-26 18:23:05711 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; }
[email protected]e33bbc22012-08-27 22:05:46712 bool was_installed_by_default() const {
713 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0;
714 }
[email protected]3aff9ad2011-04-01 20:26:48715
[email protected]6f229e82010-11-02 17:47:26716 // App-related.
[email protected]953620b2011-12-04 00:55:32717 bool is_app() const {
[email protected]c4f459d2012-09-28 04:40:10718 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app();
[email protected]23690872011-12-01 22:02:39719 }
[email protected]d41e2152012-02-24 04:20:27720 bool is_platform_app() const;
721 bool is_hosted_app() const;
[email protected]c4f459d2012-09-28 04:40:10722 bool is_legacy_packaged_app() const;
[email protected]ff05a4b102012-12-19 00:12:06723 bool is_extension() const;
[email protected]605fb8102012-05-04 01:36:55724 bool is_storage_isolated() const { return is_storage_isolated_; }
[email protected]cdc7b1f42012-12-07 19:39:48725 bool can_be_incognito_enabled() const;
[email protected]636ee43282013-01-12 15:58:00726 void AddWebExtentPattern(const URLPattern& pattern);
[email protected]cced75a2011-05-20 08:31:12727 const URLPatternSet& web_extent() const { return extent_; }
[email protected]6f229e82010-11-02 17:47:26728 const std::string& launch_local_path() const { return launch_local_path_; }
729 const std::string& launch_web_url() const { return launch_web_url_; }
730 extension_misc::LaunchContainer launch_container() const {
731 return launch_container_;
732 }
[email protected]dc37b002012-04-23 23:02:26733 int launch_width() const { return launch_width_; }
734 int launch_height() const { return launch_height_; }
[email protected]6f229e82010-11-02 17:47:26735
736 // Theme-related.
[email protected]d41e2152012-02-24 04:20:27737 bool is_theme() const;
[email protected]f3a1c642011-07-12 19:15:03738 base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); }
739 base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); }
740 base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); }
741 base::DictionaryValue* GetThemeDisplayProperties() const {
[email protected]6f229e82010-11-02 17:47:26742 return theme_display_properties_.get();
743 }
744
[email protected]6d55bd62012-11-21 17:52:03745 // Content Security Policy!
746 const std::string& content_security_policy() const {
747 return content_security_policy_;
748 }
749
[email protected]66008002013-01-08 09:09:13750 // Content pack related.
751 ExtensionResource GetContentPackSiteList() const;
752
[email protected]a03d4448f2012-01-10 23:25:28753 GURL GetBackgroundURL() const;
754
[email protected]4a8d3272009-03-10 19:15:08755 private:
[email protected]66e4eb32010-10-27 20:37:41756 friend class base::RefCountedThreadSafe<Extension>;
757
[email protected]d7e9a862010-11-03 21:57:49758 // We keep a cache of images loaded from extension resources based on their
759 // path and a string representation of a size that may have been used to
760 // scale it (or the empty string if the image is at its original size).
761 typedef std::pair<FilePath, std::string> ImageCacheKey;
762 typedef std::map<ImageCacheKey, SkBitmap> ImageCache;
763
[email protected]902fd7b2011-07-27 18:42:31764 class RuntimeData {
765 public:
766 RuntimeData();
[email protected]c2e66e12012-06-27 06:27:06767 explicit RuntimeData(const PermissionSet* active);
[email protected]902fd7b2011-07-27 18:42:31768 ~RuntimeData();
769
[email protected]c2e66e12012-06-27 06:27:06770 void SetActivePermissions(const PermissionSet* active);
771 scoped_refptr<const PermissionSet> GetActivePermissions() const;
[email protected]902fd7b2011-07-27 18:42:31772
[email protected]3d0e2262012-08-02 15:32:16773 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id)
774 const;
[email protected]6144057e2012-08-02 19:02:37775 void UpdateTabSpecificPermissions(
776 int tab_id,
777 scoped_refptr<const PermissionSet> permissions);
[email protected]3d0e2262012-08-02 15:32:16778 void ClearTabSpecificPermissions(int tab_id);
[email protected]fc5e65d6b2012-06-13 00:22:57779
[email protected]902fd7b2011-07-27 18:42:31780 private:
781 friend class base::RefCountedThreadSafe<RuntimeData>;
[email protected]fc5e65d6b2012-06-13 00:22:57782
[email protected]c2e66e12012-06-27 06:27:06783 scoped_refptr<const PermissionSet> active_permissions_;
[email protected]fc5e65d6b2012-06-13 00:22:57784
[email protected]3d0e2262012-08-02 15:32:16785 typedef std::map<int, scoped_refptr<const PermissionSet> >
786 TabPermissionsMap;
787 TabPermissionsMap tab_specific_permissions_;
[email protected]902fd7b2011-07-27 18:42:31788 };
789
[email protected]d41e2152012-02-24 04:20:27790 // Chooses the extension ID for an extension based on a variety of criteria.
791 // The chosen ID will be set in |manifest|.
792 static bool InitExtensionID(extensions::Manifest* manifest,
793 const FilePath& path,
794 const std::string& explicit_id,
795 int creation_flags,
796 string16* error);
797
[email protected]4ead6f72010-10-13 19:54:18798 // Normalize the path for use by the extension. On Windows, this will make
799 // sure the drive letter is uppercase.
800 static FilePath MaybeNormalizePath(const FilePath& path);
801
[email protected]87c655e2011-07-01 21:42:00802 // Returns true if this extension id is from a trusted provider.
803 static bool IsTrustedId(const std::string& id);
804
[email protected]d41e2152012-02-24 04:20:27805 Extension(const FilePath& path, scoped_ptr<extensions::Manifest> manifest);
[email protected]d356c982012-12-12 19:32:55806 virtual ~Extension();
[email protected]66e4eb32010-10-27 20:37:41807
808 // Initialize the extension from a parsed manifest.
[email protected]d41e2152012-02-24 04:20:27809 // TODO(aa): Rename to just Init()? There's no Value here anymore.
810 // TODO(aa): It is really weird the way this class essentially contains a copy
811 // of the underlying DictionaryValue in its members. We should decide to
812 // either wrap the DictionaryValue and go with that only, or we should parse
813 // into strong types and discard the value. But doing both is bad.
814 bool InitFromValue(int flags, string16* error);
[email protected]66e4eb32010-10-27 20:37:41815
[email protected]58f62cf2012-03-09 10:45:11816 // The following are helpers for InitFromValue to load various features of the
817 // extension from the manifest.
818
[email protected]c2e66e12012-06-27 06:27:06819 bool LoadAppIsolation(const APIPermissionSet& api_permissions,
[email protected]605fb8102012-05-04 01:36:55820 string16* error);
[email protected]58f62cf2012-03-09 10:45:11821
822 bool LoadRequiredFeatures(string16* error);
823 bool LoadName(string16* error);
824 bool LoadVersion(string16* error);
825
826 bool LoadAppFeatures(string16* error);
[email protected]d41e2152012-02-24 04:20:27827 bool LoadExtent(const char* key,
828 URLPatternSet* extent,
829 const char* list_error,
830 const char* value_error,
831 string16* error);
832 bool LoadLaunchContainer(string16* error);
833 bool LoadLaunchURL(string16* error);
[email protected]10253da2012-03-09 04:06:42834
[email protected]c2e66e12012-06-27 06:27:06835 bool LoadSharedFeatures(const APIPermissionSet& api_permissions,
[email protected]58f62cf2012-03-09 10:45:11836 string16* error);
837 bool LoadDescription(string16* error);
838 bool LoadManifestVersion(string16* error);
[email protected]58f62cf2012-03-09 10:45:11839 bool LoadUpdateURL(string16* error);
840 bool LoadIcons(string16* error);
841 bool LoadCommands(string16* error);
842 bool LoadPlugins(string16* error);
843 bool LoadNaClModules(string16* error);
844 bool LoadWebAccessibleResources(string16* error);
[email protected]dbb24162012-06-06 01:41:22845 bool LoadSandboxedPages(string16* error);
[email protected]98270432012-09-11 20:51:24846 // Must be called after LoadPlugins().
847 bool LoadRequirements(string16* error);
[email protected]58f62cf2012-03-09 10:45:11848 bool LoadDefaultLocale(string16* error);
849 bool LoadOfflineEnabled(string16* error);
850 bool LoadOptionsPage(string16* error);
[email protected]d41e2152012-02-24 04:20:27851 bool LoadBackgroundScripts(string16* error);
[email protected]756038532012-06-08 05:45:03852 bool LoadBackgroundScripts(const std::string& key, string16* error);
[email protected]c2e66e12012-06-27 06:27:06853 bool LoadBackgroundPage(const APIPermissionSet& api_permissions,
[email protected]d41e2152012-02-24 04:20:27854 string16* error);
[email protected]756038532012-06-08 05:45:03855 bool LoadBackgroundPage(const std::string& key,
[email protected]c2e66e12012-06-27 06:27:06856 const APIPermissionSet& api_permissions,
[email protected]756038532012-06-08 05:45:03857 string16* error);
[email protected]dd62fa802012-04-25 18:37:00858 bool LoadBackgroundPersistent(
[email protected]c2e66e12012-06-27 06:27:06859 const APIPermissionSet& api_permissions,
[email protected]d41e2152012-02-24 04:20:27860 string16* error);
[email protected]58f62cf2012-03-09 10:45:11861 bool LoadBackgroundAllowJSAccess(
[email protected]c2e66e12012-06-27 06:27:06862 const APIPermissionSet& api_permissions,
[email protected]7b54ca02012-03-02 18:06:53863 string16* error);
[email protected]ad12b6b2012-11-28 23:21:15864 bool LoadExtensionFeatures(APIPermissionSet* api_permissions,
[email protected]58f62cf2012-03-09 10:45:11865 string16* error);
[email protected]d356c982012-12-12 19:32:55866 bool LoadManifestHandlerFeatures(string16* error);
[email protected]58f62cf2012-03-09 10:45:11867 bool LoadContentScripts(string16* error);
868 bool LoadPageAction(string16* error);
869 bool LoadBrowserAction(string16* error);
[email protected]18049dc2012-06-19 23:12:55870 bool LoadScriptBadge(string16* error);
[email protected]ad12b6b2012-11-28 23:21:15871 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error);
[email protected]58f62cf2012-03-09 10:45:11872 bool LoadTextToSpeechVoices(string16* error);
873 bool LoadIncognitoMode(string16* error);
874 bool LoadContentSecurityPolicy(string16* error);
875
876 bool LoadThemeFeatures(string16* error);
877 bool LoadThemeImages(const base::DictionaryValue* theme_value,
878 string16* error);
879 bool LoadThemeColors(const base::DictionaryValue* theme_value,
880 string16* error);
881 bool LoadThemeTints(const base::DictionaryValue* theme_value,
882 string16* error);
883 bool LoadThemeDisplayProperties(const base::DictionaryValue* theme_value,
884 string16* error);
885
[email protected]66008002013-01-08 09:09:13886 bool LoadManagedModeFeatures(string16* error);
887 bool LoadManagedModeSites(
888 const base::DictionaryValue* content_pack_value,
889 string16* error);
890 bool LoadManagedModeConfigurations(
891 const base::DictionaryValue* content_pack_value,
892 string16* error);
893
[email protected]58f62cf2012-03-09 10:45:11894 // Helper function for implementing HasCachedImage/GetCachedImage. A return
895 // value of NULL means there is no matching image cached (we allow caching an
896 // empty SkBitmap).
897 SkBitmap* GetCachedImageImpl(const ExtensionResource& source,
898 const gfx::Size& max_size) const;
[email protected]d9ad80f2010-03-30 20:40:18899
[email protected]3cfbd0e2009-03-18 21:26:24900 // Helper method that loads a UserScript object from a
901 // dictionary in the content_script list of the manifest.
[email protected]f3a1c642011-07-12 19:15:03902 bool LoadUserScriptHelper(const base::DictionaryValue* content_script,
[email protected]3cfbd0e2009-03-18 21:26:24903 int definition_index,
[email protected]fc670822011-12-17 09:33:49904 string16* error,
[email protected]3cfbd0e2009-03-18 21:26:24905 UserScript* result);
[email protected]f7f3a5f2009-05-01 22:02:34906
[email protected]6657afa62009-11-04 02:15:20907 // Helper method that loads either the include_globs or exclude_globs list
908 // from an entry in the content_script lists of the manifest.
[email protected]f3a1c642011-07-12 19:15:03909 bool LoadGlobsHelper(const base::DictionaryValue* content_script,
[email protected]6657afa62009-11-04 02:15:20910 int content_script_index,
[email protected]e2194742010-08-12 05:54:34911 const char* globs_property_name,
[email protected]fc670822011-12-17 09:33:49912 string16* error,
[email protected]11f4857282009-11-13 19:56:17913 void(UserScript::*add_method)(const std::string& glob),
[email protected]488e6502012-09-07 14:17:34914 UserScript* instance);
[email protected]6657afa62009-11-04 02:15:20915
[email protected]5d246db22009-10-27 06:17:57916 // Helper method to load an ExtensionAction from the page_action or
[email protected]92c6f9b92009-10-24 04:35:08917 // browser_action entries in the manifest.
[email protected]0f34d9082012-10-08 19:16:44918 scoped_ptr<ActionInfo> LoadExtensionActionInfoHelper(
919 const base::DictionaryValue* manifest_section,
920 ActionInfo::Type action_type,
[email protected]18049dc2012-06-19 23:12:55921 string16* error);
[email protected]92c6f9b92009-10-24 04:35:08922
[email protected]a79be1f2012-03-23 22:14:00923 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key.
924 bool LoadOAuth2Info(string16* error);
925
[email protected]2f6698b2010-10-14 00:58:21926 // Returns true if the extension has more than one "UI surface". For example,
927 // an extension that has a browser action and a page action.
928 bool HasMultipleUISurfaces() const;
929
[email protected]be9d9c82011-07-13 04:17:31930 // Updates the launch URL and extents for the extension using the given
931 // |override_url|.
932 void OverrideLaunchUrl(const GURL& override_url);
933
[email protected]ae655e4e2012-03-16 21:47:55934 // Custom checks for the experimental permission that can't be expressed in
935 // _permission_features.json.
[email protected]5eddc3e2011-10-26 04:33:31936 bool CanSpecifyExperimentalPermission() const;
[email protected]5eddc3e2011-10-26 04:33:31937
938 // Checks whether the host |pattern| is allowed for this extension, given API
939 // permissions |permissions|.
940 bool CanSpecifyHostPermission(const URLPattern& pattern,
[email protected]c2e66e12012-06-27 06:27:06941 const APIPermissionSet& permissions) const;
[email protected]5eddc3e2011-10-26 04:33:31942
[email protected]488e6502012-09-07 14:17:34943 bool CheckMinimumChromeVersion(string16* error) const;
[email protected]488e6502012-09-07 14:17:34944
[email protected]e92169e2012-05-04 22:49:32945 // Check that platform app features are valid. Called after InitFromValue.
[email protected]488e6502012-09-07 14:17:34946 bool CheckPlatformAppFeatures(std::string* utf8_error) const;
[email protected]e92169e2012-05-04 22:49:32947
[email protected]f1bab9c92012-05-11 21:15:10948 // Check that features don't conflict. Called after InitFromValue.
[email protected]488e6502012-09-07 14:17:34949 bool CheckConflictingFeatures(std::string* utf8_error) const;
[email protected]f1bab9c92012-05-11 21:15:10950
[email protected]d7e9a862010-11-03 21:57:49951 // Cached images for this extension. This should only be touched on the UI
952 // thread.
953 mutable ImageCache image_cache_;
[email protected]1e8c93f2010-02-08 22:58:31954
[email protected]6f229e82010-11-02 17:47:26955 // The extension's human-readable name. Name is used for display purpose. It
956 // might be wrapped with unicode bidi control characters so that it is
957 // displayed correctly in RTL context.
958 // NOTE: Name is UTF-8 and may contain non-ascii characters.
959 std::string name_;
960
[email protected]701d1e82012-05-14 05:34:19961 // A non-localized version of the extension's name. This is useful for
962 // debug output.
963 std::string non_localized_name_;
964
[email protected]a47c8a22011-11-17 18:40:31965 // The version of this extension's manifest. We increase the manifest
966 // version when making breaking changes to the extension system.
967 // Version 1 was the first manifest version (implied by a lack of a
968 // manifest_version attribute in the extension's manifest). We initialize
969 // this member variable to 0 to distinguish the "uninitialized" case from
970 // the case when we know the manifest version actually is 1.
971 int manifest_version_;
972
[email protected]98270432012-09-11 20:51:24973 // The requirements declared in the manifest.
974 Requirements requirements_;
975
[email protected]d41e2152012-02-24 04:20:27976 // The absolute path to the directory the extension is stored in.
977 FilePath path_;
978
[email protected]6f229e82010-11-02 17:47:26979 // Default locale for fall back. Can be empty if extension is not localized.
980 std::string default_locale_;
981
982 // If true, a separate process will be used for the extension in incognito
983 // mode.
984 bool incognito_split_mode_;
985
[email protected]1abdf4f2011-08-16 21:11:55986 // Whether the extension or app should be enabled when offline.
987 bool offline_enabled_;
988
[email protected]6f229e82010-11-02 17:47:26989 // Defines the set of URLs in the extension's web content.
[email protected]cced75a2011-05-20 08:31:12990 URLPatternSet extent_;
[email protected]6f229e82010-11-02 17:47:26991
[email protected]902fd7b2011-07-27 18:42:31992 // The extension runtime data.
993 mutable base::Lock runtime_data_lock_;
994 mutable RuntimeData runtime_data_;
995
996 // The set of permissions the extension can request at runtime.
[email protected]c2e66e12012-06-27 06:27:06997 scoped_refptr<const PermissionSet> optional_permission_set_;
[email protected]902fd7b2011-07-27 18:42:31998
999 // The extension's required / default set of permissions.
[email protected]c2e66e12012-06-27 06:27:061000 scoped_refptr<const PermissionSet> required_permission_set_;
[email protected]6f229e82010-11-02 17:47:261001
[email protected]8629c542012-04-20 03:40:031002 // Any warnings that occurred when trying to create/parse the extension.
[email protected]1e0f45a2012-06-13 00:31:061003 InstallWarningVector install_warnings_;
[email protected]8629c542012-04-20 03:40:031004
[email protected]6f229e82010-11-02 17:47:261005 // The icons for the extension.
1006 ExtensionIconSet icons_;
1007
1008 // The base extension url for the extension.
1009 GURL extension_url_;
1010
[email protected]6f229e82010-11-02 17:47:261011 // The extension's version.
1012 scoped_ptr<Version> version_;
1013
1014 // An optional longer description of the extension.
1015 std::string description_;
1016
1017 // True if the extension was generated from a user script. (We show slightly
1018 // different UI if so).
1019 bool converted_from_user_script_;
1020
1021 // Paths to the content scripts the extension contains.
1022 UserScriptList content_scripts_;
1023
1024 // The extension's page action, if any.
[email protected]0f34d9082012-10-08 19:16:441025 scoped_ptr<ActionInfo> page_action_info_;
[email protected]6f229e82010-11-02 17:47:261026
1027 // The extension's browser action, if any.
[email protected]0f34d9082012-10-08 19:16:441028 scoped_ptr<ActionInfo> browser_action_info_;
[email protected]6f229e82010-11-02 17:47:261029
[email protected]18049dc2012-06-19 23:12:551030 // The extension's script badge. Never NULL.
[email protected]0f34d9082012-10-08 19:16:441031 scoped_ptr<ActionInfo> script_badge_info_;
1032
[email protected]ad12b6b2012-11-28 23:21:151033 // The extension's system indicator, if any.
1034 scoped_ptr<ActionInfo> system_indicator_info_;
1035
[email protected]6f229e82010-11-02 17:47:261036 // Optional list of NPAPI plugins and associated properties.
1037 std::vector<PluginInfo> plugins_;
1038
[email protected]65378f52011-04-08 02:31:231039 // Optional list of NaCl modules and associated properties.
1040 std::vector<NaClModuleInfo> nacl_modules_;
1041
[email protected]f5532472012-02-23 13:00:551042 // Optional list of commands (keyboard shortcuts).
[email protected]3fc5f6a2012-05-04 14:23:591043 scoped_ptr<extensions::Command> browser_action_command_;
1044 scoped_ptr<extensions::Command> page_action_command_;
[email protected]d179cdd2012-08-03 08:32:521045 scoped_ptr<extensions::Command> script_badge_command_;
[email protected]3fc5f6a2012-05-04 14:23:591046 extensions::CommandMap named_commands_;
[email protected]f5532472012-02-23 13:00:551047
[email protected]8f270be2011-12-21 21:15:221048 // Optional list of web accessible extension resources.
[email protected]f59a8052012-06-20 22:25:001049 URLPatternSet web_accessible_resources_;
[email protected]8f270be2011-12-21 21:15:221050
[email protected]dbb24162012-06-06 01:41:221051 // Optional list of extension pages that are sandboxed (served from a unique
1052 // origin with a different Content Security Policy).
[email protected]f59a8052012-06-20 22:25:001053 URLPatternSet sandboxed_pages_;
[email protected]dbb24162012-06-06 01:41:221054
1055 // Content Security Policy that should be used to enforce the sandbox used
1056 // by sandboxed pages (guaranteed to have the "sandbox" directive without the
1057 // "allow-same-origin" token).
1058 std::string sandboxed_pages_content_security_policy_;
1059
[email protected]6f229e82010-11-02 17:47:261060 // Optional URL to a master page of which a single instance should be always
1061 // loaded in the background.
1062 GURL background_url_;
1063
[email protected]a03d4448f2012-01-10 23:25:281064 // Optional list of scripts to use to generate a background page. If this is
1065 // present, background_url_ will be empty and generated by GetBackgroundURL().
1066 std::vector<std::string> background_scripts_;
1067
[email protected]dd62fa802012-04-25 18:37:001068 // True if the background page should stay loaded forever; false if it should
1069 // load on-demand (when it needs to handle an event). Defaults to true.
1070 bool background_page_is_persistent_;
[email protected]9e6720a2012-01-24 02:30:561071
[email protected]7b54ca02012-03-02 18:06:531072 // True if the background page can be scripted by pages of the app or
1073 // extension, in which case all such pages must run in the same process.
1074 // False if such pages are not permitted to script the background page,
1075 // allowing them to run in different processes.
1076 bool allow_background_js_access_;
1077
[email protected]6f229e82010-11-02 17:47:261078 // Optional URL to a page for setting options/preferences.
1079 GURL options_url_;
1080
[email protected]81ca71652012-08-23 22:28:261081 // URL to the webstore page of the extension.
1082 GURL details_url_;
1083
[email protected]6f229e82010-11-02 17:47:261084 // The public key used to sign the contents of the crx package.
1085 std::string public_key_;
1086
1087 // A map of resource id's to relative file paths.
[email protected]f3a1c642011-07-12 19:15:031088 scoped_ptr<base::DictionaryValue> theme_images_;
[email protected]6f229e82010-11-02 17:47:261089
1090 // A map of color names to colors.
[email protected]f3a1c642011-07-12 19:15:031091 scoped_ptr<base::DictionaryValue> theme_colors_;
[email protected]6f229e82010-11-02 17:47:261092
1093 // A map of color names to colors.
[email protected]f3a1c642011-07-12 19:15:031094 scoped_ptr<base::DictionaryValue> theme_tints_;
[email protected]6f229e82010-11-02 17:47:261095
1096 // A map of display properties.
[email protected]f3a1c642011-07-12 19:15:031097 scoped_ptr<base::DictionaryValue> theme_display_properties_;
[email protected]6f229e82010-11-02 17:47:261098
[email protected]66008002013-01-08 09:09:131099 // A file containing a list of sites for Managed Mode.
1100 FilePath content_pack_site_list_;
1101
[email protected]6f229e82010-11-02 17:47:261102 // URL for fetching an update manifest
1103 GURL update_url_;
1104
[email protected]58f62cf2012-03-09 10:45:111105 // The manifest from which this extension was created.
[email protected]e9629d772012-08-06 19:44:461106 scoped_ptr<Manifest> manifest_;
[email protected]6f229e82010-11-02 17:47:261107
[email protected]d356c982012-12-12 19:32:551108 // Stored parsed manifest data.
1109 ManifestDataMap manifest_data_;
1110
1111 // Set to true at the end of InitValue when initialization is finished.
1112 bool finished_parsing_manifest_;
1113
[email protected]d9696672011-03-15 22:45:091114 // Whether this extension requests isolated storage.
1115 bool is_storage_isolated_;
1116
[email protected]6f229e82010-11-02 17:47:261117 // The local path inside the extension to use with the launcher.
1118 std::string launch_local_path_;
1119
1120 // A web url to use with the launcher. Note that this might be relative or
1121 // absolute. If relative, it is relative to web_origin.
1122 std::string launch_web_url_;
1123
[email protected]4e595682011-02-09 17:07:021124 // The window type that an app's manifest specifies to launch into.
1125 // This is not always the window type an app will open into, because
1126 // users can override the way each app launches. See
1127 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
1128 // to decide what container an app will launch in.
[email protected]6f229e82010-11-02 17:47:261129 extension_misc::LaunchContainer launch_container_;
1130
1131 // The default size of the container when launching. Only respected for
1132 // containers like panels and windows.
1133 int launch_width_;
1134 int launch_height_;
1135
[email protected]7e0f92b2012-11-09 03:51:041136 // Should this app be shown in the app launcher.
[email protected]ed1a204f2012-09-22 00:28:441137 bool display_in_launcher_;
1138
[email protected]7e0f92b2012-11-09 03:51:041139 // Should this app be shown in the browser New Tab Page.
1140 bool display_in_new_tab_page_;
1141
[email protected]a79be1f2012-03-23 22:14:001142 // The OAuth2 client id and scopes, if specified by the extension.
1143 OAuth2Info oauth2_info_;
1144
[email protected]3aff9ad2011-04-01 20:26:481145 // Whether the extension has host permissions or user script patterns that
1146 // imply access to file:/// scheme URLs (the user may not have actually
1147 // granted it that access).
1148 bool wants_file_access_;
1149
[email protected]2af352b2011-07-22 08:21:231150 // The flags that were passed to InitFromValue.
1151 int creation_flags_;
[email protected]620db1762011-07-15 21:57:341152
[email protected]7f7b9d932011-04-20 16:13:261153 // The Content-Security-Policy for this extension. Extensions can use
1154 // Content-Security-Policies to mitigate cross-site scripting and other
1155 // vulnerabilities.
1156 std::string content_security_policy_;
1157
[email protected]19118d52010-07-26 22:13:421158 FRIEND_TEST_ALL_PREFIXES(ExtensionTest, LoadPageActionHelper);
[email protected]1c321ee2012-05-21 03:02:341159 FRIEND_TEST_ALL_PREFIXES(::TabStripModelTest, Apps);
[email protected]ae7fe712009-07-02 20:33:581160
[email protected]894bb502009-05-21 22:39:571161 DISALLOW_COPY_AND_ASSIGN(Extension);
[email protected]7713d632008-12-02 07:52:331162};
1163
[email protected]9adb9692010-10-29 23:14:021164typedef std::vector< scoped_refptr<const Extension> > ExtensionList;
[email protected]ec5b50d2010-10-09 16:35:181165typedef std::set<std::string> ExtensionIdSet;
[email protected]82590cb2012-09-28 04:14:081166typedef std::vector<std::string> ExtensionIdList;
[email protected]b1748b1d82009-11-30 20:32:561167
[email protected]18049dc2012-06-19 23:12:551168// Let gtest print InstallWarnings.
1169void PrintTo(const Extension::InstallWarning&, ::std::ostream* os);
1170
[email protected]c6d474f82009-12-16 21:11:061171// Handy struct to pass core extension info around.
1172struct ExtensionInfo {
[email protected]f3a1c642011-07-12 19:15:031173 ExtensionInfo(const base::DictionaryValue* manifest,
[email protected]c6d474f82009-12-16 21:11:061174 const std::string& id,
1175 const FilePath& path,
[email protected]3bb84992010-08-26 17:23:461176 Extension::Location location);
1177 ~ExtensionInfo();
[email protected]c6d474f82009-12-16 21:11:061178
[email protected]f3a1c642011-07-12 19:15:031179 scoped_ptr<base::DictionaryValue> extension_manifest;
[email protected]c6d474f82009-12-16 21:11:061180 std::string extension_id;
1181 FilePath extension_path;
1182 Extension::Location extension_location;
1183
1184 private:
1185 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo);
1186};
1187
[email protected]a9f39a312010-12-23 22:14:271188struct UnloadedExtensionInfo {
[email protected]814a7bf0f2011-08-13 05:30:591189 extension_misc::UnloadedExtensionReason reason;
[email protected]a9f39a312010-12-23 22:14:271190
1191 // Was the extension already disabled?
1192 bool already_disabled;
1193
1194 // The extension being unloaded - this should always be non-NULL.
1195 const Extension* extension;
1196
[email protected]814a7bf0f2011-08-13 05:30:591197 UnloadedExtensionInfo(
1198 const Extension* extension,
1199 extension_misc::UnloadedExtensionReason reason);
[email protected]a9f39a312010-12-23 22:14:271200};
1201
[email protected]902fd7b2011-07-27 18:42:311202// The details sent for EXTENSION_PERMISSIONS_UPDATED notifications.
1203struct UpdatedExtensionPermissionsInfo {
1204 enum Reason {
[email protected]f5532472012-02-23 13:00:551205 ADDED, // The permissions were added to the extension.
1206 REMOVED, // The permissions were removed from the extension.
[email protected]902fd7b2011-07-27 18:42:311207 };
1208
1209 Reason reason;
1210
1211 // The extension who's permissions have changed.
1212 const Extension* extension;
1213
1214 // The permissions that have changed. For Reason::ADDED, this would contain
1215 // only the permissions that have added, and for Reason::REMOVED, this would
1216 // only contain the removed permissions.
[email protected]c2e66e12012-06-27 06:27:061217 const PermissionSet* permissions;
[email protected]902fd7b2011-07-27 18:42:311218
1219 UpdatedExtensionPermissionsInfo(
1220 const Extension* extension,
[email protected]c2e66e12012-06-27 06:27:061221 const PermissionSet* permissions,
[email protected]902fd7b2011-07-27 18:42:311222 Reason reason);
1223};
1224
[email protected]488e6502012-09-07 14:17:341225} // namespace extensions
[email protected]1c321ee2012-05-21 03:02:341226
[email protected]5b1a0e22009-05-26 19:00:581227#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_