| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome_frame/test/chrome_frame_ui_test_utils.h" | 5 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <stack> | 10 #include <stack> |
| 11 | 11 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 base::win::ScopedVariant role_variant; | 179 base::win::ScopedVariant role_variant; |
| 180 if (SUCCEEDED(accessible_->get_accRole(child_id_, role_variant.Receive()))) { | 180 if (SUCCEEDED(accessible_->get_accRole(child_id_, role_variant.Receive()))) { |
| 181 if (role_variant.type() == VT_I4) { | 181 if (role_variant.type() == VT_I4) { |
| 182 wchar_t role_text_array[50]; | 182 wchar_t role_text_array[50]; |
| 183 UINT characters = ::GetRoleText(V_I4(&role_variant), role_text_array, | 183 UINT characters = ::GetRoleText(V_I4(&role_variant), role_text_array, |
| 184 arraysize(role_text_array)); | 184 arraysize(role_text_array)); |
| 185 if (characters) { | 185 if (characters) { |
| 186 *role_text = role_text_array; | 186 *role_text = role_text_array; |
| 187 return true; | 187 return true; |
| 188 } else { | 188 } else { |
| 189 DLOG(ERROR) << "GetRoleText failed for role: " | 189 LOG(ERROR) << "GetRoleText failed for role: " << V_I4(&role_variant); |
| 190 << V_I4(&role_variant); | |
| 191 } | 190 } |
| 192 } else if (role_variant.type() == VT_BSTR) { | 191 } else if (role_variant.type() == VT_BSTR) { |
| 193 *role_text = V_BSTR(&role_variant); | 192 *role_text = V_BSTR(&role_variant); |
| 194 return true; | 193 return true; |
| 195 } else { | 194 } else { |
| 196 DLOG(ERROR) << "Role was unexpected variant type: " | 195 LOG(ERROR) << "Role was unexpected variant type: " |
| 197 << role_variant.type(); | 196 << role_variant.type(); |
| 198 } | 197 } |
| 199 } | 198 } |
| 200 return false; | 199 return false; |
| 201 } | 200 } |
| 202 | 201 |
| 203 bool AccObject::GetValue(std::wstring* value) { | 202 bool AccObject::GetValue(std::wstring* value) { |
| 204 DCHECK(value); | 203 DCHECK(value); |
| 205 base::win::ScopedBstr value_bstr; | 204 base::win::ScopedBstr value_bstr; |
| 206 HRESULT result = accessible_->get_accValue(child_id_, value_bstr.Receive()); | 205 HRESULT result = accessible_->get_accValue(child_id_, value_bstr.Receive()); |
| 207 if (SUCCEEDED(result)) | 206 if (SUCCEEDED(result)) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 235 bool AccObject::GetLocationInClient(gfx::Rect* client_location) { | 234 bool AccObject::GetLocationInClient(gfx::Rect* client_location) { |
| 236 DCHECK(client_location); | 235 DCHECK(client_location); |
| 237 gfx::Rect location; | 236 gfx::Rect location; |
| 238 if (!GetLocation(&location)) | 237 if (!GetLocation(&location)) |
| 239 return false; | 238 return false; |
| 240 HWND container_window = NULL; | 239 HWND container_window = NULL; |
| 241 if (!GetWindow(&container_window)) | 240 if (!GetWindow(&container_window)) |
| 242 return false; | 241 return false; |
| 243 POINT offset = {0, 0}; | 242 POINT offset = {0, 0}; |
| 244 if (!::ScreenToClient(container_window, &offset)) { | 243 if (!::ScreenToClient(container_window, &offset)) { |
| 245 DLOG(ERROR) << "Could not convert from screen to client coordinates for " | 244 LOG(ERROR) << "Could not convert from screen to client coordinates for " |
| 246 << "window containing accessibility object: " << GetDescription(); | 245 "window containing accessibility object: " |
| 246 << GetDescription(); |
| 247 return false; | 247 return false; |
| 248 } | 248 } |
| 249 location.Offset(offset.x, offset.y); | 249 location.Offset(offset.x, offset.y); |
| 250 *client_location = location; | 250 *client_location = location; |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 | 253 |
| 254 AccObject* AccObject::GetParent() { | 254 AccObject* AccObject::GetParent() { |
| 255 if (IsSimpleElement()) | 255 if (IsSimpleElement()) |
| 256 return new AccObject(accessible_); | 256 return new AccObject(accessible_); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 } else if (V_VT(&variant) == VT_DISPATCH) { | 518 } else if (V_VT(&variant) == VT_DISPATCH) { |
| 519 return CreateFromDispatch(V_DISPATCH(&variant)); | 519 return CreateFromDispatch(V_DISPATCH(&variant)); |
| 520 } | 520 } |
| 521 LOG(WARNING) << "Unrecognizable child type"; | 521 LOG(WARNING) << "Unrecognizable child type"; |
| 522 return NULL; | 522 return NULL; |
| 523 } | 523 } |
| 524 | 524 |
| 525 bool AccObject::PostMouseClickAtCenter(int button_down, int button_up) { | 525 bool AccObject::PostMouseClickAtCenter(int button_down, int button_up) { |
| 526 std::wstring class_name; | 526 std::wstring class_name; |
| 527 if (!GetWindowClassName(&class_name)) { | 527 if (!GetWindowClassName(&class_name)) { |
| 528 DLOG(ERROR) << "Could not get class name of window for accessibility " | 528 LOG(ERROR) << "Could not get class name of window for accessibility " |
| 529 << "object: " << GetDescription(); | 529 << "object: " << GetDescription(); |
| 530 return false; | 530 return false; |
| 531 } | 531 } |
| 532 gfx::Rect location; | 532 gfx::Rect location; |
| 533 if (class_name == L"#32768") { | 533 if (class_name == L"#32768") { |
| 534 // For some reason, it seems that menus expect screen coordinates. | 534 // For some reason, it seems that menus expect screen coordinates. |
| 535 if (!GetLocation(&location)) | 535 if (!GetLocation(&location)) |
| 536 return false; | 536 return false; |
| 537 } else { | 537 } else { |
| 538 if (!GetLocationInClient(&location)) | 538 if (!GetLocationInClient(&location)) |
| 539 return false; | 539 return false; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return desk; | 739 return desk; |
| 740 } | 740 } |
| 741 | 741 |
| 742 FilePath GetIAccessible2ProxyStubPath() { | 742 FilePath GetIAccessible2ProxyStubPath() { |
| 743 FilePath path; | 743 FilePath path; |
| 744 PathService::Get(chrome::DIR_APP, &path); | 744 PathService::Get(chrome::DIR_APP, &path); |
| 745 return path.AppendASCII("IAccessible2Proxy.dll"); | 745 return path.AppendASCII("IAccessible2Proxy.dll"); |
| 746 } | 746 } |
| 747 | 747 |
| 748 } // namespace chrome_frame_test | 748 } // namespace chrome_frame_test |
| OLD | NEW |