| 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 24 matching lines...) Expand all Loading... |
| 35 KEYBOARD_EVENT_MASK = 2, | 35 KEYBOARD_EVENT_MASK = 2, |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 explicit UserInputMonitorWinCore( | 38 explicit UserInputMonitorWinCore( |
| 39 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 39 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 40 const scoped_refptr<UserInputMonitor::MouseListenerList>& | 40 const scoped_refptr<UserInputMonitor::MouseListenerList>& |
| 41 mouse_listeners); | 41 mouse_listeners); |
| 42 ~UserInputMonitorWinCore(); | 42 ~UserInputMonitorWinCore(); |
| 43 | 43 |
| 44 // DestructionObserver overrides. | 44 // DestructionObserver overrides. |
| 45 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 45 virtual void WillDestroyCurrentMessageLoop() override; |
| 46 | 46 |
| 47 size_t GetKeyPressCount() const; | 47 size_t GetKeyPressCount() const; |
| 48 void StartMonitor(EventBitMask type); | 48 void StartMonitor(EventBitMask type); |
| 49 void StopMonitor(EventBitMask type); | 49 void StopMonitor(EventBitMask type); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // Handles WM_INPUT messages. | 52 // Handles WM_INPUT messages. |
| 53 LRESULT OnInput(HRAWINPUT input_handle); | 53 LRESULT OnInput(HRAWINPUT input_handle); |
| 54 // Handles messages received by |window_|. | 54 // Handles messages received by |window_|. |
| 55 bool HandleMessage(UINT message, | 55 bool HandleMessage(UINT message, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 DISALLOW_COPY_AND_ASSIGN(UserInputMonitorWinCore); | 71 DISALLOW_COPY_AND_ASSIGN(UserInputMonitorWinCore); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class UserInputMonitorWin : public UserInputMonitor { | 74 class UserInputMonitorWin : public UserInputMonitor { |
| 75 public: | 75 public: |
| 76 explicit UserInputMonitorWin( | 76 explicit UserInputMonitorWin( |
| 77 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); | 77 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); |
| 78 virtual ~UserInputMonitorWin(); | 78 virtual ~UserInputMonitorWin(); |
| 79 | 79 |
| 80 // Public UserInputMonitor overrides. | 80 // Public UserInputMonitor overrides. |
| 81 virtual size_t GetKeyPressCount() const OVERRIDE; | 81 virtual size_t GetKeyPressCount() const override; |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 // Private UserInputMonitor overrides. | 84 // Private UserInputMonitor overrides. |
| 85 virtual void StartKeyboardMonitoring() OVERRIDE; | 85 virtual void StartKeyboardMonitoring() override; |
| 86 virtual void StopKeyboardMonitoring() OVERRIDE; | 86 virtual void StopKeyboardMonitoring() override; |
| 87 virtual void StartMouseMonitoring() OVERRIDE; | 87 virtual void StartMouseMonitoring() override; |
| 88 virtual void StopMouseMonitoring() OVERRIDE; | 88 virtual void StopMouseMonitoring() override; |
| 89 | 89 |
| 90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 91 UserInputMonitorWinCore* core_; | 91 UserInputMonitorWinCore* core_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(UserInputMonitorWin); | 93 DISALLOW_COPY_AND_ASSIGN(UserInputMonitorWin); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 UserInputMonitorWinCore::UserInputMonitorWinCore( | 96 UserInputMonitorWinCore::UserInputMonitorWinCore( |
| 97 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 97 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 98 const scoped_refptr<UserInputMonitor::MouseListenerList>& mouse_listeners) | 98 const scoped_refptr<UserInputMonitor::MouseListenerList>& mouse_listeners) |
| (...skipping 209 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 |