summaryrefslogtreecommitdiff
path: root/chromium/ui/accessibility/ax_event_intent.cc
blob: e4b89af26d41f47ad5545cd63d5eeb4c0e000071 (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
// Copyright 2020 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 "ui/accessibility/ax_event_intent.h"

#include "ui/accessibility/ax_enum_util.h"

namespace ui {

AXEventIntent::AXEventIntent() = default;

AXEventIntent::AXEventIntent(ax::mojom::Command command) : command(command) {}

AXEventIntent::AXEventIntent(ax::mojom::Command command,
                             ax::mojom::InputEventType input_event_type)
    : command(command), input_event_type(input_event_type) {}

AXEventIntent::AXEventIntent(ax::mojom::Command command,
                             ax::mojom::TextBoundary text_boundary,
                             ax::mojom::MoveDirection move_direction)
    : command(command),
      text_boundary(text_boundary),
      move_direction(move_direction) {}

AXEventIntent::~AXEventIntent() = default;

AXEventIntent::AXEventIntent(const AXEventIntent& intent) = default;

AXEventIntent& AXEventIntent::operator=(const AXEventIntent& intent) = default;

bool operator==(const AXEventIntent& a, const AXEventIntent& b) {
  return a.command == b.command && a.input_event_type == b.input_event_type &&
         a.text_boundary == b.text_boundary &&
         a.move_direction == b.move_direction;
}

bool operator!=(const AXEventIntent& a, const AXEventIntent& b) {
  return !(a == b);
}

std::string AXEventIntent::ToString() const {
  return std::string("AXEventIntent(") + ui::ToString(command) + ',' +
         ui::ToString(input_event_type) + ',' + ui::ToString(text_boundary) +
         ',' + ui::ToString(move_direction) + ')';
}

}  // namespace ui