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

Side by Side Diff: views/controls/menu/menu_item_view.cc

Issue 7825024: For Touch: remove some menu items for experimentation, adjust sizes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reverted blank line suppression Created 9 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
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/menu_item_view_linux.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 controller_(NULL), 80 controller_(NULL),
81 canceled_(false), 81 canceled_(false),
82 parent_menu_item_(NULL), 82 parent_menu_item_(NULL),
83 type_(SUBMENU), 83 type_(SUBMENU),
84 selected_(false), 84 selected_(false),
85 command_(0), 85 command_(0),
86 submenu_(NULL), 86 submenu_(NULL),
87 has_mnemonics_(false), 87 has_mnemonics_(false),
88 show_mnemonics_(false), 88 show_mnemonics_(false),
89 has_icons_(false), 89 has_icons_(false),
90 #ifdef TOUCH_UI
sky 2011/09/02 22:30:10 This should be in MenuConfig, which is the central
Emmanuel Saint-loubert-Bié 2011/09/02 23:04:37 Thanks, I did not know/realize that.
91 show_accelerators_(false),
92 #else
93 show_accelerators_(true),
94 #endif
90 top_margin_(-1), 95 top_margin_(-1),
91 bottom_margin_(-1), 96 bottom_margin_(-1),
92 requested_menu_position_(POSITION_BEST_FIT), 97 requested_menu_position_(POSITION_BEST_FIT),
93 actual_menu_position_(requested_menu_position_) { 98 actual_menu_position_(requested_menu_position_) {
94 // NOTE: don't check the delegate for NULL, UpdateMenuPartSizes supplies a 99 // NOTE: don't check the delegate for NULL, UpdateMenuPartSizes supplies a
95 // NULL delegate. 100 // NULL delegate.
96 Init(NULL, 0, SUBMENU, delegate); 101 Init(NULL, 0, SUBMENU, delegate);
97 } 102 }
98 103
99 void MenuItemView::ChildPreferredSizeChanged(View* child) { 104 void MenuItemView::ChildPreferredSizeChanged(View* child) {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (i) 682 if (i)
678 width += kChildXPadding; 683 width += kChildXPadding;
679 width += child_at(i)->GetPreferredSize().width(); 684 width += child_at(i)->GetPreferredSize().width();
680 } 685 }
681 // Return a height of 0 to indicate that we should use the title height 686 // Return a height of 0 to indicate that we should use the title height
682 // instead. 687 // instead.
683 return gfx::Size(width, 0); 688 return gfx::Size(width, 0);
684 } 689 }
685 690
686 string16 MenuItemView::GetAcceleratorText() { 691 string16 MenuItemView::GetAcceleratorText() {
687 if (id() == kEmptyMenuItemViewID) { 692 if (id() == kEmptyMenuItemViewID || !show_accelerators_) {
688 // Don't query the delegate for menus that represent no children. 693 // Don't query the delegate for menus that represent no children, or
694 // when accelerators are not shown return an empty string.
689 return string16(); 695 return string16();
690 } 696 }
691 697
692 Accelerator accelerator; 698 Accelerator accelerator;
693 return (GetDelegate() && 699 return (GetDelegate() &&
694 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ? 700 GetDelegate()->GetAccelerator(GetCommand(), &accelerator)) ?
695 accelerator.GetShortcutText() : string16(); 701 accelerator.GetShortcutText() : string16();
696 } 702 }
697 703
698 } // namespace views 704 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/menu_item_view_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698