| 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 #include "chrome/browser/extensions/api/commands/command_service.h" | 5 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 9 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 void CommandService::Observe( | 136 void CommandService::Observe( |
| 137 int type, | 137 int type, |
| 138 const content::NotificationSource& source, | 138 const content::NotificationSource& source, |
| 139 const content::NotificationDetails& details) { | 139 const content::NotificationDetails& details) { |
| 140 switch (type) { | 140 switch (type) { |
| 141 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 141 case chrome::NOTIFICATION_EXTENSION_INSTALLED: |
| 142 AssignInitialKeybindings( | 142 AssignInitialKeybindings( |
| 143 content::Details<const Extension>(details).ptr()); | 143 content::Details<const Extension>(details).ptr()); |
| 144 break; | 144 break; |
| 145 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: | 145 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: |
| 146 RemoveKeybindingPrefs(*content::Details<std::string>(details).ptr(), | 146 RemoveKeybindingPrefs( |
| 147 std::string()); | 147 content::Details<const Extension>(details).ptr()->id(), |
| 148 std::string()); |
| 148 break; | 149 break; |
| 149 default: | 150 default: |
| 150 NOTREACHED(); | 151 NOTREACHED(); |
| 151 break; | 152 break; |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 | 155 |
| 155 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, | 156 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, |
| 156 const std::string& command_name, | 157 const std::string& command_name, |
| 157 const std::string& keystroke) { | 158 const std::string& keystroke) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 return false; | 296 return false; |
| 296 | 297 |
| 297 *command = *requested_command; | 298 *command = *requested_command; |
| 298 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 299 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
| 299 command->set_accelerator(shortcut_assigned); | 300 command->set_accelerator(shortcut_assigned); |
| 300 | 301 |
| 301 return true; | 302 return true; |
| 302 } | 303 } |
| 303 | 304 |
| 304 } // namespace extensions | 305 } // namespace extensions |
| OLD | NEW |