Chromium Code Reviews| 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 "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "ui/accessibility/ax_enums.h" | 11 #include "ui/accessibility/ax_enums.h" |
| 12 #include "ui/accessibility/ax_export.h" | 12 #include "ui/accessibility/ax_export.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 17 // | 17 // |
| 18 // AXViewState | 18 // AXViewState |
| 19 // | 19 // |
| 20 // A cross-platform struct for storing the core accessibility information | 20 // A cross-platform struct for storing the core accessibility information |
| 21 // that should be provided about any UI view to assistive technology (AT). | 21 // that should be provided about any UI view to assistive technology (AT). |
| 22 // | 22 // |
| 23 //////////////////////////////////////////////////////////////////////////////// | 23 //////////////////////////////////////////////////////////////////////////////// |
| 24 struct AX_EXPORT AXViewState { | 24 struct AX_EXPORT AXViewState { |
| 25 public: | 25 public: |
| 26 AXViewState(); | 26 AXViewState(); |
| 27 ~AXViewState(); | 27 ~AXViewState(); |
| 28 | 28 |
| 29 // Set or check bits in |state_|. | |
| 30 void SetStateFlag(ui::AXState state); | |
|
sky
2014/03/26 14:29:13
nit: I think AddStateFlag would be a better name h
dmazzoni
2014/03/26 18:12:29
Done.
| |
| 31 bool HasStateFlag(ui::AXState state) const; | |
| 32 | |
| 29 // The view's role, like button or list box. | 33 // The view's role, like button or list box. |
| 30 AXRole role; | 34 AXRole role; |
| 31 | 35 |
| 32 // The view's state, a bitmask containing fields such as checked | |
| 33 // (for a checkbox) and protected (for a password text box). | |
| 34 uint32 state; | |
| 35 | |
| 36 // The view's name / label. | 36 // The view's name / label. |
| 37 base::string16 name; | 37 base::string16 name; |
| 38 | 38 |
| 39 // The view's value, for example the text content. | 39 // The view's value, for example the text content. |
| 40 base::string16 value; | 40 base::string16 value; |
| 41 | 41 |
| 42 // The name of the default action if the user clicks on this view. | 42 // The name of the default action if the user clicks on this view. |
| 43 base::string16 default_action; | 43 base::string16 default_action; |
| 44 | 44 |
| 45 // The keyboard shortcut to activate this view, if any. | 45 // The keyboard shortcut to activate this view, if any. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 59 // An optional callback that can be used by accessibility clients to | 59 // An optional callback that can be used by accessibility clients to |
| 60 // set the string value of this view. This only applies to roles where | 60 // set the string value of this view. This only applies to roles where |
| 61 // setting the value makes sense, like a text box. Not often used by | 61 // setting the value makes sense, like a text box. Not often used by |
| 62 // screen readers, but often used by automation software to script | 62 // screen readers, but often used by automation software to script |
| 63 // things like logging into portals or filling forms. | 63 // things like logging into portals or filling forms. |
| 64 // | 64 // |
| 65 // This callback is only valid for the lifetime of the view, and should | 65 // This callback is only valid for the lifetime of the view, and should |
| 66 // be a safe no-op if the view is deleted. Typically, accessible views | 66 // be a safe no-op if the view is deleted. Typically, accessible views |
| 67 // should use a WeakPtr when binding the callback. | 67 // should use a WeakPtr when binding the callback. |
| 68 base::Callback<void(const base::string16&)> set_value_callback; | 68 base::Callback<void(const base::string16&)> set_value_callback; |
| 69 | |
| 70 private: | |
| 71 // The view's state, a bitmask containing fields such as checked | |
| 72 // (for a checkbox) and protected (for a password text box). | |
| 73 uint32 state_; | |
| 69 }; | 74 }; |
| 70 | 75 |
| 71 } // namespace ui | 76 } // namespace ui |
| 72 | 77 |
| 73 #endif // UI_ACCESSIBILITY_AX_VIEW_STATE_H_ | 78 #endif // UI_ACCESSIBILITY_AX_VIEW_STATE_H_ |
| OLD | NEW |