| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 BASE_EVENT_RECORDER_H_ | 5 #ifndef BASE_EVENT_RECORDER_H_ |
| 6 #define BASE_EVENT_RECORDER_H_ | 6 #define BASE_EVENT_RECORDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_api.h" | 9 #include "base/base_export.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <string.h> | 15 #include <string.h> |
| 16 #include <windows.h> | 16 #include <windows.h> |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 class FilePath; | 19 class FilePath; |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 | 22 |
| 23 // A class for recording and playing back keyboard and mouse input events. | 23 // A class for recording and playing back keyboard and mouse input events. |
| 24 // | 24 // |
| 25 // Note - if you record events, and the playback with the windows in | 25 // Note - if you record events, and the playback with the windows in |
| 26 // different sizes or positions, the playback will fail. When | 26 // different sizes or positions, the playback will fail. When |
| 27 // recording and playing, you should move the relevant windows | 27 // recording and playing, you should move the relevant windows |
| 28 // to constant sizes and locations. | 28 // to constant sizes and locations. |
| 29 // TODO(mbelshe) For now this is a singleton. I believe that this class | 29 // TODO(mbelshe) For now this is a singleton. I believe that this class |
| 30 // could be easily modified to: | 30 // could be easily modified to: |
| 31 // support two simultaneous recorders | 31 // support two simultaneous recorders |
| 32 // be playing back events while already recording events. | 32 // be playing back events while already recording events. |
| 33 // Why? Imagine if the product had a "record a macro" feature. | 33 // Why? Imagine if the product had a "record a macro" feature. |
| 34 // You might be recording globally, while recording or playing back | 34 // You might be recording globally, while recording or playing back |
| 35 // a macro. I don't think two playbacks make sense. | 35 // a macro. I don't think two playbacks make sense. |
| 36 class BASE_API EventRecorder { | 36 class BASE_EXPORT EventRecorder { |
| 37 public: | 37 public: |
| 38 // Get the singleton EventRecorder. | 38 // Get the singleton EventRecorder. |
| 39 // We can only handle one recorder/player at a time. | 39 // We can only handle one recorder/player at a time. |
| 40 static EventRecorder* current() { | 40 static EventRecorder* current() { |
| 41 if (!current_) | 41 if (!current_) |
| 42 current_ = new EventRecorder(); | 42 current_ = new EventRecorder(); |
| 43 return current_; | 43 return current_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Starts recording events. | 46 // Starts recording events. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #endif | 101 #endif |
| 102 int playback_first_msg_time_; | 102 int playback_first_msg_time_; |
| 103 int playback_start_time_; | 103 int playback_start_time_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(EventRecorder); | 105 DISALLOW_COPY_AND_ASSIGN(EventRecorder); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace base | 108 } // namespace base |
| 109 | 109 |
| 110 #endif // BASE_EVENT_RECORDER_H_ | 110 #endif // BASE_EVENT_RECORDER_H_ |
| OLD | NEW |