OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/win/enum_variant.h" | 13 #include "base/win/enum_variant.h" |
14 #include "base/win/scoped_comptr.h" | 14 #include "base/win/scoped_comptr.h" |
15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
16 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
17 #include "content/common/accessibility_messages.h" | 17 #include "content/common/accessibility_messages.h" |
18 #include "net/base/escape.h" | |
19 #include "ui/base/accessibility/accessible_text_utils.h" | 18 #include "ui/base/accessibility/accessible_text_utils.h" |
20 #include "ui/base/win/accessibility_misc_utils.h" | 19 #include "ui/base/win/accessibility_misc_utils.h" |
21 | 20 |
22 using webkit_glue::WebAccessibility; | 21 using webkit_glue::WebAccessibility; |
23 | 22 |
24 // The GUID for the ISimpleDOM service is not defined in the IDL files. | 23 // The GUID for the ISimpleDOM service is not defined in the IDL files. |
25 // This is taken directly from the Mozilla sources | 24 // This is taken directly from the Mozilla sources |
26 // (accessible/src/msaa/nsAccessNodeWrap.cpp) and it's also documented at: | 25 // (accessible/src/msaa/nsAccessNodeWrap.cpp) and it's also documented at: |
27 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/
MSAA | 26 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/
MSAA |
28 | 27 |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 } | 2889 } |
2891 | 2890 |
2892 void BrowserAccessibilityWin::IntAttributeToIA2( | 2891 void BrowserAccessibilityWin::IntAttributeToIA2( |
2893 WebAccessibility::IntAttribute attribute, const char* ia2_attr) { | 2892 WebAccessibility::IntAttribute attribute, const char* ia2_attr) { |
2894 int value; | 2893 int value; |
2895 if (GetIntAttribute(attribute, &value)) | 2894 if (GetIntAttribute(attribute, &value)) |
2896 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + | 2895 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + |
2897 base::IntToString16(value)); | 2896 base::IntToString16(value)); |
2898 } | 2897 } |
2899 | 2898 |
2900 string16 BrowserAccessibilityWin::Escape(const string16& str) { | |
2901 return net::EscapeQueryParamValueUTF8(str, false); | |
2902 } | |
2903 | |
2904 const string16& BrowserAccessibilityWin::TextForIAccessibleText() { | 2899 const string16& BrowserAccessibilityWin::TextForIAccessibleText() { |
2905 if (IsEditableText()) { | 2900 if (IsEditableText()) { |
2906 return value_; | 2901 return value_; |
2907 } else if (role_ == WebAccessibility::ROLE_STATIC_TEXT) { | 2902 } else if (role_ == WebAccessibility::ROLE_STATIC_TEXT) { |
2908 return name_; | 2903 return name_; |
2909 } else { | 2904 } else { |
2910 return hypertext_; | 2905 return hypertext_; |
2911 } | 2906 } |
2912 } | 2907 } |
2913 | 2908 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3387 } | 3382 } |
3388 | 3383 |
3389 // The role should always be set. | 3384 // The role should always be set. |
3390 DCHECK(!role_name_.empty() || ia_role_); | 3385 DCHECK(!role_name_.empty() || ia_role_); |
3391 | 3386 |
3392 // If we didn't explicitly set the IAccessible2 role, make it the same | 3387 // If we didn't explicitly set the IAccessible2 role, make it the same |
3393 // as the MSAA role. | 3388 // as the MSAA role. |
3394 if (!ia2_role_) | 3389 if (!ia2_role_) |
3395 ia2_role_ = ia_role_; | 3390 ia2_role_ = ia_role_; |
3396 } | 3391 } |
OLD | NEW |