| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension_commands_global_registry.h" | 5 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.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/global_shortcut_listener.h" | 9 #include "chrome/browser/extensions/global_shortcut_listener.h" |
| 10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Resume GlobalShortcutListener before we clean up if the shortcut handling | 29 // Resume GlobalShortcutListener before we clean up if the shortcut handling |
| 30 // is currently suspended. | 30 // is currently suspended. |
| 31 if (global_shortcut_listener->IsShortcutHandlingSuspended()) | 31 if (global_shortcut_listener->IsShortcutHandlingSuspended()) |
| 32 global_shortcut_listener->SetShortcutHandlingSuspended(false); | 32 global_shortcut_listener->SetShortcutHandlingSuspended(false); |
| 33 | 33 |
| 34 global_shortcut_listener->UnregisterAccelerators(this); | 34 global_shortcut_listener->UnregisterAccelerators(this); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 static base::LazyInstance< | 38 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
| 39 BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry> > g_factory = | 39 ExtensionCommandsGlobalRegistry>>::DestructorAtExit g_factory = |
| 40 LAZY_INSTANCE_INITIALIZER; | 40 LAZY_INSTANCE_INITIALIZER; |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>* | 43 BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>* |
| 44 ExtensionCommandsGlobalRegistry::GetFactoryInstance() { | 44 ExtensionCommandsGlobalRegistry::GetFactoryInstance() { |
| 45 return g_factory.Pointer(); | 45 return g_factory.Pointer(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 ExtensionCommandsGlobalRegistry* ExtensionCommandsGlobalRegistry::Get( | 49 ExtensionCommandsGlobalRegistry* ExtensionCommandsGlobalRegistry::Get( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (registry_for_active_window()) | 107 if (registry_for_active_window()) |
| 108 registry_for_active_window()->SetShortcutHandlingSuspended(suspended); | 108 registry_for_active_window()->SetShortcutHandlingSuspended(suspended); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ExtensionCommandsGlobalRegistry::OnKeyPressed( | 111 void ExtensionCommandsGlobalRegistry::OnKeyPressed( |
| 112 const ui::Accelerator& accelerator) { | 112 const ui::Accelerator& accelerator) { |
| 113 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator); | 113 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace extensions | 116 } // namespace extensions |
| OLD | NEW |