OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/textfield/native_textfield_win.h" | 5 #include "views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 // Set the accessible role. | 389 // Set the accessible role. |
390 var.vt = VT_I4; | 390 var.vt = VT_I4; |
391 var.lVal = ROLE_SYSTEM_TEXT; | 391 var.lVal = ROLE_SYSTEM_TEXT; |
392 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT, | 392 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT, |
393 CHILDID_SELF, PROPID_ACC_ROLE, var); | 393 CHILDID_SELF, PROPID_ACC_ROLE, var); |
394 | 394 |
395 // Set the accessible name by getting the label text. | 395 // Set the accessible name by getting the label text. |
396 View* parent = textfield_->GetParent(); | 396 View* parent = textfield_->GetParent(); |
397 int label_index = parent->GetChildIndex(textfield_) - 1; | 397 int label_index = parent->GetChildIndex(textfield_) - 1; |
398 if (label_index >= 0) { | 398 if (label_index >= 0) { |
399 // Try to find the name of this text field. | 399 // Try to find the name of this text field. |
400 // We expect it to be a Label preceeding this view (if it exists). | 400 // We expect it to be a Label preceeding this view (if it exists). |
401 std::wstring name; | 401 string16 name; |
402 View* label_view = parent->GetChildViewAt(label_index ); | 402 View* label_view = parent->GetChildViewAt(label_index); |
403 if (label_view ->GetClassName() == Label::kViewClassName && | 403 if (label_view->GetClassName() == Label::kViewClassName && |
404 label_view ->GetAccessibleName(&name)) { | 404 label_view->GetAccessibleName(&name)) { |
405 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, | 405 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, |
406 CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); | 406 CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); |
407 } | 407 } |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 void NativeTextfieldWin::UpdateAccessibleState(uint32 state_flag, | 411 void NativeTextfieldWin::UpdateAccessibleState(uint32 state_flag, |
412 bool set_value) { | 412 bool set_value) { |
413 base::win::ScopedComPtr<IAccPropServices> pAccPropServices; | 413 base::win::ScopedComPtr<IAccPropServices> pAccPropServices; |
414 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, | 414 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1119 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1120 Textfield* field) { | 1120 Textfield* field) { |
1121 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { | 1121 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { |
1122 return new NativeTextfieldViews(field); | 1122 return new NativeTextfieldViews(field); |
1123 } else { | 1123 } else { |
1124 return new NativeTextfieldWin(field); | 1124 return new NativeTextfieldWin(field); |
1125 } | 1125 } |
1126 } | 1126 } |
1127 | 1127 |
1128 } // namespace views | 1128 } // namespace views |
OLD | NEW |