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

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 FileBrowserHandler;
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<FileBrowserHandler> > FileBrowserHandlerList;
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // NOTE: To add a new permission, define it here, and add an entry to 203 // NOTE: To add a new permission, define it here, and add an entry to
200 // Extension::kPermissions. 204 // Extension::kPermissions.
201 static const char kBackgroundPermission[]; 205 static const char kBackgroundPermission[];
202 static const char kBookmarkPermission[]; 206 static const char kBookmarkPermission[];
203 static const char kContentSettingsPermission[]; 207 static const char kContentSettingsPermission[];
204 static const char kContextMenusPermission[]; 208 static const char kContextMenusPermission[];
205 static const char kCookiePermission[]; 209 static const char kCookiePermission[];
206 static const char kChromeosInfoPrivatePermissions[]; 210 static const char kChromeosInfoPrivatePermissions[];
207 static const char kDebuggerPermission[]; 211 static const char kDebuggerPermission[];
208 static const char kExperimentalPermission[]; 212 static const char kExperimentalPermission[];
209 static const char kFileSystemPermission[]; 213 static const char kFileBrowserHandlerPermission[];
210 static const char kFileBrowserPrivatePermission[]; 214 static const char kFileBrowserPrivatePermission[];
211 static const char kGeolocationPermission[]; 215 static const char kGeolocationPermission[];
212 static const char kHistoryPermission[]; 216 static const char kHistoryPermission[];
213 static const char kIdlePermission[]; 217 static const char kIdlePermission[];
214 static const char kManagementPermission[]; 218 static const char kManagementPermission[];
215 static const char kNotificationPermission[]; 219 static const char kNotificationPermission[];
216 static const char kProxyPermission[]; 220 static const char kProxyPermission[];
217 static const char kTabPermission[]; 221 static const char kTabPermission[];
218 static const char kUnlimitedStoragePermission[]; 222 static const char kUnlimitedStoragePermission[];
219 static const char kWebstorePrivatePermission[]; 223 static const char kWebstorePrivatePermission[];
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 const std::string& description() const { return description_; } 506 const std::string& description() const { return description_; }
503 bool converted_from_user_script() const { 507 bool converted_from_user_script() const {
504 return converted_from_user_script_; 508 return converted_from_user_script_;
505 } 509 }
506 const UserScriptList& content_scripts() const { return content_scripts_; } 510 const UserScriptList& content_scripts() const { return content_scripts_; }
507 ExtensionAction* page_action() const { return page_action_.get(); } 511 ExtensionAction* page_action() const { return page_action_.get(); }
508 ExtensionAction* browser_action() const { return browser_action_.get(); } 512 ExtensionAction* browser_action() const { return browser_action_.get(); }
509 ExtensionSidebarDefaults* sidebar_defaults() const { 513 ExtensionSidebarDefaults* sidebar_defaults() const {
510 return sidebar_defaults_.get(); 514 return sidebar_defaults_.get();
511 } 515 }
516 const FileBrowserHandlerList* file_browser_handlers() const {
517 return file_browser_handlers_.get();
518 }
512 const std::vector<PluginInfo>& plugins() const { return plugins_; } 519 const std::vector<PluginInfo>& plugins() const { return plugins_; }
513 const std::vector<NaClModuleInfo>& nacl_modules() const { 520 const std::vector<NaClModuleInfo>& nacl_modules() const {
514 return nacl_modules_; 521 return nacl_modules_;
515 } 522 }
516 const GURL& background_url() const { return background_url_; } 523 const GURL& background_url() const { return background_url_; }
517 const GURL& options_url() const { return options_url_; } 524 const GURL& options_url() const { return options_url_; }
518 const GURL& devtools_url() const { return devtools_url_; } 525 const GURL& devtools_url() const { return devtools_url_; }
519 const std::vector<GURL>& toolstrips() const { return toolstrips_; } 526 const std::vector<GURL>& toolstrips() const { return toolstrips_; }
520 const std::set<std::string>& api_permissions() const { 527 const std::set<std::string>& api_permissions() const {
521 return api_permissions_; 528 return api_permissions_;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error); 637 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error);
631 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error); 638 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error);
632 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error); 639 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error);
633 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error); 640 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error);
634 641
635 // Helper method to load an ExtensionAction from the page_action or 642 // Helper method to load an ExtensionAction from the page_action or
636 // browser_action entries in the manifest. 643 // browser_action entries in the manifest.
637 ExtensionAction* LoadExtensionActionHelper( 644 ExtensionAction* LoadExtensionActionHelper(
638 const DictionaryValue* extension_action, std::string* error); 645 const DictionaryValue* extension_action, std::string* error);
639 646
647 // Helper method to load an FileBrowserHandlerList from the manifest.
648 FileBrowserHandlerList* LoadFileBrowserHandlers(
649 const ListValue* extension_actions, std::string* error);
650 // Helper method to load an FileBrowserHandler from manifest.
651 FileBrowserHandler* LoadFileBrowserHandler(
652 const DictionaryValue* file_browser_handlers, std::string* error);
653
640 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest 654 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest
641 // entry. 655 // entry.
642 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( 656 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults(
643 const DictionaryValue* sidebar, std::string* error); 657 const DictionaryValue* sidebar, std::string* error);
644 658
645 // Calculates the effective host permissions from the permissions and content 659 // Calculates the effective host permissions from the permissions and content
646 // script petterns. 660 // script petterns.
647 void InitEffectiveHostPermissions(); 661 void InitEffectiveHostPermissions();
648 662
649 // Returns true if the extension has more than one "UI surface". For example, 663 // 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
732 746
733 // Paths to the content scripts the extension contains. 747 // Paths to the content scripts the extension contains.
734 UserScriptList content_scripts_; 748 UserScriptList content_scripts_;
735 749
736 // The extension's page action, if any. 750 // The extension's page action, if any.
737 scoped_ptr<ExtensionAction> page_action_; 751 scoped_ptr<ExtensionAction> page_action_;
738 752
739 // The extension's browser action, if any. 753 // The extension's browser action, if any.
740 scoped_ptr<ExtensionAction> browser_action_; 754 scoped_ptr<ExtensionAction> browser_action_;
741 755
756 // The extension's file browser actions, if any.
757 scoped_ptr<FileBrowserHandlerList> file_browser_handlers_;
758
742 // The extension's sidebar, if any. 759 // The extension's sidebar, if any.
743 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_; 760 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_;
744 761
745 // Optional list of NPAPI plugins and associated properties. 762 // Optional list of NPAPI plugins and associated properties.
746 std::vector<PluginInfo> plugins_; 763 std::vector<PluginInfo> plugins_;
747 764
748 // Optional list of NaCl modules and associated properties. 765 // Optional list of NaCl modules and associated properties.
749 std::vector<NaClModuleInfo> nacl_modules_; 766 std::vector<NaClModuleInfo> nacl_modules_;
750 767
751 // Optional URL to a master page of which a single instance should be always 768 // 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
887 // Was the extension already disabled? 904 // Was the extension already disabled?
888 bool already_disabled; 905 bool already_disabled;
889 906
890 // The extension being unloaded - this should always be non-NULL. 907 // The extension being unloaded - this should always be non-NULL.
891 const Extension* extension; 908 const Extension* extension;
892 909
893 UnloadedExtensionInfo(const Extension* extension, Reason reason); 910 UnloadedExtensionInfo(const Extension* extension, Reason reason);
894 }; 911 };
895 912
896 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 913 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698