| 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/gtk/extensions/extension_keybinding_registry_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/api/commands/command_service.h" | 9 #include "chrome/browser/extensions/api/commands/command_service.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/browser/ui/gtk/accelerators_gtk.h" |
| 12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 13 #include "ui/base/accelerators/platform_accelerator_gtk.h" | 14 #include "ui/base/accelerators/platform_accelerator_gtk.h" |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( | 17 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( |
| 17 bool suspended) { | 18 bool suspended) { |
| 18 ExtensionKeybindingRegistryGtk::set_shortcut_handling_suspended(suspended); | 19 ExtensionKeybindingRegistryGtk::set_shortcut_handling_suspended(suspended); |
| 19 } | 20 } |
| 20 | 21 |
| 22 // static |
| 23 bool extensions::ExtensionKeybindingRegistry::IsChromeAccelerator( |
| 24 const ui::Accelerator& accelerator) { |
| 25 AcceleratorsGtk* accelerators = AcceleratorsGtk::GetInstance(); |
| 26 for (AcceleratorsGtk::const_iterator iter = accelerators->begin(); |
| 27 iter != accelerators->end(); ++iter) { |
| 28 if (iter->second.key_code() == accelerator.key_code() && |
| 29 iter->second.modifiers() == accelerator.modifiers()) |
| 30 return true; |
| 31 } |
| 32 return false; |
| 33 } |
| 34 |
| 21 bool ExtensionKeybindingRegistryGtk::shortcut_handling_suspended_ = false; | 35 bool ExtensionKeybindingRegistryGtk::shortcut_handling_suspended_ = false; |
| 22 | 36 |
| 23 ExtensionKeybindingRegistryGtk::ExtensionKeybindingRegistryGtk( | 37 ExtensionKeybindingRegistryGtk::ExtensionKeybindingRegistryGtk( |
| 24 Profile* profile, | 38 Profile* profile, |
| 25 gfx::NativeWindow window, | 39 gfx::NativeWindow window, |
| 26 ExtensionFilter extension_filter, | 40 ExtensionFilter extension_filter, |
| 27 Delegate* delegate) | 41 Delegate* delegate) |
| 28 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), | 42 : ExtensionKeybindingRegistry(profile, extension_filter, delegate), |
| 29 profile_(profile), | 43 profile_(profile), |
| 30 window_(window), | 44 window_(window), |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 176 |
| 163 EventTargets::iterator it = event_targets_.find(accelerator); | 177 EventTargets::iterator it = event_targets_.find(accelerator); |
| 164 if (it == event_targets_.end()) { | 178 if (it == event_targets_.end()) { |
| 165 NOTREACHED(); // Shouldn't get this event for something not registered. | 179 NOTREACHED(); // Shouldn't get this event for something not registered. |
| 166 return FALSE; | 180 return FALSE; |
| 167 } | 181 } |
| 168 | 182 |
| 169 CommandExecuted(it->second.first, it->second.second); | 183 CommandExecuted(it->second.first, it->second.second); |
| 170 return TRUE; | 184 return TRUE; |
| 171 } | 185 } |
| OLD | NEW |