From d6d6d586d2a91d13d06a8bce53a2d03f2458f9c2 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Mon, 12 Oct 2009 19:22:26 +0000 Subject: 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 --- views/controls/button/menu_button.cc | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'views/controls/button') 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(); -- cgit v1.1