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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 10540123: Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 // Reverse anchor position for RTL languages. 1093 // Reverse anchor position for RTL languages.
1094 if (base::i18n::IsRTL()) { 1094 if (base::i18n::IsRTL()) {
1095 pending_state_.anchor = position == MenuItemView::TOPRIGHT ? 1095 pending_state_.anchor = position == MenuItemView::TOPRIGHT ?
1096 MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT; 1096 MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT;
1097 } else { 1097 } else {
1098 pending_state_.anchor = position; 1098 pending_state_.anchor = position;
1099 } 1099 }
1100 1100
1101 // Calculate the bounds of the monitor we'll show menus on. Do this once to 1101 // Calculate the bounds of the monitor we'll show menus on. Do this once to
1102 // avoid repeated system queries for the info. 1102 // avoid repeated system queries for the info.
1103 pending_state_.monitor_bounds = gfx::Screen::GetMonitorNearestPoint( 1103 pending_state_.monitor_bounds = gfx::Screen::GetDisplayNearestPoint(
1104 bounds.origin()).work_area(); 1104 bounds.origin()).work_area();
1105 #if defined(USE_ASH) 1105 #if defined(USE_ASH)
1106 if (!pending_state_.monitor_bounds.Contains(bounds)) { 1106 if (!pending_state_.monitor_bounds.Contains(bounds)) {
1107 // Use the monitor area if the work area doesn't contain the bounds. This 1107 // Use the monitor area if the work area doesn't contain the bounds. This
1108 // handles showing a menu from the launcher. 1108 // handles showing a menu from the launcher.
1109 gfx::Rect monitor_area = 1109 gfx::Rect monitor_area =
1110 gfx::Screen::GetMonitorNearestPoint(bounds.origin()).bounds(); 1110 gfx::Screen::GetDisplayNearestPoint(bounds.origin()).bounds();
1111 if (monitor_area.Contains(bounds)) 1111 if (monitor_area.Contains(bounds))
1112 pending_state_.monitor_bounds = monitor_area; 1112 pending_state_.monitor_bounds = monitor_area;
1113 } 1113 }
1114 #endif 1114 #endif
1115 } 1115 }
1116 1116
1117 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { 1117 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) {
1118 DCHECK(IsBlockingRun()); 1118 DCHECK(IsBlockingRun());
1119 result_ = item; 1119 result_ = item;
1120 if (item && !menu_stack_.empty() && 1120 if (item && !menu_stack_.empty() &&
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 (!pending_state_.item->HasSubmenu() || 2116 (!pending_state_.item->HasSubmenu() ||
2117 !pending_state_.item->GetSubmenu()->IsShowing())) { 2117 !pending_state_.item->GetSubmenu()->IsShowing())) {
2118 // On exit if the user hasn't selected an item with a submenu, move the 2118 // On exit if the user hasn't selected an item with a submenu, move the
2119 // selection back to the parent menu item. 2119 // selection back to the parent menu item.
2120 SetSelection(pending_state_.item->GetParentMenuItem(), 2120 SetSelection(pending_state_.item->GetParentMenuItem(),
2121 SELECTION_OPEN_SUBMENU); 2121 SELECTION_OPEN_SUBMENU);
2122 } 2122 }
2123 } 2123 }
2124 2124
2125 } // namespace views 2125 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698