| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 std::string language; | 144 std::string language; |
| 145 std::set<std::string> layouts; | 145 std::set<std::string> layouts; |
| 146 std::string shortcut_keycode; | 146 std::string shortcut_keycode; |
| 147 bool shortcut_alt; | 147 bool shortcut_alt; |
| 148 bool shortcut_ctrl; | 148 bool shortcut_ctrl; |
| 149 bool shortcut_shift; | 149 bool shortcut_shift; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 class ExtensionKeybinding { | 152 class ExtensionKeybinding { |
| 153 public: | 153 public: |
| 154 enum Type { |
| 155 BROWSER_ACTION, |
| 156 PAGE_ACTION, |
| 157 COMMANDS, |
| 158 }; |
| 159 |
| 154 // Define out of line constructor/destructor to please Clang. | 160 // Define out of line constructor/destructor to please Clang. |
| 155 ExtensionKeybinding(); | 161 ExtensionKeybinding(); |
| 156 ~ExtensionKeybinding(); | 162 ~ExtensionKeybinding(); |
| 157 | 163 |
| 158 // Parse the key binding. | 164 // Parse the key binding. |
| 159 bool Parse(base::DictionaryValue* command, | 165 bool Parse(base::DictionaryValue* command, |
| 160 const std::string& command_name, | 166 const std::string& command_name, |
| 161 int index, | 167 int index, |
| 162 string16* error); | 168 string16* error); |
| 163 | 169 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 522 |
| 517 // Returns the sync bucket to use for this extension. | 523 // Returns the sync bucket to use for this extension. |
| 518 SyncType GetSyncType() const; | 524 SyncType GetSyncType() const; |
| 519 | 525 |
| 520 // Returns true if the extension should be synced. | 526 // Returns true if the extension should be synced. |
| 521 bool IsSyncable() const; | 527 bool IsSyncable() const; |
| 522 | 528 |
| 523 // Returns true if the extension should be displayed in the launcher. | 529 // Returns true if the extension should be displayed in the launcher. |
| 524 bool ShouldDisplayInLauncher() const; | 530 bool ShouldDisplayInLauncher() const; |
| 525 | 531 |
| 532 // Gets an extension keybindings by |type|. |
| 533 void GetCommandByType( |
| 534 Extension::ExtensionKeybinding::Type type, |
| 535 std::vector<Extension::ExtensionKeybinding>* keybindings) const; |
| 536 |
| 526 // Accessors: | 537 // Accessors: |
| 527 | 538 |
| 528 const FilePath& path() const { return path_; } | 539 const FilePath& path() const { return path_; } |
| 529 const GURL& url() const { return extension_url_; } | 540 const GURL& url() const { return extension_url_; } |
| 530 Location location() const; | 541 Location location() const; |
| 531 const std::string& id() const; | 542 const std::string& id() const; |
| 532 const Version* version() const { return version_.get(); } | 543 const Version* version() const { return version_.get(); } |
| 533 const std::string VersionString() const; | 544 const std::string VersionString() const; |
| 534 const std::string& name() const { return name_; } | 545 const std::string& name() const { return name_; } |
| 535 const std::string public_key() const { return public_key_; } | 546 const std::string public_key() const { return public_key_; } |
| 536 const std::string& description() const { return description_; } | 547 const std::string& description() const { return description_; } |
| 537 int manifest_version() const { return manifest_version_; } | 548 int manifest_version() const { return manifest_version_; } |
| 538 bool converted_from_user_script() const { | 549 bool converted_from_user_script() const { |
| 539 return converted_from_user_script_; | 550 return converted_from_user_script_; |
| 540 } | 551 } |
| 541 const UserScriptList& content_scripts() const { return content_scripts_; } | 552 const UserScriptList& content_scripts() const { return content_scripts_; } |
| 542 ExtensionAction* page_action() const { return page_action_.get(); } | 553 ExtensionAction* page_action() const { return page_action_.get(); } |
| 543 ExtensionAction* browser_action() const { return browser_action_.get(); } | 554 ExtensionAction* browser_action() const { return browser_action_.get(); } |
| 544 const FileBrowserHandlerList* file_browser_handlers() const { | 555 const FileBrowserHandlerList* file_browser_handlers() const { |
| 545 return file_browser_handlers_.get(); | 556 return file_browser_handlers_.get(); |
| 546 } | 557 } |
| 547 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 558 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
| 548 const std::vector<NaClModuleInfo>& nacl_modules() const { | 559 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 549 return nacl_modules_; | 560 return nacl_modules_; |
| 550 } | 561 } |
| 551 const std::vector<InputComponentInfo>& input_components() const { | 562 const std::vector<InputComponentInfo>& input_components() const { |
| 552 return input_components_; | 563 return input_components_; |
| 553 } | 564 } |
| 565 // See also GetCommandByType, which allows finer grained control over |
| 566 // which commands are returned. |
| 554 const std::vector<ExtensionKeybinding>& keybindings() const { | 567 const std::vector<ExtensionKeybinding>& keybindings() const { |
| 555 return commands_; | 568 return commands_; |
| 556 } | 569 } |
| 557 bool has_background_page() const { | 570 bool has_background_page() const { |
| 558 return background_url_.is_valid() || !background_scripts_.empty(); | 571 return background_url_.is_valid() || !background_scripts_.empty(); |
| 559 } | 572 } |
| 560 bool allow_background_js_access() const { | 573 bool allow_background_js_access() const { |
| 561 return allow_background_js_access_; | 574 return allow_background_js_access_; |
| 562 } | 575 } |
| 563 const std::vector<std::string>& background_scripts() const { | 576 const std::vector<std::string>& background_scripts() const { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 // only contain the removed permissions. | 1082 // only contain the removed permissions. |
| 1070 const ExtensionPermissionSet* permissions; | 1083 const ExtensionPermissionSet* permissions; |
| 1071 | 1084 |
| 1072 UpdatedExtensionPermissionsInfo( | 1085 UpdatedExtensionPermissionsInfo( |
| 1073 const Extension* extension, | 1086 const Extension* extension, |
| 1074 const ExtensionPermissionSet* permissions, | 1087 const ExtensionPermissionSet* permissions, |
| 1075 Reason reason); | 1088 Reason reason); |
| 1076 }; | 1089 }; |
| 1077 | 1090 |
| 1078 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1091 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |