Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / content / browser / accessibility / accessibility_event_recorder.h
blobd214f372b454c26651ce89a836b24af1f71a0dce
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.
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_
8 #include <string>
9 #include <vector>
11 #include "base/macros.h"
12 #include "content/common/content_export.h"
14 namespace content {
16 class BrowserAccessibilityManager;
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.
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.
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();
38 // Access the vector of human-readable event logs, one string per event.
39 const std::vector<std::string>& event_logs() { return event_logs_; }
41 protected:
42 explicit AccessibilityEventRecorder(BrowserAccessibilityManager* manager);
44 BrowserAccessibilityManager* manager_;
45 std::vector<std::string> event_logs_;
47 DISALLOW_COPY_AND_ASSIGN(AccessibilityEventRecorder);
50 } // namespace content
52 #endif // CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENT_RECORDER_H_