| 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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/api/commands/commands.h" | 10 #include "chrome/browser/extensions/api/commands/commands.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void CommandService::Observe( | 169 void CommandService::Observe( |
| 170 int type, | 170 int type, |
| 171 const content::NotificationSource& source, | 171 const content::NotificationSource& source, |
| 172 const content::NotificationDetails& details) { | 172 const content::NotificationDetails& details) { |
| 173 switch (type) { | 173 switch (type) { |
| 174 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 174 case chrome::NOTIFICATION_EXTENSION_INSTALLED: |
| 175 AssignInitialKeybindings( | 175 AssignInitialKeybindings( |
| 176 content::Details<const Extension>(details).ptr()); | 176 content::Details<const InstalledExtensionInfo>(details)->extension); |
| 177 break; | 177 break; |
| 178 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: | 178 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: |
| 179 RemoveKeybindingPrefs( | 179 RemoveKeybindingPrefs( |
| 180 content::Details<const Extension>(details).ptr()->id(), | 180 content::Details<const Extension>(details)->id(), |
| 181 std::string()); | 181 std::string()); |
| 182 break; | 182 break; |
| 183 default: | 183 default: |
| 184 NOTREACHED(); | 184 NOTREACHED(); |
| 185 break; | 185 break; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, | 189 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, |
| 190 const std::string& command_name, | 190 const std::string& command_name, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return false; | 353 return false; |
| 354 | 354 |
| 355 *command = *requested_command; | 355 *command = *requested_command; |
| 356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) | 356 if (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN) |
| 357 command->set_accelerator(shortcut_assigned); | 357 command->set_accelerator(shortcut_assigned); |
| 358 | 358 |
| 359 return true; | 359 return true; |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace extensions | 362 } // namespace extensions |
| OLD | NEW |