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

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 1544803004: Fix accelerator handling for in-menu buttons in the app menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/views/toolbar/app_menu.h" 5 #include "chrome/browser/ui/views/toolbar/app_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 views::Button::STATE_PRESSED, 294 views::Button::STATE_PRESSED,
295 theme->GetSystemColor( 295 theme->GetSystemColor(
296 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor)); 296 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor));
297 SetTextColor( 297 SetTextColor(
298 views::Button::STATE_NORMAL, 298 views::Button::STATE_NORMAL,
299 theme->GetSystemColor( 299 theme->GetSystemColor(
300 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor)); 300 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor));
301 } 301 }
302 } 302 }
303 303
304 // views::CustomButton
305 bool ShouldHandleAcceleratorWhenInactive() override {
306 // Menu buttons are inactive, so handle accelerator presses when inactive.
307 return true;
308 }
309
304 private: 310 private:
305 InMenuButtonBackground* in_menu_background_; 311 InMenuButtonBackground* in_menu_background_;
306 312
307 DISALLOW_COPY_AND_ASSIGN(InMenuButton); 313 DISALLOW_COPY_AND_ASSIGN(InMenuButton);
308 }; 314 };
309 315
310 // AppMenuView is a view that can contain label buttons. 316 // AppMenuView is a view that can contain label buttons.
311 class AppMenuView : public views::View, 317 class AppMenuView : public views::View,
312 public views::ButtonListener, 318 public views::ButtonListener,
313 public AppMenuObserver { 319 public AppMenuObserver {
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 0, 1268 0,
1263 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1269 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1264 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); 1270 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU);
1265 } 1271 }
1266 1272
1267 int AppMenu::ModelIndexFromCommandId(int command_id) const { 1273 int AppMenu::ModelIndexFromCommandId(int command_id) const {
1268 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); 1274 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id);
1269 DCHECK(ix != command_id_to_entry_.end()); 1275 DCHECK(ix != command_id_to_entry_.end());
1270 return ix->second.second; 1276 return ix->second.second;
1271 } 1277 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/custom_button.h » ('j') | ui/views/controls/button/custom_button.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698