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

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

Issue 9150008: Introduce background.scripts feature for extension manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 const FileBrowserHandlerList* file_browser_handlers() const { 524 const FileBrowserHandlerList* file_browser_handlers() const {
525 return file_browser_handlers_.get(); 525 return file_browser_handlers_.get();
526 } 526 }
527 const std::vector<PluginInfo>& plugins() const { return plugins_; } 527 const std::vector<PluginInfo>& plugins() const { return plugins_; }
528 const std::vector<NaClModuleInfo>& nacl_modules() const { 528 const std::vector<NaClModuleInfo>& nacl_modules() const {
529 return nacl_modules_; 529 return nacl_modules_;
530 } 530 }
531 const std::vector<InputComponentInfo>& input_components() const { 531 const std::vector<InputComponentInfo>& input_components() const {
532 return input_components_; 532 return input_components_;
533 } 533 }
534 const GURL& background_url() const { return background_url_; } 534 bool has_background_page() const {
535 return background_url_.is_valid() || !background_scripts_.empty();
536 }
537 const std::vector<std::string>& background_scripts() const {
538 return background_scripts_;
539 }
535 const GURL& options_url() const { return options_url_; } 540 const GURL& options_url() const { return options_url_; }
536 const GURL& devtools_url() const { return devtools_url_; } 541 const GURL& devtools_url() const { return devtools_url_; }
537 const ExtensionPermissionSet* optional_permission_set() const { 542 const ExtensionPermissionSet* optional_permission_set() const {
538 return optional_permission_set_.get(); 543 return optional_permission_set_.get();
539 } 544 }
540 const ExtensionPermissionSet* required_permission_set() const { 545 const ExtensionPermissionSet* required_permission_set() const {
541 return required_permission_set_.get(); 546 return required_permission_set_.get();
542 } 547 }
543 const GURL& update_url() const { return update_url_; } 548 const GURL& update_url() const { return update_url_; }
544 const ExtensionIconSet& icons() const { return icons_; } 549 const ExtensionIconSet& icons() const { return icons_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 591
587 // Theme-related. 592 // Theme-related.
588 bool is_theme() const { return manifest()->IsTheme(); } 593 bool is_theme() const { return manifest()->IsTheme(); }
589 base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); } 594 base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); }
590 base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); } 595 base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); }
591 base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); } 596 base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); }
592 base::DictionaryValue* GetThemeDisplayProperties() const { 597 base::DictionaryValue* GetThemeDisplayProperties() const {
593 return theme_display_properties_.get(); 598 return theme_display_properties_.get();
594 } 599 }
595 600
601 GURL GetBackgroundURL() const;
602
596 private: 603 private:
597 friend class base::RefCountedThreadSafe<Extension>; 604 friend class base::RefCountedThreadSafe<Extension>;
598 605
599 // We keep a cache of images loaded from extension resources based on their 606 // We keep a cache of images loaded from extension resources based on their
600 // path and a string representation of a size that may have been used to 607 // path and a string representation of a size that may have been used to
601 // scale it (or the empty string if the image is at its original size). 608 // scale it (or the empty string if the image is at its original size).
602 typedef std::pair<FilePath, std::string> ImageCacheKey; 609 typedef std::pair<FilePath, std::string> ImageCacheKey;
603 typedef std::map<ImageCacheKey, SkBitmap> ImageCache; 610 typedef std::map<ImageCacheKey, SkBitmap> ImageCache;
604 611
605 class RuntimeData { 612 class RuntimeData {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 const char* value_error, 669 const char* value_error,
663 string16* error); 670 string16* error);
664 bool LoadLaunchContainer(const extensions::Manifest* manifest, 671 bool LoadLaunchContainer(const extensions::Manifest* manifest,
665 string16* error); 672 string16* error);
666 bool LoadLaunchURL(const extensions::Manifest* manifest, 673 bool LoadLaunchURL(const extensions::Manifest* manifest,
667 string16* error); 674 string16* error);
668 bool LoadAppIsolation(const extensions::Manifest* manifest, 675 bool LoadAppIsolation(const extensions::Manifest* manifest,
669 string16* error); 676 string16* error);
670 bool LoadWebIntentServices(const extensions::Manifest* manifest, 677 bool LoadWebIntentServices(const extensions::Manifest* manifest,
671 string16* error); 678 string16* error);
679 bool LoadBackgroundScripts(const extensions::Manifest* manifest,
680 string16* error);
672 bool LoadBackgroundPage(const extensions::Manifest* manifest, 681 bool LoadBackgroundPage(const extensions::Manifest* manifest,
673 const ExtensionAPIPermissionSet& api_permissions, 682 const ExtensionAPIPermissionSet& api_permissions,
674 string16* error); 683 string16* error);
675 684
676 // Helper method to load an ExtensionAction from the page_action or 685 // Helper method to load an ExtensionAction from the page_action or
677 // browser_action entries in the manifest. 686 // browser_action entries in the manifest.
678 ExtensionAction* LoadExtensionActionHelper( 687 ExtensionAction* LoadExtensionActionHelper(
679 const base::DictionaryValue* extension_action, string16* error); 688 const base::DictionaryValue* extension_action, string16* error);
680 689
681 // Helper method to load an FileBrowserHandlerList from the manifest. 690 // Helper method to load an FileBrowserHandlerList from the manifest.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // Optional list of input components and associated properties. 811 // Optional list of input components and associated properties.
803 std::vector<InputComponentInfo> input_components_; 812 std::vector<InputComponentInfo> input_components_;
804 813
805 // Optional list of web accessible extension resources. 814 // Optional list of web accessible extension resources.
806 base::hash_set<std::string> web_accessible_resources_; 815 base::hash_set<std::string> web_accessible_resources_;
807 816
808 // Optional URL to a master page of which a single instance should be always 817 // Optional URL to a master page of which a single instance should be always
809 // loaded in the background. 818 // loaded in the background.
810 GURL background_url_; 819 GURL background_url_;
811 820
821 // Optional list of scripts to use to generate a background page. If this is
822 // present, background_url_ will be empty and generated by GetBackgroundURL().
823 std::vector<std::string> background_scripts_;
824
812 // Optional URL to a page for setting options/preferences. 825 // Optional URL to a page for setting options/preferences.
813 GURL options_url_; 826 GURL options_url_;
814 827
815 // Optional URL to a devtools extension page. 828 // Optional URL to a devtools extension page.
816 GURL devtools_url_; 829 GURL devtools_url_;
817 830
818 // The public key used to sign the contents of the crx package. 831 // The public key used to sign the contents of the crx package.
819 std::string public_key_; 832 std::string public_key_;
820 833
821 // A map of resource id's to relative file paths. 834 // A map of resource id's to relative file paths.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 // only contain the removed permissions. 960 // only contain the removed permissions.
948 const ExtensionPermissionSet* permissions; 961 const ExtensionPermissionSet* permissions;
949 962
950 UpdatedExtensionPermissionsInfo( 963 UpdatedExtensionPermissionsInfo(
951 const Extension* extension, 964 const Extension* extension,
952 const ExtensionPermissionSet* permissions, 965 const ExtensionPermissionSet* permissions,
953 Reason reason); 966 Reason reason);
954 }; 967 };
955 968
956 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 969 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698