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

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: ready to land 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 const FileBrowserHandlerList* file_browser_handlers() const { 519 const FileBrowserHandlerList* file_browser_handlers() const {
520 return file_browser_handlers_.get(); 520 return file_browser_handlers_.get();
521 } 521 }
522 const std::vector<PluginInfo>& plugins() const { return plugins_; } 522 const std::vector<PluginInfo>& plugins() const { return plugins_; }
523 const std::vector<NaClModuleInfo>& nacl_modules() const { 523 const std::vector<NaClModuleInfo>& nacl_modules() const {
524 return nacl_modules_; 524 return nacl_modules_;
525 } 525 }
526 const std::vector<InputComponentInfo>& input_components() const { 526 const std::vector<InputComponentInfo>& input_components() const {
527 return input_components_; 527 return input_components_;
528 } 528 }
529 const GURL& background_url() const { return background_url_; } 529 bool has_background_page() const {
530 return background_url_.is_valid() || !background_scripts_.empty();
531 }
532 const std::vector<std::string>& background_scripts() const {
533 return background_scripts_;
534 }
530 const GURL& options_url() const { return options_url_; } 535 const GURL& options_url() const { return options_url_; }
531 const GURL& devtools_url() const { return devtools_url_; } 536 const GURL& devtools_url() const { return devtools_url_; }
532 const ExtensionPermissionSet* optional_permission_set() const { 537 const ExtensionPermissionSet* optional_permission_set() const {
533 return optional_permission_set_.get(); 538 return optional_permission_set_.get();
534 } 539 }
535 const ExtensionPermissionSet* required_permission_set() const { 540 const ExtensionPermissionSet* required_permission_set() const {
536 return required_permission_set_.get(); 541 return required_permission_set_.get();
537 } 542 }
538 const GURL& update_url() const { return update_url_; } 543 const GURL& update_url() const { return update_url_; }
539 const ExtensionIconSet& icons() const { return icons_; } 544 const ExtensionIconSet& icons() const { return icons_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 586
582 // Theme-related. 587 // Theme-related.
583 bool is_theme() const { return manifest()->IsTheme(); } 588 bool is_theme() const { return manifest()->IsTheme(); }
584 base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); } 589 base::DictionaryValue* GetThemeImages() const { return theme_images_.get(); }
585 base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); } 590 base::DictionaryValue* GetThemeColors() const {return theme_colors_.get(); }
586 base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); } 591 base::DictionaryValue* GetThemeTints() const { return theme_tints_.get(); }
587 base::DictionaryValue* GetThemeDisplayProperties() const { 592 base::DictionaryValue* GetThemeDisplayProperties() const {
588 return theme_display_properties_.get(); 593 return theme_display_properties_.get();
589 } 594 }
590 595
596 GURL GetBackgroundURL() const;
597
591 private: 598 private:
592 friend class base::RefCountedThreadSafe<Extension>; 599 friend class base::RefCountedThreadSafe<Extension>;
593 600
594 // We keep a cache of images loaded from extension resources based on their 601 // We keep a cache of images loaded from extension resources based on their
595 // path and a string representation of a size that may have been used to 602 // path and a string representation of a size that may have been used to
596 // scale it (or the empty string if the image is at its original size). 603 // scale it (or the empty string if the image is at its original size).
597 typedef std::pair<FilePath, std::string> ImageCacheKey; 604 typedef std::pair<FilePath, std::string> ImageCacheKey;
598 typedef std::map<ImageCacheKey, SkBitmap> ImageCache; 605 typedef std::map<ImageCacheKey, SkBitmap> ImageCache;
599 606
600 class RuntimeData { 607 class RuntimeData {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 const char* value_error, 664 const char* value_error,
658 string16* error); 665 string16* error);
659 bool LoadLaunchContainer(const extensions::Manifest* manifest, 666 bool LoadLaunchContainer(const extensions::Manifest* manifest,
660 string16* error); 667 string16* error);
661 bool LoadLaunchURL(const extensions::Manifest* manifest, 668 bool LoadLaunchURL(const extensions::Manifest* manifest,
662 string16* error); 669 string16* error);
663 bool LoadAppIsolation(const extensions::Manifest* manifest, 670 bool LoadAppIsolation(const extensions::Manifest* manifest,
664 string16* error); 671 string16* error);
665 bool LoadWebIntentServices(const extensions::Manifest* manifest, 672 bool LoadWebIntentServices(const extensions::Manifest* manifest,
666 string16* error); 673 string16* error);
674 bool LoadBackgroundScripts(const extensions::Manifest* manifest,
675 string16* error);
667 bool LoadBackgroundPage(const extensions::Manifest* manifest, 676 bool LoadBackgroundPage(const extensions::Manifest* manifest,
668 const ExtensionAPIPermissionSet& api_permissions, 677 const ExtensionAPIPermissionSet& api_permissions,
669 string16* error); 678 string16* error);
670 679
671 // Helper method to load an ExtensionAction from the page_action or 680 // Helper method to load an ExtensionAction from the page_action or
672 // browser_action entries in the manifest. 681 // browser_action entries in the manifest.
673 ExtensionAction* LoadExtensionActionHelper( 682 ExtensionAction* LoadExtensionActionHelper(
674 const base::DictionaryValue* extension_action, string16* error); 683 const base::DictionaryValue* extension_action, string16* error);
675 684
676 // Helper method to load an FileBrowserHandlerList from the manifest. 685 // Helper method to load an FileBrowserHandlerList from the manifest.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 // Optional list of input components and associated properties. 798 // Optional list of input components and associated properties.
790 std::vector<InputComponentInfo> input_components_; 799 std::vector<InputComponentInfo> input_components_;
791 800
792 // Optional list of web accessible extension resources. 801 // Optional list of web accessible extension resources.
793 base::hash_set<std::string> web_accessible_resources_; 802 base::hash_set<std::string> web_accessible_resources_;
794 803
795 // Optional URL to a master page of which a single instance should be always 804 // Optional URL to a master page of which a single instance should be always
796 // loaded in the background. 805 // loaded in the background.
797 GURL background_url_; 806 GURL background_url_;
798 807
808 // Optional list of scripts to use to generate a background page. If this is
809 // present, background_url_ will be empty and generated by GetBackgroundURL().
810 std::vector<std::string> background_scripts_;
811
799 // Optional URL to a page for setting options/preferences. 812 // Optional URL to a page for setting options/preferences.
800 GURL options_url_; 813 GURL options_url_;
801 814
802 // Optional URL to a devtools extension page. 815 // Optional URL to a devtools extension page.
803 GURL devtools_url_; 816 GURL devtools_url_;
804 817
805 // The public key used to sign the contents of the crx package. 818 // The public key used to sign the contents of the crx package.
806 std::string public_key_; 819 std::string public_key_;
807 820
808 // A map of resource id's to relative file paths. 821 // A map of resource id's to relative file paths.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 // only contain the removed permissions. 947 // only contain the removed permissions.
935 const ExtensionPermissionSet* permissions; 948 const ExtensionPermissionSet* permissions;
936 949
937 UpdatedExtensionPermissionsInfo( 950 UpdatedExtensionPermissionsInfo(
938 const Extension* extension, 951 const Extension* extension,
939 const ExtensionPermissionSet* permissions, 952 const ExtensionPermissionSet* permissions,
940 Reason reason); 953 Reason reason);
941 }; 954 };
942 955
943 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 956 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698