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

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: 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
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 const FileBrowserHandlerList* file_browser_handlers() const { 587 const FileBrowserHandlerList* file_browser_handlers() const {
584 return file_browser_handlers_.get(); 588 return file_browser_handlers_.get();
585 } 589 }
586 const std::vector<PluginInfo>& plugins() const { return plugins_; } 590 const std::vector<PluginInfo>& plugins() const { return plugins_; }
587 const std::vector<NaClModuleInfo>& nacl_modules() const { 591 const std::vector<NaClModuleInfo>& nacl_modules() const {
588 return nacl_modules_; 592 return nacl_modules_;
589 } 593 }
590 const std::vector<InputComponentInfo>& input_components() const { 594 const std::vector<InputComponentInfo>& input_components() const {
591 return input_components_; 595 return input_components_;
592 } 596 }
597 // The browser action command keybinding that the extension wants to use,
598 // which is not necessarily the one it can use, as it might be inacive.
Yoyo Zhou 2012/05/01 01:51:30 nit: typo. %s/inacive/inactive/. Also delete the p
599 // (see also GetActiveBrowserActionCommand in ExtensionKeybindingRegistry).
593 const ExtensionKeybinding* browser_action_command() const { 600 const ExtensionKeybinding* browser_action_command() const {
594 return browser_action_command_.get(); 601 return browser_action_command_.get();
595 } 602 }
603 // The page action command keybinding that the extension wants to use,
604 // which is not necessarily the one it can use, as it might be inacive.
605 // (see also GetActivePageActionCommand in ExtensionKeybindingRegistry).
596 const ExtensionKeybinding* page_action_command() const { 606 const ExtensionKeybinding* page_action_command() const {
597 return page_action_command_.get(); 607 return page_action_command_.get();
598 } 608 }
609 // The map of named commands to keybindings that the extension wants to use,
610 // which is not necessarily the one it can use, as they might be inacive.
611 // (see also GetActiveNamedCommands in ExtensionKeybindingRegistry).
599 const CommandMap& named_commands() const { 612 const CommandMap& named_commands() const {
600 return named_commands_; 613 return named_commands_;
601 } 614 }
602 bool has_background_page() const { 615 bool has_background_page() const {
603 return background_url_.is_valid() || !background_scripts_.empty(); 616 return background_url_.is_valid() || !background_scripts_.empty();
604 } 617 }
605 bool allow_background_js_access() const { 618 bool allow_background_js_access() const {
606 return allow_background_js_access_; 619 return allow_background_js_access_;
607 } 620 }
608 const std::vector<std::string>& background_scripts() const { 621 const std::vector<std::string>& background_scripts() const {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // only contain the removed permissions. 1136 // only contain the removed permissions.
1124 const ExtensionPermissionSet* permissions; 1137 const ExtensionPermissionSet* permissions;
1125 1138
1126 UpdatedExtensionPermissionsInfo( 1139 UpdatedExtensionPermissionsInfo(
1127 const Extension* extension, 1140 const Extension* extension,
1128 const ExtensionPermissionSet* permissions, 1141 const ExtensionPermissionSet* permissions,
1129 Reason reason); 1142 Reason reason);
1130 }; 1143 };
1131 1144
1132 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1145 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698