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

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

Issue 10201016: Conflict detection for Extension Keybinding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressed comments Created 8 years, 7 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_browser_extensions.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 <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 bool shortcut_ctrl; 157 bool shortcut_ctrl;
158 bool shortcut_shift; 158 bool shortcut_shift;
159 }; 159 };
160 160
161 class ExtensionKeybinding { 161 class ExtensionKeybinding {
162 public: 162 public:
163 // Define out of line constructor/destructor to please Clang. 163 // Define out of line constructor/destructor to please Clang.
164 ExtensionKeybinding(); 164 ExtensionKeybinding();
165 ~ExtensionKeybinding(); 165 ~ExtensionKeybinding();
166 166
167 // The Keybinding platform value.
168 static std::string KeybindingPlatform();
169
167 // Parse the key binding. 170 // Parse the key binding.
168 bool Parse(base::DictionaryValue* command, 171 bool Parse(base::DictionaryValue* command,
169 const std::string& command_name, 172 const std::string& command_name,
170 int index, 173 int index,
171 string16* error); 174 string16* error);
172 175
173 // Accessors: 176 // Accessors:
174 const std::string& command_name() const { return command_name_; } 177 const std::string& command_name() const { return command_name_; }
175 const ui::Accelerator& accelerator() const { return accelerator_; } 178 const ui::Accelerator& accelerator() const { return accelerator_; }
176 const std::string& description() const { return description_; } 179 const std::string& description() const { return description_; }
177 180
178 private: 181 private:
179 ui::Accelerator ParseImpl(const std::string& shortcut, 182 ui::Accelerator ParseImpl(const std::string& shortcut,
180 const std::string& platform_key, 183 const std::string& platform_key,
181 int index, 184 int index,
182 string16* error); 185 string16* error);
183 std::string command_name_; 186 std::string command_name_;
184 ui::Accelerator accelerator_; 187 ui::Accelerator accelerator_;
185 std::string description_; 188 std::string description_;
186 }; 189 };
187 190
191 // A mapping of command name (std::string) to a keybinding object.
188 typedef std::map<std::string, ExtensionKeybinding> CommandMap; 192 typedef std::map<std::string, ExtensionKeybinding> CommandMap;
189 193
190 struct TtsVoice { 194 struct TtsVoice {
191 // Define out of line constructor/destructor to please Clang. 195 // Define out of line constructor/destructor to please Clang.
192 TtsVoice(); 196 TtsVoice();
193 ~TtsVoice(); 197 ~TtsVoice();
194 198
195 std::string voice_name; 199 std::string voice_name;
196 std::string lang; 200 std::string lang;
197 std::string gender; 201 std::string gender;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 const FileBrowserHandlerList* file_browser_handlers() const { 591 const FileBrowserHandlerList* file_browser_handlers() const {
588 return file_browser_handlers_.get(); 592 return file_browser_handlers_.get();
589 } 593 }
590 const std::vector<PluginInfo>& plugins() const { return plugins_; } 594 const std::vector<PluginInfo>& plugins() const { return plugins_; }
591 const std::vector<NaClModuleInfo>& nacl_modules() const { 595 const std::vector<NaClModuleInfo>& nacl_modules() const {
592 return nacl_modules_; 596 return nacl_modules_;
593 } 597 }
594 const std::vector<InputComponentInfo>& input_components() const { 598 const std::vector<InputComponentInfo>& input_components() const {
595 return input_components_; 599 return input_components_;
596 } 600 }
601 // The browser action command keybinding that the extension wants to use,
602 // which is not necessarily the one it can use, as it might be inactive
603 // (see also GetActiveBrowserActionCommand in ExtensionKeybindingRegistry).
597 const ExtensionKeybinding* browser_action_command() const { 604 const ExtensionKeybinding* browser_action_command() const {
598 return browser_action_command_.get(); 605 return browser_action_command_.get();
599 } 606 }
607 // The page action command keybinding that the extension wants to use,
608 // which is not necessarily the one it can use, as it might be inactive
609 // (see also GetActivePageActionCommand in ExtensionKeybindingRegistry).
600 const ExtensionKeybinding* page_action_command() const { 610 const ExtensionKeybinding* page_action_command() const {
601 return page_action_command_.get(); 611 return page_action_command_.get();
602 } 612 }
613 // The map of named commands to keybindings that the extension wants to use,
614 // which is not necessarily the one it can use, as they might be inactive
615 // (see also GetActiveNamedCommands in ExtensionKeybindingRegistry).
603 const CommandMap& named_commands() const { 616 const CommandMap& named_commands() const {
604 return named_commands_; 617 return named_commands_;
605 } 618 }
606 bool has_background_page() const { 619 bool has_background_page() const {
607 return background_url_.is_valid() || !background_scripts_.empty(); 620 return background_url_.is_valid() || !background_scripts_.empty();
608 } 621 }
609 bool allow_background_js_access() const { 622 bool allow_background_js_access() const {
610 return allow_background_js_access_; 623 return allow_background_js_access_;
611 } 624 }
612 const std::vector<std::string>& background_scripts() const { 625 const std::vector<std::string>& background_scripts() const {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 // only contain the removed permissions. 1141 // only contain the removed permissions.
1129 const ExtensionPermissionSet* permissions; 1142 const ExtensionPermissionSet* permissions;
1130 1143
1131 UpdatedExtensionPermissionsInfo( 1144 UpdatedExtensionPermissionsInfo(
1132 const Extension* extension, 1145 const Extension* extension,
1133 const ExtensionPermissionSet* permissions, 1146 const ExtensionPermissionSet* permissions,
1134 Reason reason); 1147 Reason reason);
1135 }; 1148 };
1136 1149
1137 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1150 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698