| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 | 964 |
| 965 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { | 965 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { |
| 966 // No need to check |instance_active()| because this interface is | 966 // No need to check |instance_active()| because this interface is |
| 967 // global, and doesn't depend on any local state. | 967 // global, and doesn't depend on any local state. |
| 968 | 968 |
| 969 if (!app_name) | 969 if (!app_name) |
| 970 return E_INVALIDARG; | 970 return E_INVALIDARG; |
| 971 | 971 |
| 972 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out | 972 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out |
| 973 // the part before the "/". | 973 // the part before the "/". |
| 974 std::vector<std::string> product_components; | 974 std::vector<std::string> product_components = base::SplitString( |
| 975 base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); | 975 GetContentClient()->GetProduct(), "/", |
| 976 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 976 DCHECK_EQ(2U, product_components.size()); | 977 DCHECK_EQ(2U, product_components.size()); |
| 977 if (product_components.size() != 2) | 978 if (product_components.size() != 2) |
| 978 return E_FAIL; | 979 return E_FAIL; |
| 979 *app_name = SysAllocString(base::UTF8ToUTF16(product_components[0]).c_str()); | 980 *app_name = SysAllocString(base::UTF8ToUTF16(product_components[0]).c_str()); |
| 980 DCHECK(*app_name); | 981 DCHECK(*app_name); |
| 981 return *app_name ? S_OK : E_FAIL; | 982 return *app_name ? S_OK : E_FAIL; |
| 982 } | 983 } |
| 983 | 984 |
| 984 STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { | 985 STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { |
| 985 // No need to check |instance_active()| because this interface is | 986 // No need to check |instance_active()| because this interface is |
| 986 // global, and doesn't depend on any local state. | 987 // global, and doesn't depend on any local state. |
| 987 | 988 |
| 988 if (!app_version) | 989 if (!app_version) |
| 989 return E_INVALIDARG; | 990 return E_INVALIDARG; |
| 990 | 991 |
| 991 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out | 992 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out |
| 992 // the part after the "/". | 993 // the part after the "/". |
| 993 std::vector<std::string> product_components; | 994 std::vector<std::string> product_components = base::SplitString( |
| 994 base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); | 995 GetContentClient()->GetProduct(), "/", |
| 996 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 995 DCHECK_EQ(2U, product_components.size()); | 997 DCHECK_EQ(2U, product_components.size()); |
| 996 if (product_components.size() != 2) | 998 if (product_components.size() != 2) |
| 997 return E_FAIL; | 999 return E_FAIL; |
| 998 *app_version = | 1000 *app_version = |
| 999 SysAllocString(base::UTF8ToUTF16(product_components[1]).c_str()); | 1001 SysAllocString(base::UTF8ToUTF16(product_components[1]).c_str()); |
| 1000 DCHECK(*app_version); | 1002 DCHECK(*app_version); |
| 1001 return *app_version ? S_OK : E_FAIL; | 1003 return *app_version ? S_OK : E_FAIL; |
| 1002 } | 1004 } |
| 1003 | 1005 |
| 1004 STDMETHODIMP BrowserAccessibilityWin::get_toolkitName(BSTR* toolkit_name) { | 1006 STDMETHODIMP BrowserAccessibilityWin::get_toolkitName(BSTR* toolkit_name) { |
| (...skipping 3474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4479 ia2_role = ia_role; | 4481 ia2_role = ia_role; |
| 4480 | 4482 |
| 4481 win_attributes_->ia_role = ia_role; | 4483 win_attributes_->ia_role = ia_role; |
| 4482 win_attributes_->ia_state = ia_state; | 4484 win_attributes_->ia_state = ia_state; |
| 4483 win_attributes_->role_name = role_name; | 4485 win_attributes_->role_name = role_name; |
| 4484 win_attributes_->ia2_role = ia2_role; | 4486 win_attributes_->ia2_role = ia2_role; |
| 4485 win_attributes_->ia2_state = ia2_state; | 4487 win_attributes_->ia2_state = ia2_state; |
| 4486 } | 4488 } |
| 4487 | 4489 |
| 4488 } // namespace content | 4490 } // namespace content |
| OLD | NEW |