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

Side by Side Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 10446010: wip: Add ui::EventType parameter. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wip - views_unittests Created 8 years, 7 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 | « chrome/browser/ui/views/web_dialog_view.cc ('k') | chrome/common/extensions/command.cc » ('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) 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/views/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DISALLOW_COPY_AND_ASSIGN(ScheduleAllView); 286 DISALLOW_COPY_AND_ASSIGN(ScheduleAllView);
287 }; 287 };
288 288
289 string16 GetAccessibleNameForWrenchMenuItem( 289 string16 GetAccessibleNameForWrenchMenuItem(
290 MenuModel* model, int item_index, int accessible_string_id) { 290 MenuModel* model, int item_index, int accessible_string_id) {
291 string16 accessible_name = l10n_util::GetStringUTF16(accessible_string_id); 291 string16 accessible_name = l10n_util::GetStringUTF16(accessible_string_id);
292 string16 accelerator_text; 292 string16 accelerator_text;
293 293
294 ui::Accelerator menu_accelerator; 294 ui::Accelerator menu_accelerator;
295 if (model->GetAcceleratorAt(item_index, &menu_accelerator)) { 295 if (model->GetAcceleratorAt(item_index, &menu_accelerator)) {
296 accelerator_text = 296 accelerator_text = ui::Accelerator(menu_accelerator.key_code(),
297 ui::Accelerator(menu_accelerator.key_code(), 297 menu_accelerator.modifiers(),
298 menu_accelerator.modifiers()).GetShortcutText(); 298 ui::ET_KEY_PRESSED).GetShortcutText();
299 } 299 }
300 300
301 return MenuItemView::GetAccessibleNameForMenuItem( 301 return MenuItemView::GetAccessibleNameForMenuItem(
302 accessible_name, accelerator_text); 302 accessible_name, accelerator_text);
303 } 303 }
304 304
305 // WrenchMenuView is a view that can contain text buttons. 305 // WrenchMenuView is a view that can contain text buttons.
306 class WrenchMenuView : public ScheduleAllView, public views::ButtonListener { 306 class WrenchMenuView : public ScheduleAllView, public views::ButtonListener {
307 public: 307 public:
308 WrenchMenuView(WrenchMenu* menu, MenuModel* menu_model) 308 WrenchMenuView(WrenchMenu* menu, MenuModel* menu_model)
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (command_id == IDC_CUT || command_id == IDC_ZOOM_MINUS) { 807 if (command_id == IDC_CUT || command_id == IDC_ZOOM_MINUS) {
808 // These have special child views; don't show the accelerator for them. 808 // These have special child views; don't show the accelerator for them.
809 return false; 809 return false;
810 } 810 }
811 811
812 ui::Accelerator menu_accelerator; 812 ui::Accelerator menu_accelerator;
813 if (!entry.first->GetAcceleratorAt(entry.second, &menu_accelerator)) 813 if (!entry.first->GetAcceleratorAt(entry.second, &menu_accelerator))
814 return false; 814 return false;
815 815
816 *accelerator = ui::Accelerator(menu_accelerator.key_code(), 816 *accelerator = ui::Accelerator(menu_accelerator.key_code(),
817 menu_accelerator.modifiers()); 817 menu_accelerator.modifiers(),
818 ui::ET_KEY_PRESSED);
818 return true; 819 return true;
819 } 820 }
820 821
821 void WrenchMenu::WillShowMenu(MenuItemView* menu) { 822 void WrenchMenu::WillShowMenu(MenuItemView* menu) {
822 if (menu == bookmark_menu_) 823 if (menu == bookmark_menu_)
823 CreateBookmarkMenu(); 824 CreateBookmarkMenu();
824 } 825 }
825 826
826 void WrenchMenu::WillHideMenu(MenuItemView* menu) { 827 void WrenchMenu::WillHideMenu(MenuItemView* menu) {
827 // Turns off the fade out animation of the wrench menus if 828 // Turns off the fade out animation of the wrench menus if
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 bookmark_menu_delegate_.reset( 961 bookmark_menu_delegate_.reset(
961 new BookmarkMenuDelegate(browser_->profile(), 962 new BookmarkMenuDelegate(browser_->profile(),
962 NULL, 963 NULL,
963 parent, 964 parent,
964 first_bookmark_command_id_)); 965 first_bookmark_command_id_));
965 bookmark_menu_delegate_->Init( 966 bookmark_menu_delegate_->Init(
966 this, bookmark_menu_, model->bookmark_bar_node(), 0, 967 this, bookmark_menu_, model->bookmark_bar_node(), 0,
967 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 968 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
968 bookmark_utils::LAUNCH_WRENCH_MENU); 969 bookmark_utils::LAUNCH_WRENCH_MENU);
969 } 970 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/web_dialog_view.cc ('k') | chrome/common/extensions/command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698