| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/accessibility_event_recorder.h" | 5 #include "content/browser/accessibility/accessibility_event_recorder.h" |
| 6 | 6 |
| 7 #include <oleacc.h> | 7 #include <oleacc.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 std::string BstrToUTF8(BSTR bstr) { | 55 std::string BstrToUTF8(BSTR bstr) { |
| 56 base::string16 str16(bstr, SysStringLen(bstr)); | 56 base::string16 str16(bstr, SysStringLen(bstr)); |
| 57 | 57 |
| 58 // IAccessibleText returns the text you get by appending all static text | 58 // IAccessibleText returns the text you get by appending all static text |
| 59 // children, with an "embedded object character" for each non-text child. | 59 // children, with an "embedded object character" for each non-text child. |
| 60 // Pretty-print the embedded object character as <obj> so that test output | 60 // Pretty-print the embedded object character as <obj> so that test output |
| 61 // is human-readable. | 61 // is human-readable. |
| 62 base::StringPiece16 embedded_character( | 62 base::StringPiece16 embedded_character( |
| 63 &BrowserAccessibilityWin::kEmbeddedCharacter, 1); | 63 &BrowserAccessibilityComWin::kEmbeddedCharacter, 1); |
| 64 base::ReplaceChars(str16, embedded_character, L"<obj>", &str16); | 64 base::ReplaceChars(str16, embedded_character, L"<obj>", &str16); |
| 65 | 65 |
| 66 return base::UTF16ToUTF8(str16); | 66 return base::UTF16ToUTF8(str16); |
| 67 } | 67 } |
| 68 | 68 |
| 69 std::string AccessibilityEventToStringUTF8(int32_t event_id) { | 69 std::string AccessibilityEventToStringUTF8(int32_t event_id) { |
| 70 return base::UTF16ToUTF8(AccessibilityEventToString(event_id)); | 70 return base::UTF16ToUTF8(AccessibilityEventToString(event_id)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return hr; | 280 return hr; |
| 281 | 281 |
| 282 // The above call to ::AccessibleObjectFromWindow fails for unknown | 282 // The above call to ::AccessibleObjectFromWindow fails for unknown |
| 283 // reasons every once in a while on the bots. Work around it by grabbing | 283 // reasons every once in a while on the bots. Work around it by grabbing |
| 284 // the object directly from the BrowserAccessibilityManager. | 284 // the object directly from the BrowserAccessibilityManager. |
| 285 HWND accessibility_hwnd = | 285 HWND accessibility_hwnd = |
| 286 manager_->delegate()->AccessibilityGetAcceleratedWidget(); | 286 manager_->delegate()->AccessibilityGetAcceleratedWidget(); |
| 287 if (accessibility_hwnd != hwnd) | 287 if (accessibility_hwnd != hwnd) |
| 288 return E_FAIL; | 288 return E_FAIL; |
| 289 | 289 |
| 290 IAccessible* obj = ToBrowserAccessibilityWin(manager_->GetRoot()); | 290 IAccessible* obj = ToBrowserAccessibilityComWin(manager_->GetRoot()); |
| 291 obj->AddRef(); | 291 obj->AddRef(); |
| 292 *ppv_object = obj; | 292 *ppv_object = obj; |
| 293 return S_OK; | 293 return S_OK; |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace content | 296 } // namespace content |
| OLD | NEW |