summaryrefslogtreecommitdiffstats
path: root/content/browser/accessibility/accessibility_tree_formatter_stub.cc
blob: 4fae96ed5c48601621f9dee509a7c6af7ab4e0e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/strings/string_number_conversions.h"
#include "content/browser/accessibility/accessibility_tree_formatter.h"

namespace content {

class AccessibilityTreeFormatterStub : public AccessibilityTreeFormatter {
 public:
  explicit AccessibilityTreeFormatterStub();
  ~AccessibilityTreeFormatterStub() override;

 private:
  const base::FilePath::StringType GetExpectedFileSuffix() override;
  const std::string GetAllowEmptyString() override;
  const std::string GetAllowString() override;
  const std::string GetDenyString() override;
  void AddProperties(const BrowserAccessibility& node,
                     base::DictionaryValue* dict) override;
  base::string16 ToString(const base::DictionaryValue& node) override;
};

#if !defined(PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL)
// static
AccessibilityTreeFormatter* AccessibilityTreeFormatter::Create() {
  return new AccessibilityTreeFormatterStub();
}
#endif

AccessibilityTreeFormatterStub::AccessibilityTreeFormatterStub()
    : AccessibilityTreeFormatter() {
}

AccessibilityTreeFormatterStub::~AccessibilityTreeFormatterStub() {
}

void AccessibilityTreeFormatterStub::AddProperties(
    const BrowserAccessibility& node,
    base::DictionaryValue* dict) {
  dict->SetInteger("id", node.GetId());
}

base::string16 AccessibilityTreeFormatterStub::ToString(
    const base::DictionaryValue& node) {
  int id_value;
  node.GetInteger("id", &id_value);
  return base::IntToString16(id_value);
}

const base::FilePath::StringType
AccessibilityTreeFormatterStub::GetExpectedFileSuffix() {
  return base::FilePath::StringType();
}

const std::string AccessibilityTreeFormatterStub::GetAllowEmptyString() {
  return std::string();
}

const std::string AccessibilityTreeFormatterStub::GetAllowString() {
  return std::string();
}

const std::string AccessibilityTreeFormatterStub::GetDenyString() {
  return std::string();
}

}  // namespace content