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

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

Issue 6749021: Added new fileBrowserPrivate and fileHandler extension APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
19 #include "chrome/common/extensions/extension_extent.h" 20 #include "chrome/common/extensions/extension_extent.h"
20 #include "chrome/common/extensions/extension_icon_set.h" 21 #include "chrome/common/extensions/extension_icon_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 "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
24 #include "ui/gfx/size.h" 25 #include "ui/gfx/size.h"
25 26
26 class DictionaryValue; 27 class DictionaryValue;
27 class ExtensionAction; 28 class ExtensionAction;
28 class ExtensionResource; 29 class ExtensionResource;
29 class ExtensionSidebarDefaults; 30 class ExtensionSidebarDefaults;
31 class FileBrowserAction;
32 class ListValue;
30 class SkBitmap; 33 class SkBitmap;
31 class Version; 34 class Version;
32 35
33 // Represents a Chrome extension. 36 // Represents a Chrome extension.
34 class Extension : public base::RefCountedThreadSafe<Extension> { 37 class Extension : public base::RefCountedThreadSafe<Extension> {
35 public: 38 public:
36 typedef std::map<const std::string, GURL> URLOverrideMap; 39 typedef std::map<const std::string, GURL> URLOverrideMap;
37 typedef std::vector<std::string> ScriptingWhitelist; 40 typedef std::vector<std::string> ScriptingWhitelist;
41 typedef std::vector<linked_ptr<FileBrowserAction> > FileBrowserActionList;
38 42
39 // What an extension was loaded from. 43 // What an extension was loaded from.
40 // NOTE: These values are stored as integers in the preferences and used 44 // NOTE: These values are stored as integers in the preferences and used
41 // in histograms so don't remove or reorder existing items. Just append 45 // in histograms so don't remove or reorder existing items. Just append
42 // to the end. 46 // to the end.
43 enum Location { 47 enum Location {
44 INVALID, 48 INVALID,
45 INTERNAL, // A crx file from the internal Extensions directory. 49 INTERNAL, // A crx file from the internal Extensions directory.
46 EXTERNAL_PREF, // A crx file from an external directory (via prefs). 50 EXTERNAL_PREF, // A crx file from an external directory (via prefs).
47 EXTERNAL_REGISTRY, // A crx file from an external directory (via eg the 51 EXTERNAL_REGISTRY, // A crx file from an external directory (via eg the
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 const std::string& description() const { return description_; } 501 const std::string& description() const { return description_; }
498 bool converted_from_user_script() const { 502 bool converted_from_user_script() const {
499 return converted_from_user_script_; 503 return converted_from_user_script_;
500 } 504 }
501 const UserScriptList& content_scripts() const { return content_scripts_; } 505 const UserScriptList& content_scripts() const { return content_scripts_; }
502 ExtensionAction* page_action() const { return page_action_.get(); } 506 ExtensionAction* page_action() const { return page_action_.get(); }
503 ExtensionAction* browser_action() const { return browser_action_.get(); } 507 ExtensionAction* browser_action() const { return browser_action_.get(); }
504 ExtensionSidebarDefaults* sidebar_defaults() const { 508 ExtensionSidebarDefaults* sidebar_defaults() const {
505 return sidebar_defaults_.get(); 509 return sidebar_defaults_.get();
506 } 510 }
511 const FileBrowserActionList* file_browser_actions() const {
512 return file_browser_actions_.get();
513 }
507 const std::vector<PluginInfo>& plugins() const { return plugins_; } 514 const std::vector<PluginInfo>& plugins() const { return plugins_; }
508 const std::vector<NaClModuleInfo>& nacl_modules() const { 515 const std::vector<NaClModuleInfo>& nacl_modules() const {
509 return nacl_modules_; 516 return nacl_modules_;
510 } 517 }
511 const GURL& background_url() const { return background_url_; } 518 const GURL& background_url() const { return background_url_; }
512 const GURL& options_url() const { return options_url_; } 519 const GURL& options_url() const { return options_url_; }
513 const GURL& devtools_url() const { return devtools_url_; } 520 const GURL& devtools_url() const { return devtools_url_; }
514 const std::vector<GURL>& toolstrips() const { return toolstrips_; } 521 const std::vector<GURL>& toolstrips() const { return toolstrips_; }
515 const std::set<std::string>& api_permissions() const { 522 const std::set<std::string>& api_permissions() const {
516 return api_permissions_; 523 return api_permissions_;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error); 632 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error);
626 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error); 633 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error);
627 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error); 634 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error);
628 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error); 635 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error);
629 636
630 // Helper method to load an ExtensionAction from the page_action or 637 // Helper method to load an ExtensionAction from the page_action or
631 // browser_action entries in the manifest. 638 // browser_action entries in the manifest.
632 ExtensionAction* LoadExtensionActionHelper( 639 ExtensionAction* LoadExtensionActionHelper(
633 const DictionaryValue* extension_action, std::string* error); 640 const DictionaryValue* extension_action, std::string* error);
634 641
642 // Helper method to load an FileBrowserActionList from the manifest.
643 FileBrowserActionList* LoadFileBrowserActions(
644 const ListValue* extension_actions, std::string* error);
Aaron Boodman 2011/04/12 22:47:21 Similarly to my comment in extension_api.json, the
645 // Helper method to load an FileBrowserAction from manifest.
646 FileBrowserAction* LoadFileBrowserAction(
647 const DictionaryValue* file_browser_actions, std::string* error);
648
635 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest 649 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest
636 // entry. 650 // entry.
637 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( 651 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults(
638 const DictionaryValue* sidebar, std::string* error); 652 const DictionaryValue* sidebar, std::string* error);
639 653
640 // Calculates the effective host permissions from the permissions and content 654 // Calculates the effective host permissions from the permissions and content
641 // script petterns. 655 // script petterns.
642 void InitEffectiveHostPermissions(); 656 void InitEffectiveHostPermissions();
643 657
644 // Returns true if the extension has more than one "UI surface". For example, 658 // Returns true if the extension has more than one "UI surface". For example,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 741
728 // Paths to the content scripts the extension contains. 742 // Paths to the content scripts the extension contains.
729 UserScriptList content_scripts_; 743 UserScriptList content_scripts_;
730 744
731 // The extension's page action, if any. 745 // The extension's page action, if any.
732 scoped_ptr<ExtensionAction> page_action_; 746 scoped_ptr<ExtensionAction> page_action_;
733 747
734 // The extension's browser action, if any. 748 // The extension's browser action, if any.
735 scoped_ptr<ExtensionAction> browser_action_; 749 scoped_ptr<ExtensionAction> browser_action_;
736 750
751 // The extension's file browser actions, if any.
752 scoped_ptr<FileBrowserActionList> file_browser_actions_;
753
737 // The extension's sidebar, if any. 754 // The extension's sidebar, if any.
738 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_; 755 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_;
739 756
740 // Optional list of NPAPI plugins and associated properties. 757 // Optional list of NPAPI plugins and associated properties.
741 std::vector<PluginInfo> plugins_; 758 std::vector<PluginInfo> plugins_;
742 759
743 // Optional list of NaCl modules and associated properties. 760 // Optional list of NaCl modules and associated properties.
744 std::vector<NaClModuleInfo> nacl_modules_; 761 std::vector<NaClModuleInfo> nacl_modules_;
745 762
746 // Optional URL to a master page of which a single instance should be always 763 // Optional URL to a master page of which a single instance should be always
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 // Was the extension already disabled? 899 // Was the extension already disabled?
883 bool already_disabled; 900 bool already_disabled;
884 901
885 // The extension being unloaded - this should always be non-NULL. 902 // The extension being unloaded - this should always be non-NULL.
886 const Extension* extension; 903 const Extension* extension;
887 904
888 UnloadedExtensionInfo(const Extension* extension, Reason reason); 905 UnloadedExtensionInfo(const Extension* extension, Reason reason);
889 }; 906 };
890 907
891 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 908 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698