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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 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: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 7fbccfb223b8e7d5e2df0610efa01d083c8ee63a..16eaf09a6b49ac70258066a2e869336d54a098ad 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -704,7 +704,7 @@ void MenuController::OnDragExitedScrollButton(SubmenuView* source) {
void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) {
if (submenu->IsShowing()) {
- gfx::Point point = gfx::Screen::GetCursorScreenPoint();
+ gfx::Point point = GetScreen()->GetCursorScreenPoint();
const SubmenuView* root_submenu =
submenu->GetMenuItem()->GetRootMenuItem()->GetSubmenu();
views::View::ConvertPointFromScreen(
@@ -1108,14 +1108,14 @@ void MenuController::UpdateInitialLocation(
// Calculate the bounds of the monitor we'll show menus on. Do this once to
// avoid repeated system queries for the info.
- pending_state_.monitor_bounds = gfx::Screen::GetDisplayNearestPoint(
+ pending_state_.monitor_bounds = GetScreen()->GetDisplayNearestPoint(
bounds.origin()).work_area();
#if defined(USE_ASH)
if (!pending_state_.monitor_bounds.Contains(bounds)) {
// Use the monitor area if the work area doesn't contain the bounds. This
// handles showing a menu from the launcher.
- gfx::Rect monitor_area =
- gfx::Screen::GetDisplayNearestPoint(bounds.origin()).bounds();
+ gfx::Rect monitor_area = GetScreen()->GetDisplayNearestPoint(
+ bounds.origin()).bounds();
if (monitor_area.Contains(bounds))
pending_state_.monitor_bounds = monitor_area;
}
@@ -1149,7 +1149,7 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source,
}
gfx::NativeWindow window_under_mouse =
- gfx::Screen::GetWindowAtCursorScreenPoint();
+ GetScreen()->GetWindowAtCursorScreenPoint();
// TODO(oshima): Replace with views only API.
if (window_under_mouse != owner_->GetNativeWindow())
return false;
@@ -2134,4 +2134,12 @@ void MenuController::OnWindowActivated(aura::Window* active,
}
#endif
+gfx::Screen* MenuController::GetScreen() const {
+#if defined(USE_AURA)
+ return gfx::Screen::GetScreenFor(root_window_);
+#else
+ return gfx::Screen::GetNativeScreen();
+#endif
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698