Chromium Code Reviews| Index: chrome/browser/ui/views/wrench_menu.cc |
| diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc |
| index 47f1cfdd1e5956712c5c965a43503c0779737227..998ec04cbcfef5966596e4570dc79fa4330b2cac 100644 |
| --- a/chrome/browser/ui/views/wrench_menu.cc |
| +++ b/chrome/browser/ui/views/wrench_menu.cc |
| @@ -15,7 +15,9 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/browser/ui/view_ids.h" |
| #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" |
| +#include "chrome/browser/ui/views/frame/browser_view.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "content/public/browser/host_zoom_map.h" |
| #include "content/public/browser/notification_observer.h" |
| @@ -607,6 +609,15 @@ void WrenchMenu::RunMenu(views::MenuButton* host) { |
| views::View::ConvertPointToScreen(host, &screen_loc); |
| gfx::Rect bounds(screen_loc, host->size()); |
| content::RecordAction(UserMetricsAction("ShowAppMenu")); |
| + if (host->GetFocusManager()->GetFocusedView() == host) { |
| + // If the app-menu has the focus, then move the focus to the content before |
| + // showing the menu. |
| + BrowserWindow* window = browser_->window(); |
| + views::View* view = reinterpret_cast<BrowserView*>(window)-> |
| + GetViewByID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); |
| + if (view) |
| + view->GetFocusManager()->SetFocusedView(view); |
| + } |
|
sadrul
2012/02/23 14:51:24
An alternate option is to expose GetTabContentsCon
|
| if (menu_runner_->RunMenuAt(host->GetWidget(), host, bounds, |
| MenuItemView::TOPRIGHT, views::MenuRunner::HAS_MNEMONICS) == |
| views::MenuRunner::MENU_DELETED) |