| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_ACCESSIBILITY_AX_VIEW_STATE_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_VIEW_STATE_H_ |
| 6 #define UI_ACCESSIBILITY_AX_VIEW_STATE_H_ | 6 #define UI_ACCESSIBILITY_AX_VIEW_STATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 9 #include "base/callback.h" | 10 #include "base/callback.h" |
| 10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 11 #include "ui/accessibility/ax_enums.h" | 12 #include "ui/accessibility/ax_enums.h" |
| 12 #include "ui/accessibility/ax_export.h" | 13 #include "ui/accessibility/ax_export.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 | 16 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 17 // | 18 // |
| 18 // AXViewState | 19 // AXViewState |
| 19 // | 20 // |
| 20 // A cross-platform struct for storing the core accessibility information | 21 // A cross-platform struct for storing the core accessibility information |
| 21 // that should be provided about any UI view to assistive technology (AT). | 22 // that should be provided about any UI view to assistive technology (AT). |
| 22 // | 23 // |
| 23 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
| 24 struct AX_EXPORT AXViewState { | 25 struct AX_EXPORT AXViewState { |
| 25 public: | 26 public: |
| 26 AXViewState(); | 27 AXViewState(); |
| 27 ~AXViewState(); | 28 ~AXViewState(); |
| 28 | 29 |
| 29 // Set or check bits in |state_|. | 30 // Set or check bits in |state_|. |
| 30 void AddStateFlag(ui::AXState state); | 31 void AddStateFlag(ui::AXState state); |
| 31 bool HasStateFlag(ui::AXState state) const; | 32 bool HasStateFlag(ui::AXState state) const; |
| 32 | 33 |
| 33 // The view's state, a bitmask containing fields such as checked | 34 // The view's state, a bitmask containing fields such as checked |
| 34 // (for a checkbox) and protected (for a password text box). This "state" | 35 // (for a checkbox) and protected (for a password text box). This "state" |
| 35 // should not be confused with the class's name. | 36 // should not be confused with the class's name. |
| 36 uint32 state() { return state_; } | 37 uint32_t state() { return state_; } |
| 37 | 38 |
| 38 // The view's role, like button or list box. | 39 // The view's role, like button or list box. |
| 39 AXRole role; | 40 AXRole role; |
| 40 | 41 |
| 41 // The view's name / label. | 42 // The view's name / label. |
| 42 base::string16 name; | 43 base::string16 name; |
| 43 | 44 |
| 44 // The view's value, for example the text content. | 45 // The view's value, for example the text content. |
| 45 base::string16 value; | 46 base::string16 value; |
| 46 | 47 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 // setting the value makes sense, like a text box. Not often used by | 67 // setting the value makes sense, like a text box. Not often used by |
| 67 // screen readers, but often used by automation software to script | 68 // screen readers, but often used by automation software to script |
| 68 // things like logging into portals or filling forms. | 69 // things like logging into portals or filling forms. |
| 69 // | 70 // |
| 70 // This callback is only valid for the lifetime of the view, and should | 71 // This callback is only valid for the lifetime of the view, and should |
| 71 // be a safe no-op if the view is deleted. Typically, accessible views | 72 // be a safe no-op if the view is deleted. Typically, accessible views |
| 72 // should use a WeakPtr when binding the callback. | 73 // should use a WeakPtr when binding the callback. |
| 73 base::Callback<void(const base::string16&)> set_value_callback; | 74 base::Callback<void(const base::string16&)> set_value_callback; |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 uint32 state_; | 77 uint32_t state_; |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace ui | 80 } // namespace ui |
| 80 | 81 |
| 81 #endif // UI_ACCESSIBILITY_AX_VIEW_STATE_H_ | 82 #endif // UI_ACCESSIBILITY_AX_VIEW_STATE_H_ |
| OLD | NEW |