summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/frame/browser_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/frame/browser_view.cc')
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 3ebe1d7..e7a1c9c 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -449,7 +449,15 @@ void BrowserView::ButtonPressed(views::Button* sender,
// views::ContextMenuController overrides.
void BrowserView::ShowContextMenu(views::View* source, int x, int y,
bool is_mouse_gesture) {
- system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
+ // Only show context menu if point is in unobscured parts of browser, i.e.
+ // if NonClientHitTest returns :
+ // - HTCAPTION: in title bar or unobscured part of tabstrip
+ // - HTNOWHERE: as the name implies.
+ gfx::Point point_in_parent_coords(x, y);
+ views::View::ConvertPointToView(NULL, GetParent(), &point_in_parent_coords);
+ int hit_test = NonClientHitTest(point_in_parent_coords);
+ if (hit_test == HTCAPTION || hit_test == HTNOWHERE)
+ system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
}
// StatusAreaHost overrides.