OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class BrowserAccessibilityManager; |
| 17 |
| 18 // Listens for native accessibility events fired by a given |
| 19 // BrowserAccessibilityManager and saves human-readable log strings for |
| 20 // each event fired to a vector. Construct an instance of this class to |
| 21 // begin listening, call GetEventLogs() to get all of the logs so far, and |
| 22 // destroy it to stop listening. |
| 23 // |
| 24 // A log string should be of the form "<event> on <node>" where <event> is |
| 25 // the name of the event fired (platform-specific) and <node> is information |
| 26 // about the accessibility node on which the event was fired, for example its |
| 27 // role and name. |
| 28 // |
| 29 // The implementation is highly platform-specific; a subclass is needed for |
| 30 // each platform does most of the work. |
| 31 class AccessibilityEventRecorder { |
| 32 public: |
| 33 // Construct the right platform-specific subclass. |
| 34 static AccessibilityEventRecorder* Create( |
| 35 BrowserAccessibilityManager* manager); |
| 36 virtual ~AccessibilityEventRecorder(); |
| 37 |
| 38 // Access the vector of human-readable event logs, one string per event. |
| 39 const std::vector<std::string>& event_logs() { return event_logs_; } |
| 40 |
| 41 protected: |
| 42 explicit AccessibilityEventRecorder(BrowserAccessibilityManager* manager); |
| 43 |
| 44 BrowserAccessibilityManager* manager_; |
| 45 std::vector<std::string> event_logs_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(AccessibilityEventRecorder); |
| 48 }; |
| 49 |
| 50 } // namespace content |
| 51 |
| 52 #endif // CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_ |
OLD | NEW |