| 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 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const gfx::Point& screen_loc) { | 109 const gfx::Point& screen_loc) { |
| 110 aura::Window* root = window->GetRootWindow(); | 110 aura::Window* root = window->GetRootWindow(); |
| 111 ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); | 111 ScreenPositionClient* spc = aura::client::GetScreenPositionClient(root); |
| 112 if (!spc) | 112 if (!spc) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 gfx::Point root_loc(screen_loc); | 115 gfx::Point root_loc(screen_loc); |
| 116 spc->ConvertPointFromScreen(root, &root_loc); | 116 spc->ConvertPointFromScreen(root, &root_loc); |
| 117 | 117 |
| 118 ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); | 118 ui::MouseEvent clone(static_cast<const ui::MouseEvent&>(event)); |
| 119 clone.set_location(root_loc); | 119 clone.set_location(gfx::PointF(root_loc)); |
| 120 clone.set_root_location(root_loc); | 120 clone.set_root_location(gfx::PointF(root_loc)); |
| 121 root->GetHost()->dispatcher()->RepostEvent(clone); | 121 root->GetHost()->dispatcher()->RepostEvent(clone); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void MenuMessageLoopAura::Run(MenuController* controller, | 124 void MenuMessageLoopAura::Run(MenuController* controller, |
| 125 Widget* owner, | 125 Widget* owner, |
| 126 bool nested_menu) { | 126 bool nested_menu) { |
| 127 // |owner_| may be NULL. | 127 // |owner_| may be NULL. |
| 128 owner_ = owner; | 128 owner_ = owner; |
| 129 aura::Window* root = GetOwnerRootWindow(owner_); | 129 aura::Window* root = GetOwnerRootWindow(owner_); |
| 130 // It is possible for the same MenuMessageLoopAura to start a nested | 130 // It is possible for the same MenuMessageLoopAura to start a nested |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (ui::PlatformEventSource::GetInstance()) | 184 if (ui::PlatformEventSource::GetInstance()) |
| 185 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream(); | 185 ui::PlatformEventSource::GetInstance()->StopCurrentEventStream(); |
| 186 #endif | 186 #endif |
| 187 } | 187 } |
| 188 | 188 |
| 189 void MenuMessageLoopAura::ClearOwner() { | 189 void MenuMessageLoopAura::ClearOwner() { |
| 190 owner_ = NULL; | 190 owner_ = NULL; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace views | 193 } // namespace views |
| OLD | NEW |