| 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 #ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_ | 5 #ifndef MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| 6 #define MEDIA_BASE_USER_INPUT_MONITOR_H_ | 6 #define MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/observer_list_threadsafe.h" | 14 #include "base/observer_list_threadsafe.h" |
| 14 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 16 | 17 |
| 17 struct SkIPoint; | 18 struct SkIPoint; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
| 21 } // namespace base | 22 } // namespace base |
| 22 | 23 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 }; | 39 }; |
| 39 typedef base::ObserverListThreadSafe<UserInputMonitor::MouseEventListener> | 40 typedef base::ObserverListThreadSafe<UserInputMonitor::MouseEventListener> |
| 40 MouseListenerList; | 41 MouseListenerList; |
| 41 | 42 |
| 42 UserInputMonitor(); | 43 UserInputMonitor(); |
| 43 virtual ~UserInputMonitor(); | 44 virtual ~UserInputMonitor(); |
| 44 | 45 |
| 45 // Creates a platform-specific instance of UserInputMonitor. | 46 // Creates a platform-specific instance of UserInputMonitor. |
| 46 // |io_task_runner| is the task runner for an IO thread. | 47 // |io_task_runner| is the task runner for an IO thread. |
| 47 // |ui_task_runner| is the task runner for a UI thread. | 48 // |ui_task_runner| is the task runner for a UI thread. |
| 48 static scoped_ptr<UserInputMonitor> Create( | 49 static std::unique_ptr<UserInputMonitor> Create( |
| 49 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 50 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 50 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); | 51 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); |
| 51 | 52 |
| 52 // The same |listener| should only be added once. | 53 // The same |listener| should only be added once. |
| 53 // The clients should make sure to call Remove*Listener before |listener| is | 54 // The clients should make sure to call Remove*Listener before |listener| is |
| 54 // destroyed. | 55 // destroyed. |
| 55 void AddMouseListener(MouseEventListener* listener); | 56 void AddMouseListener(MouseEventListener* listener); |
| 56 void RemoveMouseListener(MouseEventListener* listener); | 57 void RemoveMouseListener(MouseEventListener* listener); |
| 57 | 58 |
| 58 // A caller must call EnableKeyPressMonitoring and | 59 // A caller must call EnableKeyPressMonitoring and |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 size_t key_press_counter_references_; | 84 size_t key_press_counter_references_; |
| 84 size_t mouse_listeners_count_; | 85 size_t mouse_listeners_count_; |
| 85 scoped_refptr<MouseListenerList> mouse_listeners_; | 86 scoped_refptr<MouseListenerList> mouse_listeners_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(UserInputMonitor); | 88 DISALLOW_COPY_AND_ASSIGN(UserInputMonitor); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace media | 91 } // namespace media |
| 91 | 92 |
| 92 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_ | 93 #endif // MEDIA_BASE_USER_INPUT_MONITOR_H_ |
| OLD | NEW |