OLD | NEW |
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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
29 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
30 #include "ui/gfx/point.h" | 30 #include "ui/gfx/point.h" |
31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
32 #include "ui/gfx/vector2d.h" | 32 #include "ui/gfx/vector2d.h" |
33 #include "ui/native_theme/native_theme.h" | 33 #include "ui/native_theme/native_theme.h" |
34 #include "ui/views/controls/button/menu_button.h" | 34 #include "ui/views/controls/button/menu_button.h" |
35 #include "ui/views/controls/menu/menu_config.h" | 35 #include "ui/views/controls/menu/menu_config.h" |
36 #include "ui/views/controls/menu/menu_controller_delegate.h" | 36 #include "ui/views/controls/menu/menu_controller_delegate.h" |
37 #include "ui/views/controls/menu/menu_host_root_view.h" | 37 #include "ui/views/controls/menu/menu_host_root_view.h" |
| 38 #include "ui/views/controls/menu/menu_item_view.h" |
38 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 39 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
39 #include "ui/views/controls/menu/submenu_view.h" | 40 #include "ui/views/controls/menu/submenu_view.h" |
40 #include "ui/views/drag_utils.h" | 41 #include "ui/views/drag_utils.h" |
41 #include "ui/views/focus/view_storage.h" | 42 #include "ui/views/focus/view_storage.h" |
42 #include "ui/views/mouse_constants.h" | 43 #include "ui/views/mouse_constants.h" |
43 #include "ui/views/view.h" | 44 #include "ui/views/view.h" |
44 #include "ui/views/view_constants.h" | 45 #include "ui/views/view_constants.h" |
45 #include "ui/views/views_delegate.h" | 46 #include "ui/views/views_delegate.h" |
46 #include "ui/views/widget/root_view.h" | 47 #include "ui/views/widget/root_view.h" |
47 #include "ui/views/widget/tooltip_manager.h" | 48 #include "ui/views/widget/tooltip_manager.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // currently selected item whose mnemonic matches. This may remain -1 even | 340 // currently selected item whose mnemonic matches. This may remain -1 even |
340 // though there are matches. | 341 // though there are matches. |
341 int next_match; | 342 int next_match; |
342 }; | 343 }; |
343 | 344 |
344 // MenuController:State ------------------------------------------------------ | 345 // MenuController:State ------------------------------------------------------ |
345 | 346 |
346 MenuController::State::State() | 347 MenuController::State::State() |
347 : item(NULL), | 348 : item(NULL), |
348 submenu_open(false), | 349 submenu_open(false), |
349 anchor(MenuItemView::TOPLEFT), | 350 anchor(MENU_ANCHOR_TOPLEFT), |
350 context_menu(false) {} | 351 context_menu(false) { |
| 352 } |
351 | 353 |
352 MenuController::State::~State() {} | 354 MenuController::State::~State() {} |
353 | 355 |
354 // MenuController ------------------------------------------------------------ | 356 // MenuController ------------------------------------------------------------ |
355 | 357 |
356 // static | 358 // static |
357 MenuController* MenuController::active_instance_ = NULL; | 359 MenuController* MenuController::active_instance_ = NULL; |
358 | 360 |
359 // static | 361 // static |
360 MenuController* MenuController::GetActiveInstance() { | 362 MenuController* MenuController::GetActiveInstance() { |
361 return active_instance_; | 363 return active_instance_; |
362 } | 364 } |
363 | 365 |
364 MenuItemView* MenuController::Run(Widget* parent, | 366 MenuItemView* MenuController::Run(Widget* parent, |
365 MenuButton* button, | 367 MenuButton* button, |
366 MenuItemView* root, | 368 MenuItemView* root, |
367 const gfx::Rect& bounds, | 369 const gfx::Rect& bounds, |
368 MenuItemView::AnchorPosition position, | 370 MenuAnchorPosition position, |
369 bool context_menu, | 371 bool context_menu, |
370 int* result_event_flags) { | 372 int* result_event_flags) { |
371 exit_type_ = EXIT_NONE; | 373 exit_type_ = EXIT_NONE; |
372 possible_drag_ = false; | 374 possible_drag_ = false; |
373 drag_in_progress_ = false; | 375 drag_in_progress_ = false; |
374 closing_event_time_ = base::TimeDelta(); | 376 closing_event_time_ = base::TimeDelta(); |
375 menu_start_time_ = base::TimeTicks::Now(); | 377 menu_start_time_ = base::TimeTicks::Now(); |
376 menu_start_mouse_press_loc_ = gfx::Point(); | 378 menu_start_mouse_press_loc_ = gfx::Point(); |
377 | 379 |
378 // If we are shown on mouse press, we will eat the subsequent mouse down and | 380 // If we are shown on mouse press, we will eat the subsequent mouse down and |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 return ACCELERATOR_NOT_PROCESSED; | 1227 return ACCELERATOR_NOT_PROCESSED; |
1226 | 1228 |
1227 ui::Accelerator accelerator(ui::VKEY_RETURN, ui::EF_NONE); | 1229 ui::Accelerator accelerator(ui::VKEY_RETURN, ui::EF_NONE); |
1228 hot_view->AcceleratorPressed(accelerator); | 1230 hot_view->AcceleratorPressed(accelerator); |
1229 CustomButton* button = static_cast<CustomButton*>(hot_view); | 1231 CustomButton* button = static_cast<CustomButton*>(hot_view); |
1230 button->SetHotTracked(true); | 1232 button->SetHotTracked(true); |
1231 return (exit_type_ == EXIT_NONE) ? | 1233 return (exit_type_ == EXIT_NONE) ? |
1232 ACCELERATOR_PROCESSED : ACCELERATOR_PROCESSED_EXIT; | 1234 ACCELERATOR_PROCESSED : ACCELERATOR_PROCESSED_EXIT; |
1233 } | 1235 } |
1234 | 1236 |
1235 void MenuController::UpdateInitialLocation( | 1237 void MenuController::UpdateInitialLocation(const gfx::Rect& bounds, |
1236 const gfx::Rect& bounds, | 1238 MenuAnchorPosition position, |
1237 MenuItemView::AnchorPosition position, | 1239 bool context_menu) { |
1238 bool context_menu) { | |
1239 pending_state_.context_menu = context_menu; | 1240 pending_state_.context_menu = context_menu; |
1240 pending_state_.initial_bounds = bounds; | 1241 pending_state_.initial_bounds = bounds; |
1241 if (bounds.height() > 1) { | 1242 if (bounds.height() > 1) { |
1242 // Inset the bounds slightly, otherwise drag coordinates don't line up | 1243 // Inset the bounds slightly, otherwise drag coordinates don't line up |
1243 // nicely and menus close prematurely. | 1244 // nicely and menus close prematurely. |
1244 pending_state_.initial_bounds.Inset(0, 1); | 1245 pending_state_.initial_bounds.Inset(0, 1); |
1245 } | 1246 } |
1246 | 1247 |
1247 // Reverse anchor position for RTL languages. | 1248 // Reverse anchor position for RTL languages. |
1248 if (base::i18n::IsRTL() && | 1249 if (base::i18n::IsRTL() && |
1249 (position == MenuItemView::TOPRIGHT || | 1250 (position == MENU_ANCHOR_TOPRIGHT || position == MENU_ANCHOR_TOPLEFT)) { |
1250 position == MenuItemView::TOPLEFT)) { | 1251 pending_state_.anchor = position == MENU_ANCHOR_TOPRIGHT |
1251 pending_state_.anchor = position == MenuItemView::TOPRIGHT ? | 1252 ? MENU_ANCHOR_TOPLEFT |
1252 MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT; | 1253 : MENU_ANCHOR_TOPRIGHT; |
1253 } else { | 1254 } else { |
1254 pending_state_.anchor = position; | 1255 pending_state_.anchor = position; |
1255 } | 1256 } |
1256 | 1257 |
1257 // Calculate the bounds of the monitor we'll show menus on. Do this once to | 1258 // Calculate the bounds of the monitor we'll show menus on. Do this once to |
1258 // avoid repeated system queries for the info. | 1259 // avoid repeated system queries for the info. |
1259 pending_state_.monitor_bounds = GetScreen()->GetDisplayNearestPoint( | 1260 pending_state_.monitor_bounds = GetScreen()->GetDisplayNearestPoint( |
1260 bounds.origin()).work_area(); | 1261 bounds.origin()).work_area(); |
1261 #if defined(USE_ASH) | 1262 #if defined(USE_ASH) |
1262 if (!pending_state_.monitor_bounds.Contains(bounds)) { | 1263 if (!pending_state_.monitor_bounds.Contains(bounds)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 | 1299 |
1299 gfx::NativeWindow window_under_mouse = GetScreen()->GetWindowUnderCursor(); | 1300 gfx::NativeWindow window_under_mouse = GetScreen()->GetWindowUnderCursor(); |
1300 // TODO(oshima): Replace with views only API. | 1301 // TODO(oshima): Replace with views only API. |
1301 if (!owner_ || window_under_mouse != owner_->GetNativeWindow()) | 1302 if (!owner_ || window_under_mouse != owner_->GetNativeWindow()) |
1302 return false; | 1303 return false; |
1303 | 1304 |
1304 // The user moved the mouse outside the menu and over the owning window. See | 1305 // The user moved the mouse outside the menu and over the owning window. See |
1305 // if there is a sibling menu we should show. | 1306 // if there is a sibling menu we should show. |
1306 gfx::Point screen_point(mouse_location); | 1307 gfx::Point screen_point(mouse_location); |
1307 View::ConvertPointToScreen(source_view, &screen_point); | 1308 View::ConvertPointToScreen(source_view, &screen_point); |
1308 MenuItemView::AnchorPosition anchor; | 1309 MenuAnchorPosition anchor; |
1309 bool has_mnemonics; | 1310 bool has_mnemonics; |
1310 MenuButton* button = NULL; | 1311 MenuButton* button = NULL; |
1311 MenuItemView* alt_menu = source->GetMenuItem()->GetDelegate()-> | 1312 MenuItemView* alt_menu = source->GetMenuItem()->GetDelegate()-> |
1312 GetSiblingMenu(source->GetMenuItem()->GetRootMenuItem(), | 1313 GetSiblingMenu(source->GetMenuItem()->GetRootMenuItem(), |
1313 screen_point, &anchor, &has_mnemonics, &button); | 1314 screen_point, &anchor, &has_mnemonics, &button); |
1314 if (!alt_menu || (state_.item && state_.item->GetRootMenuItem() == alt_menu)) | 1315 if (!alt_menu || (state_.item && state_.item->GetRootMenuItem() == alt_menu)) |
1315 return false; | 1316 return false; |
1316 | 1317 |
1317 delegate_->SiblingMenuCreated(alt_menu); | 1318 delegate_->SiblingMenuCreated(alt_menu); |
1318 | 1319 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 if (!item->GetParentMenuItem()) { | 1723 if (!item->GetParentMenuItem()) { |
1723 // First item, position relative to initial location. | 1724 // First item, position relative to initial location. |
1724 x = state_.initial_bounds.x(); | 1725 x = state_.initial_bounds.x(); |
1725 | 1726 |
1726 // Offsets for context menu prevent menu items being selected by | 1727 // Offsets for context menu prevent menu items being selected by |
1727 // simply opening the menu (bug 142992). | 1728 // simply opening the menu (bug 142992). |
1728 if (menu_config.offset_context_menus && state_.context_menu) | 1729 if (menu_config.offset_context_menus && state_.context_menu) |
1729 x += 1; | 1730 x += 1; |
1730 | 1731 |
1731 y = state_.initial_bounds.bottom(); | 1732 y = state_.initial_bounds.bottom(); |
1732 if (state_.anchor == MenuItemView::TOPRIGHT) { | 1733 if (state_.anchor == MENU_ANCHOR_TOPRIGHT) { |
1733 x = x + state_.initial_bounds.width() - pref.width(); | 1734 x = x + state_.initial_bounds.width() - pref.width(); |
1734 if (menu_config.offset_context_menus && state_.context_menu) | 1735 if (menu_config.offset_context_menus && state_.context_menu) |
1735 x -= 1; | 1736 x -= 1; |
1736 } else if (state_.anchor == MenuItemView::BOTTOMCENTER) { | 1737 } else if (state_.anchor == MENU_ANCHOR_BOTTOMCENTER) { |
1737 x = x - (pref.width() - state_.initial_bounds.width()) / 2; | 1738 x = x - (pref.width() - state_.initial_bounds.width()) / 2; |
1738 if (pref.height() > | 1739 if (pref.height() > |
1739 state_.initial_bounds.y() + kCenteredContextMenuYOffset) { | 1740 state_.initial_bounds.y() + kCenteredContextMenuYOffset) { |
1740 // Menu does not fit above the anchor. We move it to below. | 1741 // Menu does not fit above the anchor. We move it to below. |
1741 y = state_.initial_bounds.y() - kCenteredContextMenuYOffset; | 1742 y = state_.initial_bounds.y() - kCenteredContextMenuYOffset; |
1742 } else { | 1743 } else { |
1743 y = std::max(0, state_.initial_bounds.y() - pref.height()) + | 1744 y = std::max(0, state_.initial_bounds.y() - pref.height()) + |
1744 kCenteredContextMenuYOffset; | 1745 kCenteredContextMenuYOffset; |
1745 } | 1746 } |
1746 } | 1747 } |
(...skipping 28 matching lines...) Expand all Loading... |
1775 orientation = MenuItemView::POSITION_ABOVE_BOUNDS; | 1776 orientation = MenuItemView::POSITION_ABOVE_BOUNDS; |
1776 } else { | 1777 } else { |
1777 // It is allowed to move the menu a bit around in order to get the | 1778 // It is allowed to move the menu a bit around in order to get the |
1778 // best fit and to avoid showing scroll elements. | 1779 // best fit and to avoid showing scroll elements. |
1779 y = state_.monitor_bounds.bottom() - pref.height(); | 1780 y = state_.monitor_bounds.bottom() - pref.height(); |
1780 } | 1781 } |
1781 if (orientation == MenuItemView::POSITION_BELOW_BOUNDS) { | 1782 if (orientation == MenuItemView::POSITION_BELOW_BOUNDS) { |
1782 // The menu should never overlap the owning button. So move it. | 1783 // The menu should never overlap the owning button. So move it. |
1783 // We use the anchor view style to determine the preferred position | 1784 // We use the anchor view style to determine the preferred position |
1784 // relative to the owning button. | 1785 // relative to the owning button. |
1785 if (state_.anchor == MenuItemView::TOPLEFT) { | 1786 if (state_.anchor == MENU_ANCHOR_TOPLEFT) { |
1786 // The menu starts with the same x coordinate as the owning button. | 1787 // The menu starts with the same x coordinate as the owning button. |
1787 if (x + state_.initial_bounds.width() + pref.width() > | 1788 if (x + state_.initial_bounds.width() + pref.width() > |
1788 state_.monitor_bounds.right()) | 1789 state_.monitor_bounds.right()) |
1789 x -= pref.width(); // Move the menu to the left of the button. | 1790 x -= pref.width(); // Move the menu to the left of the button. |
1790 else | 1791 else |
1791 x += state_.initial_bounds.width(); // Move the menu right. | 1792 x += state_.initial_bounds.width(); // Move the menu right. |
1792 } else { | 1793 } else { |
1793 // The menu should end with the same x coordinate as the owning | 1794 // The menu should end with the same x coordinate as the owning |
1794 // button. | 1795 // button. |
1795 if (state_.monitor_bounds.x() > | 1796 if (state_.monitor_bounds.x() > |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 | 1889 |
1889 gfx::Size pref = submenu->GetScrollViewContainer()->GetPreferredSize(); | 1890 gfx::Size pref = submenu->GetScrollViewContainer()->GetPreferredSize(); |
1890 const gfx::Rect& owner_bounds = pending_state_.initial_bounds; | 1891 const gfx::Rect& owner_bounds = pending_state_.initial_bounds; |
1891 | 1892 |
1892 // First the size gets reduced to the possible space. | 1893 // First the size gets reduced to the possible space. |
1893 if (!state_.monitor_bounds.IsEmpty()) { | 1894 if (!state_.monitor_bounds.IsEmpty()) { |
1894 int max_width = state_.monitor_bounds.width(); | 1895 int max_width = state_.monitor_bounds.width(); |
1895 int max_height = state_.monitor_bounds.height(); | 1896 int max_height = state_.monitor_bounds.height(); |
1896 // In case of bubbles, the maximum width is limited by the space | 1897 // In case of bubbles, the maximum width is limited by the space |
1897 // between the display corner and the target area + the tip size. | 1898 // between the display corner and the target area + the tip size. |
1898 if (state_.anchor == MenuItemView::BUBBLE_LEFT) { | 1899 if (state_.anchor == MENU_ANCHOR_BUBBLE_LEFT) { |
1899 max_width = owner_bounds.x() - state_.monitor_bounds.x() + | 1900 max_width = owner_bounds.x() - state_.monitor_bounds.x() + |
1900 kBubbleTipSizeLeftRight; | 1901 kBubbleTipSizeLeftRight; |
1901 } else if (state_.anchor == MenuItemView::BUBBLE_RIGHT) { | 1902 } else if (state_.anchor == MENU_ANCHOR_BUBBLE_RIGHT) { |
1902 max_width = state_.monitor_bounds.right() - owner_bounds.right() + | 1903 max_width = state_.monitor_bounds.right() - owner_bounds.right() + |
1903 kBubbleTipSizeLeftRight; | 1904 kBubbleTipSizeLeftRight; |
1904 } else if (state_.anchor == MenuItemView::BUBBLE_ABOVE) { | 1905 } else if (state_.anchor == MENU_ANCHOR_BUBBLE_ABOVE) { |
1905 max_height = owner_bounds.y() - state_.monitor_bounds.y() + | 1906 max_height = owner_bounds.y() - state_.monitor_bounds.y() + |
1906 kBubbleTipSizeTopBottom; | 1907 kBubbleTipSizeTopBottom; |
1907 } else if (state_.anchor == MenuItemView::BUBBLE_BELOW) { | 1908 } else if (state_.anchor == MENU_ANCHOR_BUBBLE_BELOW) { |
1908 max_height = state_.monitor_bounds.bottom() - owner_bounds.bottom() + | 1909 max_height = state_.monitor_bounds.bottom() - owner_bounds.bottom() + |
1909 kBubbleTipSizeTopBottom; | 1910 kBubbleTipSizeTopBottom; |
1910 } | 1911 } |
1911 // The space for the menu to cover should never get empty. | 1912 // The space for the menu to cover should never get empty. |
1912 DCHECK_GE(max_width, kBubbleTipSizeLeftRight); | 1913 DCHECK_GE(max_width, kBubbleTipSizeLeftRight); |
1913 DCHECK_GE(max_height, kBubbleTipSizeTopBottom); | 1914 DCHECK_GE(max_height, kBubbleTipSizeTopBottom); |
1914 pref.set_width(std::min(pref.width(), max_width)); | 1915 pref.set_width(std::min(pref.width(), max_width)); |
1915 pref.set_height(std::min(pref.height(), max_height)); | 1916 pref.set_height(std::min(pref.height(), max_height)); |
1916 } | 1917 } |
1917 // Also make sure that the menu does not go too wide. | 1918 // Also make sure that the menu does not go too wide. |
1918 pref.set_width(std::min(pref.width(), | 1919 pref.set_width(std::min(pref.width(), |
1919 item->GetDelegate()->GetMaxWidthForMenu(item))); | 1920 item->GetDelegate()->GetMaxWidthForMenu(item))); |
1920 | 1921 |
1921 int x, y; | 1922 int x, y; |
1922 if (state_.anchor == MenuItemView::BUBBLE_ABOVE || | 1923 if (state_.anchor == MENU_ANCHOR_BUBBLE_ABOVE || |
1923 state_.anchor == MenuItemView::BUBBLE_BELOW) { | 1924 state_.anchor == MENU_ANCHOR_BUBBLE_BELOW) { |
1924 if (state_.anchor == MenuItemView::BUBBLE_ABOVE) | 1925 if (state_.anchor == MENU_ANCHOR_BUBBLE_ABOVE) |
1925 y = owner_bounds.y() - pref.height() + kBubbleTipSizeTopBottom; | 1926 y = owner_bounds.y() - pref.height() + kBubbleTipSizeTopBottom; |
1926 else | 1927 else |
1927 y = owner_bounds.bottom() - kBubbleTipSizeTopBottom; | 1928 y = owner_bounds.bottom() - kBubbleTipSizeTopBottom; |
1928 | 1929 |
1929 x = owner_bounds.CenterPoint().x() - pref.width() / 2; | 1930 x = owner_bounds.CenterPoint().x() - pref.width() / 2; |
1930 int x_old = x; | 1931 int x_old = x; |
1931 if (x < state_.monitor_bounds.x()) { | 1932 if (x < state_.monitor_bounds.x()) { |
1932 x = state_.monitor_bounds.x(); | 1933 x = state_.monitor_bounds.x(); |
1933 } else if (x + pref.width() > state_.monitor_bounds.right()) { | 1934 } else if (x + pref.width() > state_.monitor_bounds.right()) { |
1934 x = state_.monitor_bounds.right() - pref.width(); | 1935 x = state_.monitor_bounds.right() - pref.width(); |
1935 } | 1936 } |
1936 submenu->GetScrollViewContainer()->SetBubbleArrowOffset( | 1937 submenu->GetScrollViewContainer()->SetBubbleArrowOffset( |
1937 pref.width() / 2 - x + x_old); | 1938 pref.width() / 2 - x + x_old); |
1938 } else { | 1939 } else { |
1939 if (state_.anchor == MenuItemView::BUBBLE_RIGHT) | 1940 if (state_.anchor == MENU_ANCHOR_BUBBLE_RIGHT) |
1940 x = owner_bounds.right() - kBubbleTipSizeLeftRight; | 1941 x = owner_bounds.right() - kBubbleTipSizeLeftRight; |
1941 else | 1942 else |
1942 x = owner_bounds.x() - pref.width() + kBubbleTipSizeLeftRight; | 1943 x = owner_bounds.x() - pref.width() + kBubbleTipSizeLeftRight; |
1943 | 1944 |
1944 y = owner_bounds.CenterPoint().y() - pref.height() / 2; | 1945 y = owner_bounds.CenterPoint().y() - pref.height() / 2; |
1945 int y_old = y; | 1946 int y_old = y; |
1946 if (y < state_.monitor_bounds.y()) { | 1947 if (y < state_.monitor_bounds.y()) { |
1947 y = state_.monitor_bounds.y(); | 1948 y = state_.monitor_bounds.y(); |
1948 } else if (y + pref.height() > state_.monitor_bounds.bottom()) { | 1949 } else if (y + pref.height() > state_.monitor_bounds.bottom()) { |
1949 y = state_.monitor_bounds.bottom() - pref.height(); | 1950 y = state_.monitor_bounds.bottom() - pref.height(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 } | 2429 } |
2429 } | 2430 } |
2430 | 2431 |
2431 gfx::Screen* MenuController::GetScreen() { | 2432 gfx::Screen* MenuController::GetScreen() { |
2432 aura::Window* root = GetOwnerRootWindow(owner_); | 2433 aura::Window* root = GetOwnerRootWindow(owner_); |
2433 return root ? gfx::Screen::GetScreenFor(root) | 2434 return root ? gfx::Screen::GetScreenFor(root) |
2434 : gfx::Screen::GetNativeScreen(); | 2435 : gfx::Screen::GetNativeScreen(); |
2435 } | 2436 } |
2436 | 2437 |
2437 } // namespace views | 2438 } // namespace views |
OLD | NEW |