1 // Copyright 2020 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 #include "ui/accessibility/ax_event_intent.h"
6 
7 #include "ui/accessibility/ax_enum_util.h"
8 
9 namespace ui {
10 
11 AXEventIntent::AXEventIntent() = default;
12 
AXEventIntent(ax::mojom::Command command)13 AXEventIntent::AXEventIntent(ax::mojom::Command command) : command(command) {}
14 
AXEventIntent(ax::mojom::Command command,ax::mojom::InputEventType input_event_type)15 AXEventIntent::AXEventIntent(ax::mojom::Command command,
16                              ax::mojom::InputEventType input_event_type)
17     : command(command), input_event_type(input_event_type) {}
18 
AXEventIntent(ax::mojom::Command command,ax::mojom::TextBoundary text_boundary,ax::mojom::MoveDirection move_direction)19 AXEventIntent::AXEventIntent(ax::mojom::Command command,
20                              ax::mojom::TextBoundary text_boundary,
21                              ax::mojom::MoveDirection move_direction)
22     : command(command),
23       text_boundary(text_boundary),
24       move_direction(move_direction) {}
25 
26 AXEventIntent::~AXEventIntent() = default;
27 
28 AXEventIntent::AXEventIntent(const AXEventIntent& intent) = default;
29 
30 AXEventIntent& AXEventIntent::operator=(const AXEventIntent& intent) = default;
31 
operator ==(const AXEventIntent & a,const AXEventIntent & b)32 bool operator==(const AXEventIntent& a, const AXEventIntent& b) {
33   return a.command == b.command && a.input_event_type == b.input_event_type &&
34          a.text_boundary == b.text_boundary &&
35          a.move_direction == b.move_direction;
36 }
37 
operator !=(const AXEventIntent & a,const AXEventIntent & b)38 bool operator!=(const AXEventIntent& a, const AXEventIntent& b) {
39   return !(a == b);
40 }
41 
ToString() const42 std::string AXEventIntent::ToString() const {
43   return std::string("AXEventIntent(") + ui::ToString(command) + ',' +
44          ui::ToString(input_event_type) + ',' + ui::ToString(text_boundary) +
45          ',' + ui::ToString(move_direction) + ')';
46 }
47 
48 }  // namespace ui
49