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

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

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: fixes Created 4 years, 11 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 10b2cd914e768af579dec903fc6996c741838c10..2b59970339145d3271f7b57c9a51be1957a2b6b7 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -889,7 +889,7 @@ ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent(
void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) {
if (submenu->IsShowing()) {
- gfx::Point point = GetScreen()->GetCursorScreenPoint();
+ gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint();
const SubmenuView* root_submenu =
submenu->GetMenuItem()->GetRootMenuItem()->GetSubmenu();
View::ConvertPointFromScreen(
@@ -1235,14 +1235,16 @@ void MenuController::UpdateInitialLocation(const gfx::Rect& bounds,
// 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 = GetScreen()->GetDisplayNearestPoint(
- bounds.origin()).work_area();
+ pending_state_.monitor_bounds = gfx::Screen::GetScreen()
+ ->GetDisplayNearestPoint(bounds.origin())
+ .work_area();
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 = GetScreen()->GetDisplayNearestPoint(
- bounds.origin()).bounds();
+ gfx::Rect monitor_area = gfx::Screen::GetScreen()
+ ->GetDisplayNearestPoint(bounds.origin())
+ .bounds();
if (monitor_area.Contains(bounds))
pending_state_.monitor_bounds = monitor_area;
}
@@ -1275,7 +1277,8 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source,
return false;
}
- gfx::NativeWindow window_under_mouse = GetScreen()->GetWindowUnderCursor();
+ gfx::NativeWindow window_under_mouse =
+ gfx::Screen::GetScreen()->GetWindowUnderCursor();
// TODO(oshima): Replace with views only API.
if (!owner_ || window_under_mouse != owner_->GetNativeWindow())
return false;
@@ -2272,7 +2275,7 @@ void MenuController::RepostEventAndCancel(SubmenuView* source,
gfx::NativeView native_view = source->GetWidget()->GetNativeView();
gfx::NativeWindow window = nullptr;
if (native_view) {
- gfx::Screen* screen = gfx::Screen::GetScreenFor(native_view);
+ gfx::Screen* screen = gfx::Screen::GetScreen();
window = screen->GetWindowAtScreenPoint(screen_loc);
}
@@ -2568,10 +2571,4 @@ void MenuController::HandleMouseLocation(SubmenuView* source,
}
}
-gfx::Screen* MenuController::GetScreen() {
- Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
- return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
- : gfx::Screen::GetNativeScreen();
-}
-
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698