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

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

Issue 10201016: Conflict detection for Extension Keybinding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/extension_browser_event_router.h" 7 #include "chrome/browser/extensions/extension_browser_event_router.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 24 matching lines...) Expand all
35 const GdkEventKey* event) const { 35 const GdkEventKey* event) const {
36 ui::AcceleratorGtk accelerator(ui::WindowsKeyCodeForGdkKeyCode(event->keyval), 36 ui::AcceleratorGtk accelerator(ui::WindowsKeyCodeForGdkKeyCode(event->keyval),
37 event->state & GDK_SHIFT_MASK, 37 event->state & GDK_SHIFT_MASK,
38 event->state & GDK_CONTROL_MASK, 38 event->state & GDK_CONTROL_MASK,
39 event->state & GDK_MOD1_MASK); 39 event->state & GDK_MOD1_MASK);
40 return event_targets_.find(accelerator) != event_targets_.end(); 40 return event_targets_.find(accelerator) != event_targets_.end();
41 } 41 }
42 42
43 void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding( 43 void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding(
44 const Extension* extension) { 44 const Extension* extension) {
45 // Add all the keybindings (except pageAction and browserAction, which are 45 // Add all the active keybindings (except page actions and browser actions,
46 // handled elsewhere). 46 // which are handled elsewhere).
47 const Extension::CommandMap& commands = extension->named_commands(); 47 const Extension::CommandMap& commands =
48 GetActiveNamedCommands(profile_, extension->id());
48 Extension::CommandMap::const_iterator iter = commands.begin(); 49 Extension::CommandMap::const_iterator iter = commands.begin();
49 for (; iter != commands.end(); ++iter) { 50 for (; iter != commands.end(); ++iter) {
50 ui::AcceleratorGtk accelerator(iter->second.accelerator().key_code(), 51 ui::AcceleratorGtk accelerator(iter->second.accelerator().key_code(),
51 iter->second.accelerator().IsShiftDown(), 52 iter->second.accelerator().IsShiftDown(),
52 iter->second.accelerator().IsCtrlDown(), 53 iter->second.accelerator().IsCtrlDown(),
53 iter->second.accelerator().IsAltDown()); 54 iter->second.accelerator().IsAltDown());
54 event_targets_[accelerator] = 55 event_targets_[accelerator] =
55 std::make_pair(extension->id(), iter->second.command_name()); 56 std::make_pair(extension->id(), iter->second.command_name());
56 57
57 if (ShouldIgnoreCommand(iter->second.command_name())) 58 if (ShouldIgnoreCommand(iter->second.command_name()))
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (it == event_targets_.end()) { 108 if (it == event_targets_.end()) {
108 NOTREACHED(); // Shouldn't get this event for something not registered. 109 NOTREACHED(); // Shouldn't get this event for something not registered.
109 return FALSE; 110 return FALSE;
110 } 111 }
111 112
112 service->browser_event_router()->CommandExecuted( 113 service->browser_event_router()->CommandExecuted(
113 profile_, it->second.first, it->second.second); 114 profile_, it->second.first, it->second.second);
114 115
115 return TRUE; 116 return TRUE;
116 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698