summaryrefslogtreecommitdiffstats
path: root/views/controls/button
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 19:22:26 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 19:22:26 +0000
commitd6d6d586d2a91d13d06a8bce53a2d03f2458f9c2 (patch)
treef662039f70110c555ec6fb096b389b73af31af2d /views/controls/button
parent7587ee0fa4399ed0485559559b0ee9228daf0337 (diff)
downloadchromium_src-d6d6d586d2a91d13d06a8bce53a2d03f2458f9c2.zip
chromium_src-d6d6d586d2a91d13d06a8bce53a2d03f2458f9c2.tar.gz
chromium_src-d6d6d586d2a91d13d06a8bce53a2d03f2458f9c2.tar.bz2
Converts some uses of native_view to native_window. This is necessitated
by wanting to parent bookmarkeditor to browserwindow, which returns a native_window. BUG=none TEST=none Review URL: http://codereview.chromium.org/270067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button')
-rw-r--r--views/controls/button/menu_button.cc27
1 files changed, 7 insertions, 20 deletions
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index 5b353f3..7f1daf7 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -13,12 +13,10 @@
#include "views/controls/button/button.h"
#include "views/controls/menu/view_menu_delegate.h"
#include "views/event.h"
+#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
+#include "views/window/window.h"
using base::Time;
using base::TimeDelta;
@@ -105,25 +103,14 @@ void MenuButton::Paint(gfx::Canvas* canvas, bool for_drag) {
////////////////////////////////////////////////////////////////////////////////
int MenuButton::GetMaximumScreenXCoordinate() {
- Widget* widget = GetWidget();
-
- if (!widget) {
+ if (!GetWindow()) {
NOTREACHED();
return 0;
}
-#if defined(OS_WIN)
- HWND hwnd = widget->GetNativeView();
- RECT t;
- ::GetWindowRect(hwnd, &t);
-
- gfx::Rect r(t);
- gfx::Rect monitor_rect = win_util::GetMonitorBoundsForRect(r);
- return monitor_rect.x() + monitor_rect.width() - 1;
-#else
- NOTIMPLEMENTED();
- return 1000000;
-#endif
+ gfx::Rect monitor_bounds =
+ Screen::GetMonitorWorkAreaNearestWindow(GetWindow()->GetNativeWindow());
+ return monitor_bounds.right() - 1;
}
bool MenuButton::Activate() {
@@ -162,7 +149,7 @@ bool MenuButton::Activate() {
GetRootView()->SetMouseHandler(NULL);
menu_visible_ = true;
- menu_delegate_->RunMenu(this, menu_position, GetWidget()->GetNativeView());
+ menu_delegate_->RunMenu(this, menu_position);
menu_visible_ = false;
menu_closed_time_ = Time::Now();