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/extensions/api/commands/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
8 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | 8 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
9 #include "chrome/browser/extensions/browser_event_router.h" | 9 #include "chrome/browser/extensions/browser_event_router.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/extensions/extension_manifest_constants.h" | 14 #include "chrome/common/extensions/extension_manifest_constants.h" |
15 #include "content/public/browser/native_web_keyboard_event.h" | 15 #include "content/public/browser/native_web_keyboard_event.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 | 17 |
18 namespace values = extension_manifest_values; | 18 namespace values = extension_manifest_values; |
19 | 19 |
20 // static | 20 // static |
21 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( | 21 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( |
22 bool suspended) { | 22 bool suspended) { |
23 ExtensionKeybindingRegistryCocoa::set_shortcut_handling_suspended(suspended); | 23 ExtensionKeybindingRegistryCocoa::set_shortcut_handling_suspended(suspended); |
24 } | 24 } |
25 | 25 |
26 bool ExtensionKeybindingRegistryCocoa::shortcut_handling_suspended_ = false; | 26 bool ExtensionKeybindingRegistryCocoa::shortcut_handling_suspended_ = false; |
27 | 27 |
28 ExtensionKeybindingRegistryCocoa::ExtensionKeybindingRegistryCocoa( | 28 ExtensionKeybindingRegistryCocoa::ExtensionKeybindingRegistryCocoa( |
29 Profile* profile, gfx::NativeWindow window) | 29 Profile* profile, |
30 : ExtensionKeybindingRegistry(profile), | 30 gfx::NativeWindow window, |
| 31 ExtensionFilter extension_filter) |
| 32 : ExtensionKeybindingRegistry(profile, extension_filter), |
31 profile_(profile), | 33 profile_(profile), |
32 window_(window) { | 34 window_(window) { |
33 Init(); | 35 Init(); |
34 } | 36 } |
35 | 37 |
36 ExtensionKeybindingRegistryCocoa::~ExtensionKeybindingRegistryCocoa() { | 38 ExtensionKeybindingRegistryCocoa::~ExtensionKeybindingRegistryCocoa() { |
37 } | 39 } |
38 | 40 |
39 bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent( | 41 bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent( |
40 const content::NativeWebKeyboardEvent& event) { | 42 const content::NativeWebKeyboardEvent& event) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 const extensions::Extension* extension, | 142 const extensions::Extension* extension, |
141 const std::string& command_name) { | 143 const std::string& command_name) { |
142 EventTargets::iterator iter = event_targets_.begin(); | 144 EventTargets::iterator iter = event_targets_.begin(); |
143 while (iter != event_targets_.end()) { | 145 while (iter != event_targets_.end()) { |
144 EventTargets::iterator old = iter++; | 146 EventTargets::iterator old = iter++; |
145 if (old->second.first == extension->id() && | 147 if (old->second.first == extension->id() && |
146 (command_name.empty() || (old->second.second == command_name))) | 148 (command_name.empty() || (old->second.second == command_name))) |
147 event_targets_.erase(old); | 149 event_targets_.erase(old); |
148 } | 150 } |
149 } | 151 } |
OLD | NEW |