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/extensions/extension_keybinding_registry.h" | 5 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 8 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/extensions/command.h" | 10 #include "chrome/common/extensions/command.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 ExtensionKeybindingRegistry::ExtensionKeybindingRegistry( | 24 ExtensionKeybindingRegistry::ExtensionKeybindingRegistry( |
25 content::BrowserContext* context, | 25 content::BrowserContext* context, |
26 ExtensionFilter extension_filter, | 26 ExtensionFilter extension_filter, |
27 Delegate* delegate) | 27 Delegate* delegate) |
28 : browser_context_(context), | 28 : browser_context_(context), |
29 extension_filter_(extension_filter), | 29 extension_filter_(extension_filter), |
30 delegate_(delegate), | 30 delegate_(delegate), |
31 extension_registry_observer_(this) { | 31 extension_registry_observer_(this), |
32 shortcut_handling_suspended_(false) { | |
32 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); | 33 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); |
33 | 34 |
34 Profile* profile = Profile::FromBrowserContext(browser_context_); | 35 Profile* profile = Profile::FromBrowserContext(browser_context_); |
35 registrar_.Add(this, | 36 registrar_.Add(this, |
36 extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED, | 37 extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED, |
37 content::Source<Profile>(profile->GetOriginalProfile())); | 38 content::Source<Profile>(profile->GetOriginalProfile())); |
38 registrar_.Add(this, | 39 registrar_.Add(this, |
39 extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, | 40 extensions::NOTIFICATION_EXTENSION_COMMAND_REMOVED, |
40 content::Source<Profile>(profile->GetOriginalProfile())); | 41 content::Source<Profile>(profile->GetOriginalProfile())); |
41 } | 42 } |
42 | 43 |
43 ExtensionKeybindingRegistry::~ExtensionKeybindingRegistry() { | 44 ExtensionKeybindingRegistry::~ExtensionKeybindingRegistry() { |
44 } | 45 } |
45 | 46 |
47 void ExtensionKeybindingRegistry::set_shortcut_handling_suspended( | |
Finnur
2015/01/16 10:05:05
nit: Should not be unix_hacker style (calls virtua
Devlin
2015/01/16 15:49:55
I probably caused this confusion; I only meant tha
Andre
2015/01/16 18:40:15
Done.
| |
48 bool suspended) { | |
49 shortcut_handling_suspended_ = suspended; | |
50 OnShortcutHandlingSuspended(suspended); | |
51 } | |
52 | |
53 bool ExtensionKeybindingRegistry::shortcut_handling_suspended() const { | |
54 return shortcut_handling_suspended_; | |
55 } | |
56 | |
46 void ExtensionKeybindingRegistry::RemoveExtensionKeybinding( | 57 void ExtensionKeybindingRegistry::RemoveExtensionKeybinding( |
47 const Extension* extension, | 58 const Extension* extension, |
48 const std::string& command_name) { | 59 const std::string& command_name) { |
49 EventTargets::iterator it = event_targets_.begin(); | 60 EventTargets::iterator it = event_targets_.begin(); |
50 while (it != event_targets_.end()) { | 61 while (it != event_targets_.end()) { |
51 TargetList& target_list = it->second; | 62 TargetList& target_list = it->second; |
52 TargetList::iterator target = target_list.begin(); | 63 TargetList::iterator target = target_list.begin(); |
53 while (target != target_list.end()) { | 64 while (target != target_list.end()) { |
54 if (target->first == extension->id() && | 65 if (target->first == extension->id() && |
55 (command_name.empty() || command_name == target->second)) | 66 (command_name.empty() || command_name == target->second)) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 if (extension_id.empty() || it->first == extension_id) { | 259 if (extension_id.empty() || it->first == extension_id) { |
249 CommandExecuted(it->first, it->second); | 260 CommandExecuted(it->first, it->second); |
250 executed = true; | 261 executed = true; |
251 } | 262 } |
252 } | 263 } |
253 | 264 |
254 return executed; | 265 return executed; |
255 } | 266 } |
256 | 267 |
257 } // namespace extensions | 268 } // namespace extensions |
OLD | NEW |