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

Unified Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 9456013: ABANDONED: Focus the content when the wrench menu disappears. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698