| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "chrome/common/extensions/extension_icon_set.h" | 20 #include "chrome/common/extensions/extension_icon_set.h" |
| 21 #include "chrome/common/extensions/extension_permission_set.h" |
| 21 #include "chrome/common/extensions/user_script.h" | 22 #include "chrome/common/extensions/user_script.h" |
| 22 #include "chrome/common/extensions/url_pattern.h" | 23 #include "chrome/common/extensions/url_pattern.h" |
| 23 #include "chrome/common/extensions/url_pattern_set.h" | 24 #include "chrome/common/extensions/url_pattern_set.h" |
| 24 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 25 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
| 26 | 27 |
| 27 class DictionaryValue; | 28 class DictionaryValue; |
| 28 class ExtensionAction; | 29 class ExtensionAction; |
| 29 class ExtensionResource; | 30 class ExtensionResource; |
| 30 class ExtensionSidebarDefaults; | 31 class ExtensionSidebarDefaults; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool shortcut_ctrl; | 136 bool shortcut_ctrl; |
| 136 bool shortcut_shift; | 137 bool shortcut_shift; |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 struct TtsVoice { | 140 struct TtsVoice { |
| 140 std::string voice_name; | 141 std::string voice_name; |
| 141 std::string locale; | 142 std::string locale; |
| 142 std::string gender; | 143 std::string gender; |
| 143 }; | 144 }; |
| 144 | 145 |
| 145 // When prompting the user to install or approve permissions, we display | |
| 146 // messages describing the effects of the permissions and not the permissions | |
| 147 // themselves. Each PermissionMessage represents one of the messages that is | |
| 148 // shown to the user. | |
| 149 class PermissionMessage { | |
| 150 public: | |
| 151 // Do not reorder or add new enumerations in this list. If you need to add a | |
| 152 // new enum, add it just prior to ID_ENUM_BOUNDARY and enter its l10n | |
| 153 // message in kMessageIds. | |
| 154 enum MessageId { | |
| 155 ID_UNKNOWN, | |
| 156 ID_NONE, | |
| 157 ID_BOOKMARKS, | |
| 158 ID_GEOLOCATION, | |
| 159 ID_BROWSING_HISTORY, | |
| 160 ID_TABS, | |
| 161 ID_MANAGEMENT, | |
| 162 ID_DEBUGGER, | |
| 163 ID_HOSTS_1, | |
| 164 ID_HOSTS_2, | |
| 165 ID_HOSTS_3, | |
| 166 ID_HOSTS_4_OR_MORE, | |
| 167 ID_HOSTS_ALL, | |
| 168 ID_FULL_ACCESS, | |
| 169 ID_CLIPBOARD, | |
| 170 ID_ENUM_BOUNDARY | |
| 171 }; | |
| 172 | |
| 173 // Creates a permission message with the given |message_id| and initializes | |
| 174 // its message to the appropriate value. | |
| 175 static PermissionMessage CreateFromMessageId(MessageId message_id); | |
| 176 | |
| 177 // Creates the corresponding permission message for a list of hosts. This | |
| 178 // method exists because the hosts are presented as one message that depends | |
| 179 // on what and how many hosts there are. | |
| 180 static PermissionMessage CreateFromHostList( | |
| 181 const std::vector<std::string>& hosts); | |
| 182 | |
| 183 // Gets the id of the permission message, which can be used in UMA | |
| 184 // histograms. | |
| 185 MessageId message_id() const { return message_id_; } | |
| 186 | |
| 187 // Gets a localized message describing this permission. Please note that | |
| 188 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. | |
| 189 const string16& message() const { return message_; } | |
| 190 | |
| 191 // Comparator to work with std::set. | |
| 192 bool operator<(const PermissionMessage& that) const { | |
| 193 return message_id_ < that.message_id_; | |
| 194 } | |
| 195 | |
| 196 private: | |
| 197 PermissionMessage(MessageId message_id, string16 message_); | |
| 198 | |
| 199 // The index of the id in the array is its enum value. The first two values | |
| 200 // are non-existent message ids to act as placeholders for "unknown" and | |
| 201 // "none". | |
| 202 // Note: Do not change the order of the items in this list since they | |
| 203 // are used in a histogram. The order must match the MessageId order. | |
| 204 static const int kMessageIds[]; | |
| 205 | |
| 206 MessageId message_id_; | |
| 207 string16 message_; | |
| 208 }; | |
| 209 | |
| 210 typedef std::vector<PermissionMessage> PermissionMessages; | |
| 211 | |
| 212 // A permission is defined by its |name| (what is used in the manifest), | |
| 213 // and the |message_id| that's used by install/update UI. | |
| 214 struct Permission { | |
| 215 const char* const name; | |
| 216 const PermissionMessage::MessageId message_id; | |
| 217 }; | |
| 218 | |
| 219 enum InitFromValueFlags { | 146 enum InitFromValueFlags { |
| 220 NO_FLAGS = 0, | 147 NO_FLAGS = 0, |
| 221 | 148 |
| 222 // Usually, the id of an extension is generated by the "key" property of | 149 // Usually, the id of an extension is generated by the "key" property of |
| 223 // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be | 150 // its manifest, but if |REQUIRE_KEY| is not set, a temporary ID will be |
| 224 // generated based on the path. | 151 // generated based on the path. |
| 225 REQUIRE_KEY = 1 << 0, | 152 REQUIRE_KEY = 1 << 0, |
| 226 | 153 |
| 227 // |STRICT_ERROR_CHECKS| enables extra error checking, such as | 154 // |STRICT_ERROR_CHECKS| enables extra error checking, such as |
| 228 // checks that URL patterns do not contain ports. This error | 155 // checks that URL patterns do not contain ports. This error |
| (...skipping 20 matching lines...) Expand all Loading... |
| 249 std::string* error); | 176 std::string* error); |
| 250 | 177 |
| 251 // Return the update url used by gallery/webstore extensions. | 178 // Return the update url used by gallery/webstore extensions. |
| 252 static GURL GalleryUpdateUrl(bool secure); | 179 static GURL GalleryUpdateUrl(bool secure); |
| 253 | 180 |
| 254 // Given two install sources, return the one which should take priority | 181 // Given two install sources, return the one which should take priority |
| 255 // over the other. If an extension is installed from two sources A and B, | 182 // over the other. If an extension is installed from two sources A and B, |
| 256 // its install source should be set to GetHigherPriorityLocation(A, B). | 183 // its install source should be set to GetHigherPriorityLocation(A, B). |
| 257 static Location GetHigherPriorityLocation(Location loc1, Location loc2); | 184 static Location GetHigherPriorityLocation(Location loc1, Location loc2); |
| 258 | 185 |
| 259 // Get's the install message id for |permission|. Returns | |
| 260 // MessageId::TYPE_NONE if none exists. | |
| 261 static PermissionMessage::MessageId GetPermissionMessageId( | |
| 262 const std::string& permission); | |
| 263 | |
| 264 // Returns the full list of permission messages that this extension | 186 // Returns the full list of permission messages that this extension |
| 265 // should display at install time. | 187 // should display at install time. |
| 266 PermissionMessages GetPermissionMessages() const; | 188 ExtensionPermissionMessages GetPermissionMessages() const; |
| 267 | 189 |
| 268 // Returns the full list of permission messages that this extension | 190 // Returns the full list of permission messages that this extension |
| 269 // should display at install time. The messages are returned as strings | 191 // should display at install time. The messages are returned as strings |
| 270 // for convenience. | 192 // for convenience. |
| 271 std::vector<string16> GetPermissionMessageStrings() const; | 193 std::vector<string16> GetPermissionMessageStrings() const; |
| 272 | 194 |
| 273 // Returns the distinct hosts that should be displayed in the install UI | |
| 274 // for the URL patterns |list|. This discards some of the detail that is | |
| 275 // present in the manifest to make it as easy as possible to process by | |
| 276 // users. In particular we disregard the scheme and path components of | |
| 277 // URLPatterns and de-dupe the result, which includes filtering out common | |
| 278 // hosts with differing RCDs (aka Registry Controlled Domains, most of which | |
| 279 // are Top Level Domains but also include exceptions like co.uk). | |
| 280 // NOTE: when de-duping hosts the preferred RCD will be returned, given this | |
| 281 // order of preference: .com, .net, .org, first in list. | |
| 282 static std::vector<std::string> GetDistinctHostsForDisplay( | |
| 283 const URLPatternList& list); | |
| 284 | |
| 285 // Compares two URLPatternLists for security equality by returning whether | |
| 286 // the URL patterns in |new_list| contain additional distinct hosts compared | |
| 287 // to |old_list|. | |
| 288 static bool IsElevatedHostList( | |
| 289 const URLPatternList& old_list, const URLPatternList& new_list); | |
| 290 | |
| 291 // Icon sizes used by the extension system. | 195 // Icon sizes used by the extension system. |
| 292 static const int kIconSizes[]; | 196 static const int kIconSizes[]; |
| 293 | 197 |
| 294 // Max size (both dimensions) for browser and page actions. | 198 // Max size (both dimensions) for browser and page actions. |
| 295 static const int kPageActionIconMaxSize; | 199 static const int kPageActionIconMaxSize; |
| 296 static const int kBrowserActionIconMaxSize; | 200 static const int kBrowserActionIconMaxSize; |
| 297 static const int kSidebarIconMaxSize; | 201 static const int kSidebarIconMaxSize; |
| 298 | 202 |
| 299 // Each permission is a module that the extension is permitted to use. | |
| 300 // | |
| 301 // NOTE: To add a new permission, define it here, and add an entry to | |
| 302 // Extension::kPermissions. | |
| 303 static const char kBackgroundPermission[]; | |
| 304 static const char kBookmarkPermission[]; | |
| 305 static const char kClipboardReadPermission[]; | |
| 306 static const char kClipboardWritePermission[]; | |
| 307 static const char kContentSettingsPermission[]; | |
| 308 static const char kContextMenusPermission[]; | |
| 309 static const char kCookiePermission[]; | |
| 310 static const char kChromePrivatePermission[]; | |
| 311 static const char kChromeosInfoPrivatePermission[]; | |
| 312 static const char kDebuggerPermission[]; | |
| 313 static const char kExperimentalPermission[]; | |
| 314 static const char kFileBrowserHandlerPermission[]; | |
| 315 static const char kFileBrowserPrivatePermission[]; | |
| 316 static const char kGeolocationPermission[]; | |
| 317 static const char kHistoryPermission[]; | |
| 318 static const char kIdlePermission[]; | |
| 319 static const char kManagementPermission[]; | |
| 320 static const char kMediaPlayerPrivatePermission[]; | |
| 321 static const char kNotificationPermission[]; | |
| 322 static const char kProxyPermission[]; | |
| 323 static const char kTabPermission[]; | |
| 324 static const char kUnlimitedStoragePermission[]; | |
| 325 static const char kWebstorePrivatePermission[]; | |
| 326 static const char kWebSocketProxyPrivatePermission[]; | |
| 327 | |
| 328 static const Permission kPermissions[]; | |
| 329 static const size_t kNumPermissions; | |
| 330 static const char* const kHostedAppPermissionNames[]; | |
| 331 static const size_t kNumHostedAppPermissions; | |
| 332 static const char* const kComponentPrivatePermissionNames[]; | |
| 333 static const size_t kNumComponentPrivatePermissions; | |
| 334 | |
| 335 // The old name for the unlimited storage permission, which is deprecated but | |
| 336 // still accepted as meaning the same thing as kUnlimitedStoragePermission. | |
| 337 static const char kOldUnlimitedStoragePermission[]; | |
| 338 | |
| 339 // Valid schemes for web extent URLPatterns. | 203 // Valid schemes for web extent URLPatterns. |
| 340 static const int kValidWebExtentSchemes; | 204 static const int kValidWebExtentSchemes; |
| 341 | 205 |
| 342 // Valid schemes for host permission URLPatterns. | 206 // Valid schemes for host permission URLPatterns. |
| 343 static const int kValidHostPermissionSchemes; | 207 static const int kValidHostPermissionSchemes; |
| 344 | 208 |
| 345 // Returns true if the string is one of the known hosted app permissions (see | |
| 346 // kHostedAppPermissionNames). | |
| 347 static bool IsHostedAppPermission(const std::string& permission); | |
| 348 | |
| 349 // The name of the manifest inside an extension. | 209 // The name of the manifest inside an extension. |
| 350 static const FilePath::CharType kManifestFilename[]; | 210 static const FilePath::CharType kManifestFilename[]; |
| 351 | 211 |
| 352 // The name of locale folder inside an extension. | 212 // The name of locale folder inside an extension. |
| 353 static const FilePath::CharType kLocaleFolder[]; | 213 static const FilePath::CharType kLocaleFolder[]; |
| 354 | 214 |
| 355 // The name of the messages file inside an extension. | 215 // The name of the messages file inside an extension. |
| 356 static const FilePath::CharType kMessagesFilename[]; | 216 static const FilePath::CharType kMessagesFilename[]; |
| 357 | 217 |
| 358 #if defined(OS_WIN) | 218 #if defined(OS_WIN) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // Generates an extension ID from arbitrary input. The same input string will | 308 // Generates an extension ID from arbitrary input. The same input string will |
| 449 // always generate the same output ID. | 309 // always generate the same output ID. |
| 450 static bool GenerateId(const std::string& input, std::string* output); | 310 static bool GenerateId(const std::string& input, std::string* output); |
| 451 | 311 |
| 452 // Expects base64 encoded |input| and formats into |output| including | 312 // Expects base64 encoded |input| and formats into |output| including |
| 453 // the appropriate header & footer. | 313 // the appropriate header & footer. |
| 454 static bool FormatPEMForFileOutput(const std::string& input, | 314 static bool FormatPEMForFileOutput(const std::string& input, |
| 455 std::string* output, | 315 std::string* output, |
| 456 bool is_public); | 316 bool is_public); |
| 457 | 317 |
| 458 // Determine whether |new_extension| has increased privileges compared to | |
| 459 // its previously granted permissions, specified by |granted_apis|, | |
| 460 // |granted_extent| and |granted_full_access|. | |
| 461 static bool IsPrivilegeIncrease(const bool granted_full_access, | |
| 462 const std::set<std::string>& granted_apis, | |
| 463 const URLPatternSet& granted_extent, | |
| 464 const Extension* new_extension); | |
| 465 | |
| 466 // Given an extension and icon size, read it if present and decode it into | 318 // Given an extension and icon size, read it if present and decode it into |
| 467 // result. In the browser process, this will DCHECK if not called on the | 319 // result. In the browser process, this will DCHECK if not called on the |
| 468 // file thread. To easily load extension images on the UI thread, see | 320 // file thread. To easily load extension images on the UI thread, see |
| 469 // ImageLoadingTracker. | 321 // ImageLoadingTracker. |
| 470 static void DecodeIcon(const Extension* extension, | 322 static void DecodeIcon(const Extension* extension, |
| 471 Icons icon_size, | 323 Icons icon_size, |
| 472 scoped_ptr<SkBitmap>* result); | 324 scoped_ptr<SkBitmap>* result); |
| 473 | 325 |
| 474 // Given an icon_path and icon size, read it if present and decode it into | 326 // Given an icon_path and icon size, read it if present and decode it into |
| 475 // result. In the browser process, this will DCHECK if not called on the | 327 // result. In the browser process, this will DCHECK if not called on the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 490 // --apps-gallery-url switch. The URL returned will not contain a trailing | 342 // --apps-gallery-url switch. The URL returned will not contain a trailing |
| 491 // slash. Do not use this as a prefix/extent for the store. Instead see | 343 // slash. Do not use this as a prefix/extent for the store. Instead see |
| 492 // ExtensionService::GetWebStoreApp or | 344 // ExtensionService::GetWebStoreApp or |
| 493 // ExtensionService::IsDownloadFromGallery | 345 // ExtensionService::IsDownloadFromGallery |
| 494 static std::string ChromeStoreLaunchURL(); | 346 static std::string ChromeStoreLaunchURL(); |
| 495 | 347 |
| 496 // Adds an extension to the scripting whitelist. Used for testing only. | 348 // Adds an extension to the scripting whitelist. Used for testing only. |
| 497 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist); | 349 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist); |
| 498 static const ScriptingWhitelist* GetScriptingWhitelist(); | 350 static const ScriptingWhitelist* GetScriptingWhitelist(); |
| 499 | 351 |
| 500 // Returns true if the extension has the specified API permission. | 352 bool HasAPIPermission(ExtensionAPIPermission::ID permission) const; |
| 501 static bool HasApiPermission(const std::set<std::string>& api_permissions, | 353 bool HasAPIPermission(const std::string& function_name) const; |
| 502 const std::string& function_name); | |
| 503 | 354 |
| 504 // Whether the |effective_host_permissions| and |api_permissions| include | 355 const URLPatternSet& GetEffectiveHostPermissions() const; |
| 505 // effective access to all hosts. See the non-static version of the method | |
| 506 // for more details. | |
| 507 static bool HasEffectiveAccessToAllHosts( | |
| 508 const URLPatternSet& effective_host_permissions, | |
| 509 const std::set<std::string>& api_permissions); | |
| 510 | |
| 511 bool HasApiPermission(const std::string& function_name) const { | |
| 512 return HasApiPermission(this->api_permissions(), function_name); | |
| 513 } | |
| 514 | |
| 515 const URLPatternSet& GetEffectiveHostPermissions() const { | |
| 516 return effective_host_permissions_; | |
| 517 } | |
| 518 | 356 |
| 519 // Whether or not the extension is allowed permission for a URL pattern from | 357 // Whether or not the extension is allowed permission for a URL pattern from |
| 520 // the manifest. http, https, and chrome://favicon/ is allowed for all | 358 // the manifest. http, https, and chrome://favicon/ is allowed for all |
| 521 // extensions, while component extensions are allowed access to | 359 // extensions, while component extensions are allowed access to |
| 522 // chrome://resources. | 360 // chrome://resources. |
| 523 bool CanSpecifyHostPermission(const URLPattern& pattern) const; | 361 bool CanSpecifyHostPermission(const URLPattern& pattern) const; |
| 524 | 362 |
| 525 // Whether the extension has access to the given URL. | 363 // Whether the extension has access to the given URL. |
| 526 bool HasHostPermission(const GURL& url) const; | 364 bool HasHostPermission(const GURL& url) const; |
| 527 | 365 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 const std::vector<NaClModuleInfo>& nacl_modules() const { | 461 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 624 return nacl_modules_; | 462 return nacl_modules_; |
| 625 } | 463 } |
| 626 const std::vector<InputComponentInfo>& input_components() const { | 464 const std::vector<InputComponentInfo>& input_components() const { |
| 627 return input_components_; | 465 return input_components_; |
| 628 } | 466 } |
| 629 const GURL& background_url() const { return background_url_; } | 467 const GURL& background_url() const { return background_url_; } |
| 630 const GURL& options_url() const { return options_url_; } | 468 const GURL& options_url() const { return options_url_; } |
| 631 const GURL& devtools_url() const { return devtools_url_; } | 469 const GURL& devtools_url() const { return devtools_url_; } |
| 632 const std::vector<GURL>& toolstrips() const { return toolstrips_; } | 470 const std::vector<GURL>& toolstrips() const { return toolstrips_; } |
| 633 const std::set<std::string>& api_permissions() const { | 471 const ExtensionPermissionSet* permission_set() const { |
| 634 return api_permissions_; | 472 return permission_set_.get(); |
| 635 } | 473 } |
| 636 const URLPatternList& host_permissions() const { return host_permissions_; } | |
| 637 const GURL& update_url() const { return update_url_; } | 474 const GURL& update_url() const { return update_url_; } |
| 638 const ExtensionIconSet& icons() const { return icons_; } | 475 const ExtensionIconSet& icons() const { return icons_; } |
| 639 const DictionaryValue* manifest_value() const { | 476 const DictionaryValue* manifest_value() const { |
| 640 return manifest_value_.get(); | 477 return manifest_value_.get(); |
| 641 } | 478 } |
| 642 const std::string default_locale() const { return default_locale_; } | 479 const std::string default_locale() const { return default_locale_; } |
| 643 const URLOverrideMap& GetChromeURLOverrides() const { | 480 const URLOverrideMap& GetChromeURLOverrides() const { |
| 644 return chrome_url_overrides_; | 481 return chrome_url_overrides_; |
| 645 } | 482 } |
| 646 const std::string omnibox_keyword() const { return omnibox_keyword_; } | 483 const std::string omnibox_keyword() const { return omnibox_keyword_; } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 const ListValue* extension_actions, std::string* error); | 596 const ListValue* extension_actions, std::string* error); |
| 760 // Helper method to load an FileBrowserHandler from manifest. | 597 // Helper method to load an FileBrowserHandler from manifest. |
| 761 FileBrowserHandler* LoadFileBrowserHandler( | 598 FileBrowserHandler* LoadFileBrowserHandler( |
| 762 const DictionaryValue* file_browser_handlers, std::string* error); | 599 const DictionaryValue* file_browser_handlers, std::string* error); |
| 763 | 600 |
| 764 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest | 601 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest |
| 765 // entry. | 602 // entry. |
| 766 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( | 603 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( |
| 767 const DictionaryValue* sidebar, std::string* error); | 604 const DictionaryValue* sidebar, std::string* error); |
| 768 | 605 |
| 769 // Calculates the effective host permissions from the permissions and content | |
| 770 // script petterns. | |
| 771 void InitEffectiveHostPermissions(); | |
| 772 | |
| 773 // Returns true if the extension has more than one "UI surface". For example, | 606 // Returns true if the extension has more than one "UI surface". For example, |
| 774 // an extension that has a browser action and a page action. | 607 // an extension that has a browser action and a page action. |
| 775 bool HasMultipleUISurfaces() const; | 608 bool HasMultipleUISurfaces() const; |
| 776 | 609 |
| 777 // Figures out if a source contains keys not associated with themes - we | 610 // Figures out if a source contains keys not associated with themes - we |
| 778 // don't want to allow scripts and such to be bundled with themes. | 611 // don't want to allow scripts and such to be bundled with themes. |
| 779 bool ContainsNonThemeKeys(const DictionaryValue& source) const; | 612 bool ContainsNonThemeKeys(const DictionaryValue& source) const; |
| 780 | 613 |
| 781 // Only allow the experimental API permission if the command line | 614 // Only allow the experimental API permission if the command line |
| 782 // flag is present. | 615 // flag is present. |
| 783 bool IsDisallowedExperimentalPermission(const std::string& permission) const; | 616 bool IsDisallowedExperimentalPermission( |
| 784 | 617 ExtensionAPIPermission::ID permission) const; |
| 785 // Returns true if the string is one of the known api permissions (see | |
| 786 // kPermissions). | |
| 787 bool IsAPIPermission(const std::string& permission) const; | |
| 788 | 618 |
| 789 // Returns true if this is a component, or we are not attempting to access a | 619 // Returns true if this is a component, or we are not attempting to access a |
| 790 // component-private permission. | 620 // component-private permission. |
| 791 bool IsComponentOnlyPermission(const std::string& permission) const; | 621 bool IsComponentOnlyPermission(const ExtensionAPIPermission* api) const; |
| 792 | |
| 793 // The set of unique API install messages that the extension has. | |
| 794 // NOTE: This only includes messages related to permissions declared in the | |
| 795 // "permissions" key in the manifest. Permissions implied from other features | |
| 796 // of the manifest, like plugins and content scripts are not included. | |
| 797 std::set<PermissionMessage> GetSimplePermissionMessages() const; | |
| 798 | 622 |
| 799 // Cached images for this extension. This should only be touched on the UI | 623 // Cached images for this extension. This should only be touched on the UI |
| 800 // thread. | 624 // thread. |
| 801 mutable ImageCache image_cache_; | 625 mutable ImageCache image_cache_; |
| 802 | 626 |
| 803 // A persistent, globally unique ID. An extension's ID is used in things | 627 // A persistent, globally unique ID. An extension's ID is used in things |
| 804 // like directory structures and URLs, and is expected to not change across | 628 // like directory structures and URLs, and is expected to not change across |
| 805 // versions. It is generated as a SHA-256 hash of the extension's public | 629 // versions. It is generated as a SHA-256 hash of the extension's public |
| 806 // key, or as a hash of the path in the case of unpacked extensions. | 630 // key, or as a hash of the path in the case of unpacked extensions. |
| 807 std::string id_; | 631 std::string id_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 818 // Default locale for fall back. Can be empty if extension is not localized. | 642 // Default locale for fall back. Can be empty if extension is not localized. |
| 819 std::string default_locale_; | 643 std::string default_locale_; |
| 820 | 644 |
| 821 // If true, a separate process will be used for the extension in incognito | 645 // If true, a separate process will be used for the extension in incognito |
| 822 // mode. | 646 // mode. |
| 823 bool incognito_split_mode_; | 647 bool incognito_split_mode_; |
| 824 | 648 |
| 825 // Defines the set of URLs in the extension's web content. | 649 // Defines the set of URLs in the extension's web content. |
| 826 URLPatternSet extent_; | 650 URLPatternSet extent_; |
| 827 | 651 |
| 828 // The set of host permissions that the extension effectively has access to, | 652 // The set of permissions that the extension effectively has access to. |
| 829 // which is a merge of host_permissions_ and all of the match patterns in | 653 scoped_ptr<ExtensionPermissionSet> permission_set_; |
| 830 // any content scripts the extension has. This is used to determine which | |
| 831 // URLs have the ability to load an extension's resources via embedded | |
| 832 // chrome-extension: URLs (see extension_protocols.cc). | |
| 833 URLPatternSet effective_host_permissions_; | |
| 834 | |
| 835 // The set of module-level APIs this extension can use. | |
| 836 std::set<std::string> api_permissions_; | |
| 837 | 654 |
| 838 // The icons for the extension. | 655 // The icons for the extension. |
| 839 ExtensionIconSet icons_; | 656 ExtensionIconSet icons_; |
| 840 | 657 |
| 841 // The base extension url for the extension. | 658 // The base extension url for the extension. |
| 842 GURL extension_url_; | 659 GURL extension_url_; |
| 843 | 660 |
| 844 // The location the extension was loaded from. | 661 // The location the extension was loaded from. |
| 845 Location location_; | 662 Location location_; |
| 846 | 663 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 | 719 |
| 903 // A map of color names to colors. | 720 // A map of color names to colors. |
| 904 scoped_ptr<DictionaryValue> theme_tints_; | 721 scoped_ptr<DictionaryValue> theme_tints_; |
| 905 | 722 |
| 906 // A map of display properties. | 723 // A map of display properties. |
| 907 scoped_ptr<DictionaryValue> theme_display_properties_; | 724 scoped_ptr<DictionaryValue> theme_display_properties_; |
| 908 | 725 |
| 909 // Whether the extension is a theme. | 726 // Whether the extension is a theme. |
| 910 bool is_theme_; | 727 bool is_theme_; |
| 911 | 728 |
| 912 // The sites this extension has permission to talk to (using XHR, etc). | |
| 913 URLPatternList host_permissions_; | |
| 914 | |
| 915 // The homepage for this extension. Useful if it is not hosted by Google and | 729 // The homepage for this extension. Useful if it is not hosted by Google and |
| 916 // therefore does not have a Gallery URL. | 730 // therefore does not have a Gallery URL. |
| 917 GURL homepage_url_; | 731 GURL homepage_url_; |
| 918 | 732 |
| 919 // URL for fetching an update manifest | 733 // URL for fetching an update manifest |
| 920 GURL update_url_; | 734 GURL update_url_; |
| 921 | 735 |
| 922 // A copy of the manifest that this extension was created from. | 736 // A copy of the manifest that this extension was created from. |
| 923 scoped_ptr<DictionaryValue> manifest_value_; | 737 scoped_ptr<DictionaryValue> manifest_value_; |
| 924 | 738 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 // Was the extension already disabled? | 837 // Was the extension already disabled? |
| 1024 bool already_disabled; | 838 bool already_disabled; |
| 1025 | 839 |
| 1026 // The extension being unloaded - this should always be non-NULL. | 840 // The extension being unloaded - this should always be non-NULL. |
| 1027 const Extension* extension; | 841 const Extension* extension; |
| 1028 | 842 |
| 1029 UnloadedExtensionInfo(const Extension* extension, Reason reason); | 843 UnloadedExtensionInfo(const Extension* extension, Reason reason); |
| 1030 }; | 844 }; |
| 1031 | 845 |
| 1032 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 846 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |