OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/app_menu_button_win.h" | 5 #include "chrome/browser/ui/views/app_menu_button_win.h" |
6 | 6 |
7 #include "ui/base/win/hwnd_util.h" | 7 #include "ui/base/win/hwnd_util.h" |
8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
9 | 9 |
10 AppMenuButtonWin::AppMenuButtonWin(views::MenuButtonListener* listener) | 10 AppMenuButtonWin::AppMenuButtonWin(views::MenuButtonListener* listener) |
11 : views::MenuButton(NULL, string16(), listener, false) { | 11 : views::MenuButton(NULL, string16(), listener, false) { |
12 } | 12 } |
13 | 13 |
14 bool AppMenuButtonWin::OnKeyPressed(const views::KeyEvent& event) { | 14 bool AppMenuButtonWin::OnKeyPressed(const views::KeyEvent& event) { |
15 if (event.key_code() == ui::VKEY_SPACE) { | 15 if (event.key_code() == ui::VKEY_SPACE) { |
16 // Typical windows behavior is to show the system menu on space. | 16 // Typical windows behavior is to show the system menu on space. |
17 views::Widget* widget = GetWidget(); | 17 views::Widget* widget = GetWidget(); |
18 gfx::Rect bounds = widget->GetClientAreaScreenBounds(); | 18 gfx::Rect bounds = widget->GetClientAreaBoundsInScreen(); |
19 ui::ShowSystemMenu(widget->GetNativeView(), bounds.x(), bounds.y() + 10); | 19 ui::ShowSystemMenu(widget->GetNativeView(), bounds.x(), bounds.y() + 10); |
20 return false; | 20 return false; |
21 } | 21 } |
22 return views::MenuButton::OnKeyPressed(event); | 22 return views::MenuButton::OnKeyPressed(event); |
23 } | 23 } |
OLD | NEW |