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

Unified Diff: views/controls/button/menu_button.cc

Issue 270067: Converts some uses of native_view to native_window. This is necessitated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
Index: views/controls/button/menu_button.cc
===================================================================
--- views/controls/button/menu_button.cc (revision 28706)
+++ views/controls/button/menu_button.cc (working copy)
@@ -13,13 +13,11 @@
#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"
+#include "views/window/window.h"
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
-
using base::Time;
using base::TimeDelta;
@@ -105,25 +103,14 @@
////////////////////////////////////////////////////////////////////////////////
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 @@
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();

Powered by Google App Engine
This is Rietveld 408576698