| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_message_loop_aura.h" | 5 #include "ui/views/controls/menu/menu_message_loop_aura.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const gfx::Point& screen_loc) { | 113 const gfx::Point& screen_loc) { |
| 114 aura::Window* root = window->GetRootWindow(); | 114 aura::Window* root = window->GetRootWindow(); |
| 115 ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); | 115 ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); |
| 116 if (!spc) | 116 if (!spc) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 gfx::Point root_loc(screen_loc); | 119 gfx::Point root_loc(screen_loc); |
| 120 spc->ConvertPointFromScreen(root, &root_loc); | 120 spc->ConvertPointFromScreen(root, &root_loc); |
| 121 | 121 |
| 122 ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); | 122 ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); |
| 123 clone.set_location(root_loc); | 123 clone.set_location(gfx::PointF(root_loc)); |
| 124 clone.set_root_location(root_loc); | 124 clone.set_root_location(gfx::PointF(root_loc)); |
| 125 root->GetHost()->dispatcher()->RepostEvent(clone); | 125 root->GetHost()->dispatcher()->RepostEvent(clone); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MenuMessageLoopAura::Run(MenuController* controller, | 128 void MenuMessageLoopAura::Run(MenuController* controller, |
| 129 Widget* owner, | 129 Widget* owner, |
| 130 bool nested_menu) { | 130 bool nested_menu) { |
| 131 // |owner_| may be NULL. | 131 // |owner_| may be NULL. |
| 132 owner_ = owner; | 132 owner_ = owner; |
| 133 aura::Window* root = GetOwnerRootWindow(owner_); | 133 aura::Window* root = GetOwnerRootWindow(owner_); |
| 134 // It is possible for the same MenuMessageLoopAura to start a nested | 134 // It is possible for the same MenuMessageLoopAura to start a nested |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 if (ui::PlatformEventSource::GetInstance()) | 188 if (ui::PlatformEventSource::GetInstance()) |
| 189 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream(); | 189 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream(); |
| 190 #endif | 190 #endif |
| 191 } | 191 } |
| 192 | 192 |
| 193 void MenuMessageLoopAura::ClearOwner() { | 193 void MenuMessageLoopAura::ClearOwner() { |
| 194 owner_ = NULL; | 194 owner_ = NULL; |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace views | 197 } // namespace views |
| OLD | NEW |