summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-22 18:08:59 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-22 18:08:59 +0000
commit968e176577ac4fe102ce66987eb97e037f67796f (patch)
treede1070f3579808b13e3a20992adbdb39675eaf06
parent560ee3b14dbe02a85c73aeb2829f60864451d906 (diff)
downloadchromium_src-968e176577ac4fe102ce66987eb97e037f67796f.zip
chromium_src-968e176577ac4fe102ce66987eb97e037f67796f.tar.gz
chromium_src-968e176577ac4fe102ce66987eb97e037f67796f.tar.bz2
Reverts fix for 2554.
Review URL: http://codereview.chromium.org/4017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2445 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/bookmark_bar_context_menu_controller.cc2
-rw-r--r--chrome/browser/views/tabs/tab.cc2
-rw-r--r--chrome/views/chrome_menu.cc28
-rw-r--r--chrome/views/chrome_menu.h12
4 files changed, 13 insertions, 31 deletions
diff --git a/chrome/browser/bookmark_bar_context_menu_controller.cc b/chrome/browser/bookmark_bar_context_menu_controller.cc
index 8bce486..cb195ef 100644
--- a/chrome/browser/bookmark_bar_context_menu_controller.cc
+++ b/chrome/browser/bookmark_bar_context_menu_controller.cc
@@ -237,7 +237,7 @@ void BookmarkBarContextMenuController::RunMenuAt(int x, int y) {
// width/height don't matter here.
menu_.RunMenuAt(view_->GetViewContainer()->GetHWND(), gfx::Rect(x, y, 0, 0),
- ChromeViews::MenuItemView::TOPLEFT, true);
+ ChromeViews::MenuItemView::TOPLEFT, false);
if (view_->GetModelChangedListener() == this)
view_->SetModelChangedListener(last_listener);
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc
index 8a283bf..82bb795 100644
--- a/chrome/browser/views/tabs/tab.cc
+++ b/chrome/browser/views/tabs/tab.cc
@@ -54,7 +54,7 @@ class TabContextMenuController : public ChromeViews::MenuDelegate {
void RunMenuAt(int x, int y) {
menu_->RunMenuAt(tab_->GetViewContainer()->GetHWND(),
gfx::Rect(x, y, 0, 0), ChromeViews::MenuItemView::TOPLEFT,
- true);
+ false);
}
private:
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc
index 537503f..360f8c4 100644
--- a/chrome/views/chrome_menu.cc
+++ b/chrome/views/chrome_menu.cc
@@ -103,9 +103,6 @@ static const int kScrollTimerMS = 30;
// Preferred height of menu items. Reset every time a menu is run.
static int pref_menu_height;
-// Are mnemonics shown? This is updated before the menus are shown.
-static bool show_mnemonics;
-
using gfx::NativeTheme;
namespace ChromeViews {
@@ -1072,8 +1069,8 @@ MenuItemView::~MenuItemView() {
void MenuItemView::RunMenuAt(HWND parent,
const gfx::Rect& bounds,
AnchorPosition anchor,
- bool has_mnemonics) {
- PrepareForRun(has_mnemonics);
+ bool show_mnemonics) {
+ PrepareForRun(show_mnemonics);
int mouse_event_flags;
@@ -1193,9 +1190,6 @@ MenuItemView* MenuItemView::GetRootMenuItem() {
}
wchar_t MenuItemView::GetMnemonic() {
- if (!has_mnemonics_)
- return 0;
-
const std::wstring& title = GetTitle();
size_t index = 0;
do {
@@ -1291,7 +1285,7 @@ void MenuItemView::DropMenuClosed(bool notify_delegate) {
// WARNING: its possible the delegate deleted us at this point.
}
-void MenuItemView::PrepareForRun(bool has_mnemonics) {
+void MenuItemView::PrepareForRun(bool show_mnemonics) {
// Currently we only support showing the root.
DCHECK(!parent_menu_item_);
@@ -1303,16 +1297,11 @@ void MenuItemView::PrepareForRun(bool has_mnemonics) {
canceled_ = false;
- has_mnemonics_ = has_mnemonics;
+ show_mnemonics_ = show_mnemonics;
AddEmptyMenus();
UpdateMenuPartSizes();
-
- BOOL show_cues;
- show_mnemonics =
- (SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &show_cues, 0) &&
- show_cues == TRUE);
}
int MenuItemView::GetDrawStringFlags() {
@@ -1322,13 +1311,8 @@ int MenuItemView::GetDrawStringFlags() {
else
flags |= ChromeCanvas::TEXT_ALIGN_LEFT;
- if (has_mnemonics_) {
- if (show_mnemonics)
- flags |= ChromeCanvas::SHOW_PREFIX;
- else
- flags |= ChromeCanvas::HIDE_PREFIX;
- }
- return flags;
+ return flags |
+ (show_mnemonics_ ? ChromeCanvas::SHOW_PREFIX : ChromeCanvas::HIDE_PREFIX);
}
void MenuItemView::AddEmptyMenus() {
diff --git a/chrome/views/chrome_menu.h b/chrome/views/chrome_menu.h
index b192c9c..05cce11 100644
--- a/chrome/views/chrome_menu.h
+++ b/chrome/views/chrome_menu.h
@@ -238,13 +238,11 @@ class MenuItemView : public View {
virtual ~MenuItemView();
// Run methods. See description above class for details. Both Run methods take
- // a rectangle, which is used to position the menu. |has_mnemonics| indicates
- // whether the items have mnemonics. Mnemonics are identified by way of the
- // character following the '&'.
+ // a rectangle, which is used to position the menu.
void RunMenuAt(HWND parent,
const gfx::Rect& bounds,
AnchorPosition anchor,
- bool has_mnemonics);
+ bool show_mnemonics);
void RunMenuForDropAt(HWND parent,
const gfx::Rect& bounds,
AnchorPosition anchor);
@@ -399,7 +397,7 @@ class MenuItemView : public View {
// The RunXXX methods call into this to set up the necessary state before
// running.
- void PrepareForRun(bool has_mnemonics);
+ void PrepareForRun(bool show_mnemonics);
// Returns the flags passed to DrawStringInt.
int GetDrawStringFlags();
@@ -461,8 +459,8 @@ class MenuItemView : public View {
// Icon.
SkBitmap icon_;
- // Does the title have a mnemonic?
- bool has_mnemonics_;
+ // Whether mnemonics should be shown.
+ bool show_mnemonics_;
DISALLOW_EVIL_CONSTRUCTORS(MenuItemView);
};