| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/base/user_input_monitor.h" | 5 #include "media/base/user_input_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 DCHECK_EQ(size, result); | 198 DCHECK_EQ(size, result); |
| 199 | 199 |
| 200 // Notify the observer about events generated locally. | 200 // Notify the observer about events generated locally. |
| 201 if (input->header.dwType == RIM_TYPEMOUSE && input->header.hDevice != NULL) { | 201 if (input->header.dwType == RIM_TYPEMOUSE && input->header.hDevice != NULL) { |
| 202 POINT position; | 202 POINT position; |
| 203 if (!GetCursorPos(&position)) { | 203 if (!GetCursorPos(&position)) { |
| 204 position.x = 0; | 204 position.x = 0; |
| 205 position.y = 0; | 205 position.y = 0; |
| 206 } | 206 } |
| 207 mouse_listeners_->Notify( | 207 mouse_listeners_->Notify( |
| 208 &UserInputMonitor::MouseEventListener::OnMouseMoved, | 208 FROM_HERE, &UserInputMonitor::MouseEventListener::OnMouseMoved, |
| 209 SkIPoint::Make(position.x, position.y)); | 209 SkIPoint::Make(position.x, position.y)); |
| 210 } else if (input->header.dwType == RIM_TYPEKEYBOARD && | 210 } else if (input->header.dwType == RIM_TYPEKEYBOARD && |
| 211 input->header.hDevice != NULL) { | 211 input->header.hDevice != NULL) { |
| 212 ui::EventType event = (input->data.keyboard.Flags & RI_KEY_BREAK) | 212 ui::EventType event = (input->data.keyboard.Flags & RI_KEY_BREAK) |
| 213 ? ui::ET_KEY_RELEASED | 213 ? ui::ET_KEY_RELEASED |
| 214 : ui::ET_KEY_PRESSED; | 214 : ui::ET_KEY_PRESSED; |
| 215 ui::KeyboardCode key_code = | 215 ui::KeyboardCode key_code = |
| 216 ui::KeyboardCodeForWindowsKeyCode(input->data.keyboard.VKey); | 216 ui::KeyboardCodeForWindowsKeyCode(input->data.keyboard.VKey); |
| 217 counter_.OnKeyboardEvent(event, key_code); | 217 counter_.OnKeyboardEvent(event, key_code); |
| 218 } | 218 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 } // namespace | 309 } // namespace |
| 310 | 310 |
| 311 scoped_ptr<UserInputMonitor> UserInputMonitor::Create( | 311 scoped_ptr<UserInputMonitor> UserInputMonitor::Create( |
| 312 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 312 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 313 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { | 313 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { |
| 314 return scoped_ptr<UserInputMonitor>(new UserInputMonitorWin(ui_task_runner)); | 314 return scoped_ptr<UserInputMonitor>(new UserInputMonitorWin(ui_task_runner)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace media | 317 } // namespace media |
| OLD | NEW |