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