Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome/browser/extensions/extension_commands_global_registry.cc

Issue 553243002: Track the active ExtensionKeybindingRegistry and make it available to EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Address more comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 ExtensionCommandsGlobalRegistry::ExtensionCommandsGlobalRegistry( 14 ExtensionCommandsGlobalRegistry::ExtensionCommandsGlobalRegistry(
15 content::BrowserContext* context) 15 content::BrowserContext* context)
16 : ExtensionKeybindingRegistry(context, 16 : ExtensionKeybindingRegistry(context,
17 ExtensionKeybindingRegistry::ALL_EXTENSIONS, 17 ExtensionKeybindingRegistry::ALL_EXTENSIONS,
18 NULL), 18 NULL),
19 browser_context_(context) { 19 browser_context_(context),
20 active_registry_(NULL) {
20 Init(); 21 Init();
21 } 22 }
22 23
23 ExtensionCommandsGlobalRegistry::~ExtensionCommandsGlobalRegistry() { 24 ExtensionCommandsGlobalRegistry::~ExtensionCommandsGlobalRegistry() {
24 if (!IsEventTargetsEmpty()) { 25 if (!IsEventTargetsEmpty()) {
25 GlobalShortcutListener* global_shortcut_listener = 26 GlobalShortcutListener* global_shortcut_listener =
26 GlobalShortcutListener::GetInstance(); 27 GlobalShortcutListener::GetInstance();
27 28
28 // Resume GlobalShortcutListener before we clean up if the shortcut handling 29 // Resume GlobalShortcutListener before we clean up if the shortcut handling
29 // is currently suspended. 30 // is currently suspended.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 GlobalShortcutListener::GetInstance()->UnregisterAccelerator( 105 GlobalShortcutListener::GetInstance()->UnregisterAccelerator(
105 accelerator, this); 106 accelerator, this);
106 } 107 }
107 108
108 void ExtensionCommandsGlobalRegistry::OnKeyPressed( 109 void ExtensionCommandsGlobalRegistry::OnKeyPressed(
109 const ui::Accelerator& accelerator) { 110 const ui::Accelerator& accelerator) {
110 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator); 111 ExtensionKeybindingRegistry::NotifyEventTargets(accelerator);
111 } 112 }
112 113
113 } // namespace extensions 114 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698