| 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/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" | 5 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/extensions/accelerator_priority.h" | 11 #include "chrome/browser/ui/extensions/accelerator_priority.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 #include "extensions/common/manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
| 15 #include "ui/content_accelerators/accelerator_util.h" | 15 #include "ui/content_accelerators/accelerator_util.h" |
| 16 | 16 |
| 17 namespace values = extensions::manifest_values; | 17 namespace values = extensions::manifest_values; |
| 18 | 18 |
| 19 // static | |
| 20 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( | |
| 21 bool suspended) { | |
| 22 ExtensionKeybindingRegistryCocoa::set_shortcut_handling_suspended(suspended); | |
| 23 } | |
| 24 | |
| 25 bool ExtensionKeybindingRegistryCocoa::shortcut_handling_suspended_ = false; | |
| 26 | |
| 27 ExtensionKeybindingRegistryCocoa::ExtensionKeybindingRegistryCocoa( | 19 ExtensionKeybindingRegistryCocoa::ExtensionKeybindingRegistryCocoa( |
| 28 Profile* profile, | 20 Profile* profile, |
| 29 gfx::NativeWindow window, | 21 gfx::NativeWindow window, |
| 30 ExtensionFilter extension_filter, | 22 ExtensionFilter extension_filter, |
| 31 Delegate* delegate) | 23 Delegate* delegate) |
| 32 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), | 24 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), |
| 33 profile_(profile), | 25 profile_(profile), |
| 34 window_(window) { | 26 window_(window) { |
| 35 Init(); | 27 Init(); |
| 36 } | 28 } |
| 37 | 29 |
| 38 ExtensionKeybindingRegistryCocoa::~ExtensionKeybindingRegistryCocoa() { | 30 ExtensionKeybindingRegistryCocoa::~ExtensionKeybindingRegistryCocoa() { |
| 39 } | 31 } |
| 40 | 32 |
| 41 bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent( | 33 bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent( |
| 42 const content::NativeWebKeyboardEvent& event, | 34 const content::NativeWebKeyboardEvent& event, |
| 43 ui::AcceleratorManager::HandlerPriority priority) { | 35 ui::AcceleratorManager::HandlerPriority priority) { |
| 44 if (shortcut_handling_suspended_) | 36 if (IsShortcutHandlingSuspended()) |
| 45 return false; | 37 return false; |
| 46 | 38 |
| 47 ui::Accelerator accelerator = | 39 ui::Accelerator accelerator = |
| 48 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); | 40 ui::GetAcceleratorFromNativeWebKeyboardEvent(event); |
| 49 | 41 |
| 50 std::string extension_id; | 42 std::string extension_id; |
| 51 std::string command_name; | 43 std::string command_name; |
| 52 if (!GetFirstTarget(accelerator, &extension_id, &command_name)) | 44 if (!GetFirstTarget(accelerator, &extension_id, &command_name)) |
| 53 return false; | 45 return false; |
| 54 | 46 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 AddEventTarget(page_action.accelerator(), | 118 AddEventTarget(page_action.accelerator(), |
| 127 extension->id(), | 119 extension->id(), |
| 128 page_action.command_name()); | 120 page_action.command_name()); |
| 129 } | 121 } |
| 130 } | 122 } |
| 131 | 123 |
| 132 void ExtensionKeybindingRegistryCocoa::RemoveExtensionKeybindingImpl( | 124 void ExtensionKeybindingRegistryCocoa::RemoveExtensionKeybindingImpl( |
| 133 const ui::Accelerator& accelerator, | 125 const ui::Accelerator& accelerator, |
| 134 const std::string& command_name) { | 126 const std::string& command_name) { |
| 135 } | 127 } |
| OLD | NEW |