| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/window_manager_connection.h" | 5 #include "ui/views/mus/window_manager_connection.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 base::ObserverList<PointerWatcher>::Iterator iterator(&pointer_watchers_); | 136 base::ObserverList<PointerWatcher>::Iterator iterator(&pointer_watchers_); |
| 137 return !!iterator.GetNext(); | 137 return !!iterator.GetNext(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void WindowManagerConnection::OnEmbed(mus::Window* root) {} | 140 void WindowManagerConnection::OnEmbed(mus::Window* root) {} |
| 141 | 141 |
| 142 void WindowManagerConnection::OnConnectionLost( | 142 void WindowManagerConnection::OnConnectionLost( |
| 143 mus::WindowTreeConnection* connection) {} | 143 mus::WindowTreeConnection* connection) {} |
| 144 | 144 |
| 145 void WindowManagerConnection::OnEventObserved(const ui::Event& event) { | 145 void WindowManagerConnection::OnEventObserved(const ui::Event& event) { |
| 146 if (!event.IsLocatedEvent()) |
| 147 return; |
| 148 // The mojo input events type converter uses the event root_location field |
| 149 // to store screen coordinates. Screen coordinates really should be returned |
| 150 // separately. See http://crbug.com/608547 |
| 151 gfx::Point location_in_screen = event.AsLocatedEvent()->root_location(); |
| 146 if (event.type() == ui::ET_MOUSE_PRESSED) { | 152 if (event.type() == ui::ET_MOUSE_PRESSED) { |
| 147 FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_, | 153 FOR_EACH_OBSERVER( |
| 148 OnMousePressed(*event.AsMouseEvent())); | 154 PointerWatcher, pointer_watchers_, |
| 155 OnMousePressed(*event.AsMouseEvent(), location_in_screen)); |
| 149 } else if (event.type() == ui::ET_TOUCH_PRESSED) { | 156 } else if (event.type() == ui::ET_TOUCH_PRESSED) { |
| 150 FOR_EACH_OBSERVER(PointerWatcher, pointer_watchers_, | 157 FOR_EACH_OBSERVER( |
| 151 OnTouchPressed(*event.AsTouchEvent())); | 158 PointerWatcher, pointer_watchers_, |
| 159 OnTouchPressed(*event.AsTouchEvent(), location_in_screen)); |
| 152 } | 160 } |
| 153 } | 161 } |
| 154 | 162 |
| 155 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { | 163 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { |
| 156 if (window_tree_connection_) | 164 if (window_tree_connection_) |
| 157 NativeWidgetMus::NotifyFrameChanged(window_tree_connection_.get()); | 165 NativeWidgetMus::NotifyFrameChanged(window_tree_connection_.get()); |
| 158 } | 166 } |
| 159 | 167 |
| 160 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { | 168 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { |
| 161 return window_tree_connection_->GetCursorScreenPoint(); | 169 return window_tree_connection_->GetCursorScreenPoint(); |
| 162 } | 170 } |
| 163 | 171 |
| 164 } // namespace views | 172 } // namespace views |
| OLD | NEW |