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

Side by Side Diff: chrome/browser/gtk/accelerators_gtk.cc

Issue 569022: Merge 37725 - GTK: Make page and app menus shortcut control flow match window... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/307/src/
Patch Set: Created 10 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/accelerators_gtk.h" 5 #include "chrome/browser/gtk/accelerators_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <X11/XF86keysym.h> 9 #include <X11/XF86keysym.h>
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 { GDK_Delete, IDC_CLEAR_BROWSING_DATA, 155 { GDK_Delete, IDC_CLEAR_BROWSING_DATA,
156 GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, 156 GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
157 { GDK_h, IDC_SHOW_HISTORY, GDK_CONTROL_MASK }, 157 { GDK_h, IDC_SHOW_HISTORY, GDK_CONTROL_MASK },
158 { GDK_j, IDC_SHOW_DOWNLOADS, GDK_CONTROL_MASK }, 158 { GDK_j, IDC_SHOW_DOWNLOADS, GDK_CONTROL_MASK },
159 { GDK_F1, IDC_HELP_PAGE, GdkModifierType(0) }, 159 { GDK_F1, IDC_HELP_PAGE, GdkModifierType(0) },
160 { XF86XK_AddFavorite, IDC_BOOKMARK_PAGE, GdkModifierType(0) }, 160 { XF86XK_AddFavorite, IDC_BOOKMARK_PAGE, GdkModifierType(0) },
161 { XF86XK_Favorites, IDC_SHOW_BOOKMARK_BAR, GdkModifierType(0) }, 161 { XF86XK_Favorites, IDC_SHOW_BOOKMARK_BAR, GdkModifierType(0) },
162 { XF86XK_History, IDC_SHOW_HISTORY, GdkModifierType(0) }, 162 { XF86XK_History, IDC_SHOW_HISTORY, GdkModifierType(0) },
163 { GDK_q, IDC_EXIT, GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, 163 { GDK_q, IDC_EXIT, GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
164 { GDK_s, IDC_SAVE_PAGE, GDK_CONTROL_MASK }, 164 { GDK_s, IDC_SAVE_PAGE, GDK_CONTROL_MASK },
165 { GDK_e, IDC_SHOW_PAGE_MENU, GDK_MOD1_MASK },
166 { GDK_f, IDC_SHOW_APP_MENU, GDK_MOD1_MASK },
165 }; 167 };
166 168
167 } // namespace 169 } // namespace
168 170
169 AcceleratorsGtk::AcceleratorsGtk() { 171 AcceleratorsGtk::AcceleratorsGtk() {
170 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) { 172 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) {
171 int command_id = kAcceleratorMap[i].command_id; 173 int command_id = kAcceleratorMap[i].command_id;
172 menus::AcceleratorGtk accelerator(kAcceleratorMap[i].keyval, 174 menus::AcceleratorGtk accelerator(kAcceleratorMap[i].keyval,
173 kAcceleratorMap[i].modifier_type); 175 kAcceleratorMap[i].modifier_type);
174 all_accelerators_.push_back( 176 all_accelerators_.push_back(
175 std::pair<int, menus::AcceleratorGtk>(command_id, accelerator)); 177 std::pair<int, menus::AcceleratorGtk>(command_id, accelerator));
176 178
177 if (primary_accelerators_.find(command_id) == 179 if (primary_accelerators_.find(command_id) ==
178 primary_accelerators_.end()) { 180 primary_accelerators_.end()) {
179 primary_accelerators_[command_id] = accelerator; 181 primary_accelerators_[command_id] = accelerator;
180 } 182 }
181 } 183 }
182 } 184 }
183 185
184 const menus::AcceleratorGtk* AcceleratorsGtk::GetPrimaryAcceleratorForCommand( 186 const menus::AcceleratorGtk* AcceleratorsGtk::GetPrimaryAcceleratorForCommand(
185 int command_id) { 187 int command_id) {
186 base::hash_map<int, menus::AcceleratorGtk>::const_iterator iter = 188 base::hash_map<int, menus::AcceleratorGtk>::const_iterator iter =
187 primary_accelerators_.find(command_id); 189 primary_accelerators_.find(command_id);
188 190
189 if (iter == primary_accelerators_.end()) 191 if (iter == primary_accelerators_.end())
190 return NULL; 192 return NULL;
191 193
192 return &iter->second; 194 return &iter->second;
193 } 195 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698