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

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
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('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) 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 kFileBrowserHandlerPermission[]; 213 static const char kFileBrowserHandlerPermission[];
210 static const char kFileSystemPermission[];
211 static const char kFileBrowserPrivatePermission[]; 214 static const char kFileBrowserPrivatePermission[];
212 static const char kGeolocationPermission[]; 215 static const char kGeolocationPermission[];
213 static const char kHistoryPermission[]; 216 static const char kHistoryPermission[];
214 static const char kIdlePermission[]; 217 static const char kIdlePermission[];
215 static const char kManagementPermission[]; 218 static const char kManagementPermission[];
216 static const char kNotificationPermission[]; 219 static const char kNotificationPermission[];
217 static const char kProxyPermission[]; 220 static const char kProxyPermission[];
218 static const char kTabPermission[]; 221 static const char kTabPermission[];
219 static const char kUnlimitedStoragePermission[]; 222 static const char kUnlimitedStoragePermission[];
220 static const char kWebstorePrivatePermission[]; 223 static const char kWebstorePrivatePermission[];
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 const std::string& description() const { return description_; } 506 const std::string& description() const { return description_; }
504 bool converted_from_user_script() const { 507 bool converted_from_user_script() const {
505 return converted_from_user_script_; 508 return converted_from_user_script_;
506 } 509 }
507 const UserScriptList& content_scripts() const { return content_scripts_; } 510 const UserScriptList& content_scripts() const { return content_scripts_; }
508 ExtensionAction* page_action() const { return page_action_.get(); } 511 ExtensionAction* page_action() const { return page_action_.get(); }
509 ExtensionAction* browser_action() const { return browser_action_.get(); } 512 ExtensionAction* browser_action() const { return browser_action_.get(); }
510 ExtensionSidebarDefaults* sidebar_defaults() const { 513 ExtensionSidebarDefaults* sidebar_defaults() const {
511 return sidebar_defaults_.get(); 514 return sidebar_defaults_.get();
512 } 515 }
516 const FileBrowserHandlerList* file_browser_handlers() const {
517 return file_browser_handlers_.get();
518 }
513 const std::vector<PluginInfo>& plugins() const { return plugins_; } 519 const std::vector<PluginInfo>& plugins() const { return plugins_; }
514 const std::vector<NaClModuleInfo>& nacl_modules() const { 520 const std::vector<NaClModuleInfo>& nacl_modules() const {
515 return nacl_modules_; 521 return nacl_modules_;
516 } 522 }
517 const GURL& background_url() const { return background_url_; } 523 const GURL& background_url() const { return background_url_; }
518 const GURL& options_url() const { return options_url_; } 524 const GURL& options_url() const { return options_url_; }
519 const GURL& devtools_url() const { return devtools_url_; } 525 const GURL& devtools_url() const { return devtools_url_; }
520 const std::vector<GURL>& toolstrips() const { return toolstrips_; } 526 const std::vector<GURL>& toolstrips() const { return toolstrips_; }
521 const std::set<std::string>& api_permissions() const { 527 const std::set<std::string>& api_permissions() const {
522 return api_permissions_; 528 return api_permissions_;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error); 637 bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error);
632 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error); 638 bool LoadLaunchURL(const DictionaryValue* manifest, std::string* error);
633 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error); 639 bool LoadAppIsolation(const DictionaryValue* manifest, std::string* error);
634 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error); 640 bool EnsureNotHybridApp(const DictionaryValue* manifest, std::string* error);
635 641
636 // Helper method to load an ExtensionAction from the page_action or 642 // Helper method to load an ExtensionAction from the page_action or
637 // browser_action entries in the manifest. 643 // browser_action entries in the manifest.
638 ExtensionAction* LoadExtensionActionHelper( 644 ExtensionAction* LoadExtensionActionHelper(
639 const DictionaryValue* extension_action, std::string* error); 645 const DictionaryValue* extension_action, std::string* error);
640 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
641 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest 654 // Helper method to load an ExtensionSidebarDefaults from the sidebar manifest
642 // entry. 655 // entry.
643 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults( 656 ExtensionSidebarDefaults* LoadExtensionSidebarDefaults(
644 const DictionaryValue* sidebar, std::string* error); 657 const DictionaryValue* sidebar, std::string* error);
645 658
646 // Calculates the effective host permissions from the permissions and content 659 // Calculates the effective host permissions from the permissions and content
647 // script petterns. 660 // script petterns.
648 void InitEffectiveHostPermissions(); 661 void InitEffectiveHostPermissions();
649 662
650 // 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
733 746
734 // Paths to the content scripts the extension contains. 747 // Paths to the content scripts the extension contains.
735 UserScriptList content_scripts_; 748 UserScriptList content_scripts_;
736 749
737 // The extension's page action, if any. 750 // The extension's page action, if any.
738 scoped_ptr<ExtensionAction> page_action_; 751 scoped_ptr<ExtensionAction> page_action_;
739 752
740 // The extension's browser action, if any. 753 // The extension's browser action, if any.
741 scoped_ptr<ExtensionAction> browser_action_; 754 scoped_ptr<ExtensionAction> browser_action_;
742 755
756 // The extension's file browser actions, if any.
757 scoped_ptr<FileBrowserHandlerList> file_browser_handlers_;
758
743 // The extension's sidebar, if any. 759 // The extension's sidebar, if any.
744 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_; 760 scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_;
745 761
746 // Optional list of NPAPI plugins and associated properties. 762 // Optional list of NPAPI plugins and associated properties.
747 std::vector<PluginInfo> plugins_; 763 std::vector<PluginInfo> plugins_;
748 764
749 // Optional list of NaCl modules and associated properties. 765 // Optional list of NaCl modules and associated properties.
750 std::vector<NaClModuleInfo> nacl_modules_; 766 std::vector<NaClModuleInfo> nacl_modules_;
751 767
752 // 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
888 // Was the extension already disabled? 904 // Was the extension already disabled?
889 bool already_disabled; 905 bool already_disabled;
890 906
891 // The extension being unloaded - this should always be non-NULL. 907 // The extension being unloaded - this should always be non-NULL.
892 const Extension* extension; 908 const Extension* extension;
893 909
894 UnloadedExtensionInfo(const Extension* extension, Reason reason); 910 UnloadedExtensionInfo(const Extension* extension, Reason reason);
895 }; 911 };
896 912
897 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 913 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698