| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 std::vector<string16> GetPermissionMessages(); | 151 std::vector<string16> GetPermissionMessages(); |
| 152 | 152 |
| 153 // Returns the distinct hosts that should be displayed in the install UI. This | 153 // Returns the distinct hosts that should be displayed in the install UI. This |
| 154 // discards some of the detail that is present in the manifest to make it as | 154 // discards some of the detail that is present in the manifest to make it as |
| 155 // easy as possible to process by users. In particular we disregard the scheme | 155 // easy as possible to process by users. In particular we disregard the scheme |
| 156 // and path components of URLPatterns and de-dupe the result. | 156 // and path components of URLPatterns and de-dupe the result. |
| 157 static std::vector<std::string> GetDistinctHosts( | 157 static std::vector<std::string> GetDistinctHosts( |
| 158 const URLPatternList& host_patterns); | 158 const URLPatternList& host_patterns); |
| 159 std::vector<std::string> GetDistinctHosts(); | 159 std::vector<std::string> GetDistinctHosts(); |
| 160 | 160 |
| 161 bool apps_enabled() const { return apps_enabled_; } | |
| 162 void set_apps_enabled(bool val) { apps_enabled_ = val; } | |
| 163 | |
| 164 // Icon sizes used by the extension system. | 161 // Icon sizes used by the extension system. |
| 165 static const int kIconSizes[]; | 162 static const int kIconSizes[]; |
| 166 | 163 |
| 167 // Max size (both dimensions) for browser and page actions. | 164 // Max size (both dimensions) for browser and page actions. |
| 168 static const int kPageActionIconMaxSize; | 165 static const int kPageActionIconMaxSize; |
| 169 static const int kBrowserActionIconMaxSize; | 166 static const int kBrowserActionIconMaxSize; |
| 170 | 167 |
| 171 // Each permission is a module that the extension is permitted to use. | 168 // Each permission is a module that the extension is permitted to use. |
| 172 // | 169 // |
| 173 // NOTE: To add a new permission, define it here, and add an entry to | 170 // NOTE: To add a new permission, define it here, and add an entry to |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // result. In the browser process, this will DCHECK if not called on the | 291 // result. In the browser process, this will DCHECK if not called on the |
| 295 // file thread. To easily load extension images on the UI thread, see | 292 // file thread. To easily load extension images on the UI thread, see |
| 296 // ImageLoadingTracker. | 293 // ImageLoadingTracker. |
| 297 static void DecodeIconFromPath(const FilePath& icon_path, | 294 static void DecodeIconFromPath(const FilePath& icon_path, |
| 298 Icons icon_size, | 295 Icons icon_size, |
| 299 scoped_ptr<SkBitmap>* result); | 296 scoped_ptr<SkBitmap>* result); |
| 300 | 297 |
| 301 // Returns the base extension url for a given |extension_id|. | 298 // Returns the base extension url for a given |extension_id|. |
| 302 static GURL GetBaseURLFromExtensionId(const std::string& extension_id); | 299 static GURL GetBaseURLFromExtensionId(const std::string& extension_id); |
| 303 | 300 |
| 304 // Returns whether the browser has apps enabled (either as the default or if | 301 // Returns the url prefix for the extension/apps gallery. Can be set via the |
| 305 // it was explicitly turned on via a command line switch). | |
| 306 static bool AppsAreEnabled(); | |
| 307 | |
| 308 // Returns the launch URL for the extension/apps gallery. Can be set via the | |
| 309 // --apps-gallery-url switch. The URL returned will not contain a trailing | 302 // --apps-gallery-url switch. The URL returned will not contain a trailing |
| 310 // slash. Do not use this as a prefix/extent for the store. Instead see | 303 // slash. Do not use this as a prefix/extent for the store. Instead see |
| 311 // ExtensionsService::GetWebStoreApp or | 304 // ExtensionsService::GetWebStoreApp or |
| 312 // ExtensionsService::IsDownloadFromGallery | 305 // ExtensionsService::IsDownloadFromGallery |
| 313 static std::string ChromeStoreLaunchURL(); | 306 static std::string ChromeStoreLaunchURL(); |
| 314 | 307 |
| 315 // Helper function that consolidates the check for whether the script can | 308 // Helper function that consolidates the check for whether the script can |
| 316 // execute into one location. |page_url| is the page that is the candidate | 309 // execute into one location. |page_url| is the page that is the candidate |
| 317 // for running the script, |can_execute_script_everywhere| specifies whether | 310 // for running the script, |can_execute_script_everywhere| specifies whether |
| 318 // the extension is on the whitelist, |allowed_pages| is a vector of | 311 // the extension is on the whitelist, |allowed_pages| is a vector of |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 // URL for fetching an update manifest | 618 // URL for fetching an update manifest |
| 626 GURL update_url_; | 619 GURL update_url_; |
| 627 | 620 |
| 628 // A copy of the manifest that this extension was created from. | 621 // A copy of the manifest that this extension was created from. |
| 629 scoped_ptr<DictionaryValue> manifest_value_; | 622 scoped_ptr<DictionaryValue> manifest_value_; |
| 630 | 623 |
| 631 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs | 624 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs |
| 632 // which override the handling of those URLs. | 625 // which override the handling of those URLs. |
| 633 URLOverrideMap chrome_url_overrides_; | 626 URLOverrideMap chrome_url_overrides_; |
| 634 | 627 |
| 635 // Whether apps-related features can be parsed during InitFromValue(). | |
| 636 // Defaults to the value from --enable-extension-apps. | |
| 637 bool apps_enabled_; | |
| 638 | |
| 639 // Whether this extension uses app features. | 628 // Whether this extension uses app features. |
| 640 bool is_app_; | 629 bool is_app_; |
| 641 | 630 |
| 642 // The local path inside the extension to use with the launcher. | 631 // The local path inside the extension to use with the launcher. |
| 643 std::string launch_local_path_; | 632 std::string launch_local_path_; |
| 644 | 633 |
| 645 // A web url to use with the launcher. Note that this might be relative or | 634 // A web url to use with the launcher. Note that this might be relative or |
| 646 // absolute. If relative, it is relative to web_origin_. | 635 // absolute. If relative, it is relative to web_origin_. |
| 647 std::string launch_web_url_; | 636 std::string launch_web_url_; |
| 648 | 637 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 668 // True while the extension is being upgraded. | 657 // True while the extension is being upgraded. |
| 669 bool being_upgraded_; | 658 bool being_upgraded_; |
| 670 | 659 |
| 671 FRIEND_TEST_ALL_PREFIXES(ExtensionTest, LoadPageActionHelper); | 660 FRIEND_TEST_ALL_PREFIXES(ExtensionTest, LoadPageActionHelper); |
| 672 FRIEND_TEST_ALL_PREFIXES(TabStripModelTest, Apps); | 661 FRIEND_TEST_ALL_PREFIXES(TabStripModelTest, Apps); |
| 673 | 662 |
| 674 DISALLOW_COPY_AND_ASSIGN(Extension); | 663 DISALLOW_COPY_AND_ASSIGN(Extension); |
| 675 }; | 664 }; |
| 676 | 665 |
| 677 typedef std::vector<Extension*> ExtensionList; | 666 typedef std::vector<Extension*> ExtensionList; |
| 667 typedef std::set<std::string> ExtensionIdSet; |
| 678 | 668 |
| 679 // Handy struct to pass core extension info around. | 669 // Handy struct to pass core extension info around. |
| 680 struct ExtensionInfo { | 670 struct ExtensionInfo { |
| 681 ExtensionInfo(const DictionaryValue* manifest, | 671 ExtensionInfo(const DictionaryValue* manifest, |
| 682 const std::string& id, | 672 const std::string& id, |
| 683 const FilePath& path, | 673 const FilePath& path, |
| 684 Extension::Location location); | 674 Extension::Location location); |
| 685 ~ExtensionInfo(); | 675 ~ExtensionInfo(); |
| 686 | 676 |
| 687 scoped_ptr<DictionaryValue> extension_manifest; | 677 scoped_ptr<DictionaryValue> extension_manifest; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 703 std::set<std::string> extension_api_permissions; | 693 std::set<std::string> extension_api_permissions; |
| 704 // TODO(akalin): Once we have a unified ExtensionType, replace the | 694 // TODO(akalin): Once we have a unified ExtensionType, replace the |
| 705 // below member variables with a member of that type. | 695 // below member variables with a member of that type. |
| 706 bool is_theme; | 696 bool is_theme; |
| 707 bool is_app; | 697 bool is_app; |
| 708 bool converted_from_user_script; | 698 bool converted_from_user_script; |
| 709 GURL update_url; | 699 GURL update_url; |
| 710 }; | 700 }; |
| 711 | 701 |
| 712 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 702 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |