Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ax_unique_id.h
Go to the documentation of this file.
1// Copyright 2017 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#ifndef UI_ACCESSIBILITY_PLATFORM_AX_UNIQUE_ID_H_
6#define UI_ACCESSIBILITY_PLATFORM_AX_UNIQUE_ID_H_
7
8#include <cstdint>
9
10#include "ax/ax_export.h"
11#include "base/macros.h"
12
13namespace ui {
14
15// AXUniqueID provides IDs for accessibility objects that are guaranteed to be
16// unique for the entire Chrome instance. Instantiating the class is all that
17// is required to generate the ID, and the ID is freed when the AXUniqueID is
18// destroyed.
19//
20// The unique id that's guaranteed to be a positive number. Because some
21// platforms want to negate it, we ensure the range is below the signed int max.
22//
23// These ids must not be conflated with the int id, that comes with web node
24// data, which are only unique within their source frame.
26 public:
27 AXUniqueId();
28 virtual ~AXUniqueId();
29
30 int32_t Get() const { return id_; }
31 operator int32_t() const { return id_; }
32
33 bool operator==(const AXUniqueId& other) const;
34 bool operator!=(const AXUniqueId& other) const;
35
36 protected:
37 // Passing the max id is necessary for testing.
38 explicit AXUniqueId(const int32_t max_id);
39
40 private:
41 int32_t GetNextAXUniqueId(const int32_t max_id);
42
43 bool IsAssigned(int32_t) const;
44
45 int32_t id_;
46
48};
49
50} // namespace ui
51
52#endif // UI_ACCESSIBILITY_PLATFORM_AX_UNIQUE_ID_H_
bool operator!=(const sk_sp< T > &a, const sk_sp< U > &b)
Definition SkRefCnt.h:355
#define AX_EXPORT
Definition ax_export.h:29
int32_t Get() const
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
#define BASE_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:8