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

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 new addition 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
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/scrollbar/base_scroll_bar_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8d33dede81f2a0aa49686c4ad499f9774aeaca0b..87eeca412ac7f76fe7d140fd056dcc9b6cd60084 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;
@@ -2135,4 +2135,12 @@ void MenuController::OnWindowActivated(aura::Window* active,
}
#endif
+gfx::Screen* MenuController::GetScreen() {
+#if defined(USE_AURA)
+ return gfx::Screen::GetScreenFor(root_window_);
+#else
+ return gfx::Screen::GetNativeScreen();
+#endif
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/scrollbar/base_scroll_bar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698