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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // not set the delegate as it deals only with named commands (not page/browser | 113 // not set the delegate as it deals only with named commands (not page/browser |
114 // actions that are associated with the current page directly). | 114 // actions that are associated with the current page directly). |
115 ActiveTabPermissionGranter* granter = | 115 ActiveTabPermissionGranter* granter = |
116 delegate_ ? delegate_->GetActiveTabPermissionGranter() : NULL; | 116 delegate_ ? delegate_->GetActiveTabPermissionGranter() : NULL; |
117 if (granter) | 117 if (granter) |
118 granter->GrantIfRequested(extension); | 118 granter->GrantIfRequested(extension); |
119 | 119 |
120 scoped_ptr<base::ListValue> args(new base::ListValue()); | 120 scoped_ptr<base::ListValue> args(new base::ListValue()); |
121 args->Append(new base::StringValue(command)); | 121 args->Append(new base::StringValue(command)); |
122 | 122 |
123 scoped_ptr<Event> event(new Event(kOnCommandEventName, args.Pass())); | 123 scoped_ptr<Event> event( |
| 124 new Event(events::UNKNOWN, kOnCommandEventName, args.Pass())); |
124 event->restrict_to_browser_context = browser_context_; | 125 event->restrict_to_browser_context = browser_context_; |
125 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; | 126 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
126 EventRouter::Get(browser_context_) | 127 EventRouter::Get(browser_context_) |
127 ->DispatchEventToExtension(extension_id, event.Pass()); | 128 ->DispatchEventToExtension(extension_id, event.Pass()); |
128 } | 129 } |
129 | 130 |
130 bool ExtensionKeybindingRegistry::IsAcceleratorRegistered( | 131 bool ExtensionKeybindingRegistry::IsAcceleratorRegistered( |
131 const ui::Accelerator& accelerator) const { | 132 const ui::Accelerator& accelerator) const { |
132 return event_targets_.find(accelerator) != event_targets_.end(); | 133 return event_targets_.find(accelerator) != event_targets_.end(); |
133 } | 134 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 if (extension_id.empty() || it->first == extension_id) { | 255 if (extension_id.empty() || it->first == extension_id) { |
255 CommandExecuted(it->first, it->second); | 256 CommandExecuted(it->first, it->second); |
256 executed = true; | 257 executed = true; |
257 } | 258 } |
258 } | 259 } |
259 | 260 |
260 return executed; | 261 return executed; |
261 } | 262 } |
262 | 263 |
263 } // namespace extensions | 264 } // namespace extensions |
OLD | NEW |