| 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 using base::Time; | 48 using base::Time; |
| 49 using base::TimeDelta; | 49 using base::TimeDelta; |
| 50 using ui::OSExchangeData; | 50 using ui::OSExchangeData; |
| 51 | 51 |
| 52 // Period of the scroll timer (in milliseconds). | 52 // Period of the scroll timer (in milliseconds). |
| 53 static const int kScrollTimerMS = 30; | 53 static const int kScrollTimerMS = 30; |
| 54 | 54 |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 gfx::Point screen_loc(event->location()); | 2211 gfx::Point screen_loc(event->location()); |
| 2212 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); | 2212 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); |
| 2213 gfx::NativeView native_view = source->GetWidget()->GetNativeView(); | 2213 gfx::NativeView native_view = source->GetWidget()->GetNativeView(); |
| 2214 if (!native_view) | 2214 if (!native_view) |
| 2215 return; | 2215 return; |
| 2216 | 2216 |
| 2217 gfx::Screen* screen = gfx::Screen::GetScreenFor(native_view); | 2217 gfx::Screen* screen = gfx::Screen::GetScreenFor(native_view); |
| 2218 gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc); | 2218 gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc); |
| 2219 | 2219 |
| 2220 #if defined(OS_WIN) | 2220 #if defined(OS_WIN) |
| 2221 gfx::Point screen_loc_pixels = gfx::win::DIPToScreenPoint(screen_loc); | 2221 gfx::Point screen_loc_pixels = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
| 2222 HWND target_window = ::WindowFromPoint(screen_loc_pixels.ToPOINT()); | 2222 HWND target_window = ::WindowFromPoint(screen_loc_pixels.ToPOINT()); |
| 2223 // If we don't find a native window for the HWND at the current location, | 2223 // If we don't find a native window for the HWND at the current location, |
| 2224 // then attempt to find a native window from its parent if one exists. | 2224 // then attempt to find a native window from its parent if one exists. |
| 2225 // There are HWNDs created outside views, which don't have associated | 2225 // There are HWNDs created outside views, which don't have associated |
| 2226 // native windows. | 2226 // native windows. |
| 2227 if (!window) { | 2227 if (!window) { |
| 2228 HWND parent = ::GetParent(target_window); | 2228 HWND parent = ::GetParent(target_window); |
| 2229 if (parent) { | 2229 if (parent) { |
| 2230 aura::WindowTreeHost* host = | 2230 aura::WindowTreeHost* host = |
| 2231 aura::WindowTreeHost::GetForAcceleratedWidget(parent); | 2231 aura::WindowTreeHost::GetForAcceleratedWidget(parent); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 } | 2558 } |
| 2559 } | 2559 } |
| 2560 | 2560 |
| 2561 gfx::Screen* MenuController::GetScreen() { | 2561 gfx::Screen* MenuController::GetScreen() { |
| 2562 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; | 2562 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; |
| 2563 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) | 2563 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) |
| 2564 : gfx::Screen::GetNativeScreen(); | 2564 : gfx::Screen::GetNativeScreen(); |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 } // namespace views | 2567 } // namespace views |
| OLD | NEW |