1 // Copyright 2018 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.h"
6 
7 #include "base/strings/string_number_conversions.h"
8 #include "ui/accessibility/ax_enum_util.h"
9 #include "ui/accessibility/ax_enums.mojom.h"
10 
11 namespace ui {
12 
13 // Mojo enums are initialized here so the header can include the much smaller
14 // mojom-forward.h header.
AXEvent()15 AXEvent::AXEvent()
16     : event_type(ax::mojom::Event::kNone),
17       event_from(ax::mojom::EventFrom::kNone) {}
18 
19 AXEvent::~AXEvent() = default;
20 
ToString() const21 std::string AXEvent::ToString() const {
22   std::string result = "AXEvent";
23 
24   result += ui::ToString(event_type);
25   result += " on node id=" + base::NumberToString(id);
26   if (event_from != ax::mojom::EventFrom::kNone)
27     result += std::string(" from ") + ui::ToString(event_from);
28   if (action_request_id)
29     result += " action_request_id=" + base::NumberToString(action_request_id);
30   return result;
31 }
32 
33 }  // namespace ui
34