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

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc

Issue 10880064: Make extension commands grant the activeTab permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/api/commands/command_service.h" 7 #include "chrome/browser/extensions/api/commands/command_service.h"
8 #include "chrome/browser/extensions/api/commands/command_service_factory.h" 8 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
9 #include "chrome/browser/extensions/browser_event_router.h"
10 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
13 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" 12 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
14 13
15 // static 14 // static
16 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended( 15 void extensions::ExtensionKeybindingRegistry::SetShortcutHandlingSuspended(
17 bool suspended) { 16 bool suspended) {
18 ExtensionKeybindingRegistryGtk::set_shortcut_handling_suspended(suspended); 17 ExtensionKeybindingRegistryGtk::set_shortcut_handling_suspended(suspended);
19 } 18 }
20 19
21 bool ExtensionKeybindingRegistryGtk::shortcut_handling_suspended_ = false; 20 bool ExtensionKeybindingRegistryGtk::shortcut_handling_suspended_ = false;
22 21
23 ExtensionKeybindingRegistryGtk::ExtensionKeybindingRegistryGtk( 22 ExtensionKeybindingRegistryGtk::ExtensionKeybindingRegistryGtk(
24 Profile* profile, 23 Profile* profile,
25 gfx::NativeWindow window, 24 gfx::NativeWindow window,
26 ExtensionFilter extension_filter) 25 ExtensionFilter extension_filter,
27 : ExtensionKeybindingRegistry(profile, extension_filter), 26 Delegate* delegate)
27 : ExtensionKeybindingRegistry(profile, extension_filter, delegate),
28 profile_(profile), 28 profile_(profile),
29 window_(window), 29 window_(window),
30 accel_group_(NULL) { 30 accel_group_(NULL) {
31 Init(); 31 Init();
32 } 32 }
33 33
34 ExtensionKeybindingRegistryGtk::~ExtensionKeybindingRegistryGtk() { 34 ExtensionKeybindingRegistryGtk::~ExtensionKeybindingRegistryGtk() {
35 if (accel_group_) { 35 if (accel_group_) {
36 gtk_accel_group_disconnect(accel_group_, 36 gtk_accel_group_disconnect(accel_group_,
37 NULL); // Remove all closures. 37 NULL); // Remove all closures.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 } 164 }
165 165
166 gboolean ExtensionKeybindingRegistryGtk::OnGtkAccelerator( 166 gboolean ExtensionKeybindingRegistryGtk::OnGtkAccelerator(
167 GtkAccelGroup* group, 167 GtkAccelGroup* group,
168 GObject* acceleratable, 168 GObject* acceleratable,
169 guint keyval, 169 guint keyval,
170 GdkModifierType modifier) { 170 GdkModifierType modifier) {
171 ui::AcceleratorGtk accelerator(keyval, modifier); 171 ui::AcceleratorGtk accelerator(keyval, modifier);
172 172
173 ExtensionService* service = profile_->GetExtensionService();
174
175 EventTargets::iterator it = event_targets_.find(accelerator); 173 EventTargets::iterator it = event_targets_.find(accelerator);
176 if (it == event_targets_.end()) { 174 if (it == event_targets_.end()) {
177 NOTREACHED(); // Shouldn't get this event for something not registered. 175 NOTREACHED(); // Shouldn't get this event for something not registered.
178 return FALSE; 176 return FALSE;
179 } 177 }
180 178
181 service->browser_event_router()->CommandExecuted( 179 CommandExecuted(it->second.first, it->second.second);
182 profile_, it->second.first, it->second.second);
183
184 return TRUE; 180 return TRUE;
185 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698