| 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 #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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 35 #include "ui/views/view_constants.h" | 35 #include "ui/views/view_constants.h" |
| 36 #include "ui/views/views_delegate.h" | 36 #include "ui/views/views_delegate.h" |
| 37 #include "ui/views/widget/root_view.h" | 37 #include "ui/views/widget/root_view.h" |
| 38 #include "ui/views/widget/tooltip_manager.h" | 38 #include "ui/views/widget/tooltip_manager.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "ui/aura/window_tree_host.h" | 42 #include "ui/aura/window_tree_host.h" |
| 43 #include "ui/base/win/internal_constants.h" | 43 #include "ui/base/win/internal_constants.h" |
| 44 #include "ui/gfx/win/dpi.h" | 44 #include "ui/gfx/screen_win.h" |
| 45 #include "ui/views/win/hwnd_util.h" | 45 #include "ui/views/win/hwnd_util.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 #if defined(USE_AURA) | 48 #if defined(USE_AURA) |
| 49 #include "ui/views/controls/menu/menu_key_event_handler.h" | 49 #include "ui/views/controls/menu/menu_key_event_handler.h" |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 using base::Time; | 52 using base::Time; |
| 53 using base::TimeDelta; | 53 using base::TimeDelta; |
| 54 using ui::OSExchangeData; | 54 using ui::OSExchangeData; |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 return; | 2202 return; |
| 2203 } | 2203 } |
| 2204 | 2204 |
| 2205 state_.item->GetRootMenuItem()->GetSubmenu()->ReleaseCapture(); | 2205 state_.item->GetRootMenuItem()->GetSubmenu()->ReleaseCapture(); |
| 2206 #endif | 2206 #endif |
| 2207 | 2207 |
| 2208 if (!native_view) | 2208 if (!native_view) |
| 2209 return; | 2209 return; |
| 2210 | 2210 |
| 2211 #if defined(OS_WIN) | 2211 #if defined(OS_WIN) |
| 2212 gfx::Point screen_loc_pixels = gfx::win::DIPToScreenPoint(screen_loc); | 2212 gfx::Point screen_loc_pixels = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
| 2213 HWND target_window = ::WindowFromPoint(screen_loc_pixels.ToPOINT()); | 2213 HWND target_window = ::WindowFromPoint(screen_loc_pixels.ToPOINT()); |
| 2214 // If we don't find a native window for the HWND at the current location, | 2214 // If we don't find a native window for the HWND at the current location, |
| 2215 // then attempt to find a native window from its parent if one exists. | 2215 // then attempt to find a native window from its parent if one exists. |
| 2216 // There are HWNDs created outside views, which don't have associated | 2216 // There are HWNDs created outside views, which don't have associated |
| 2217 // native windows. | 2217 // native windows. |
| 2218 if (!window) { | 2218 if (!window) { |
| 2219 HWND parent = ::GetParent(target_window); | 2219 HWND parent = ::GetParent(target_window); |
| 2220 if (parent) { | 2220 if (parent) { |
| 2221 aura::WindowTreeHost* host = | 2221 aura::WindowTreeHost* host = |
| 2222 aura::WindowTreeHost::GetForAcceleratedWidget(parent); | 2222 aura::WindowTreeHost::GetForAcceleratedWidget(parent); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2591 (!pending_state_.item->HasSubmenu() || | 2591 (!pending_state_.item->HasSubmenu() || |
| 2592 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2592 !pending_state_.item->GetSubmenu()->IsShowing())) { |
| 2593 // On exit if the user hasn't selected an item with a submenu, move the | 2593 // On exit if the user hasn't selected an item with a submenu, move the |
| 2594 // selection back to the parent menu item. | 2594 // selection back to the parent menu item. |
| 2595 SetSelection(pending_state_.item->GetParentMenuItem(), | 2595 SetSelection(pending_state_.item->GetParentMenuItem(), |
| 2596 SELECTION_OPEN_SUBMENU); | 2596 SELECTION_OPEN_SUBMENU); |
| 2597 } | 2597 } |
| 2598 } | 2598 } |
| 2599 | 2599 |
| 2600 } // namespace views | 2600 } // namespace views |
| OLD | NEW |