Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: views/controls/textfield/native_textfield_win.cc

Issue 6192007: Remove wstring from views. Part 3: Switch accessibility strings to string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/keyboard_codes.h" 9 #include "app/keyboard_codes.h"
10 #include "app/keyboard_code_conversion_win.h" 10 #include "app/keyboard_code_conversion_win.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // Set the accessible role. 388 // Set the accessible role.
389 var.vt = VT_I4; 389 var.vt = VT_I4;
390 var.lVal = ROLE_SYSTEM_TEXT; 390 var.lVal = ROLE_SYSTEM_TEXT;
391 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT, 391 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT,
392 CHILDID_SELF, PROPID_ACC_ROLE, var); 392 CHILDID_SELF, PROPID_ACC_ROLE, var);
393 393
394 // Set the accessible name by getting the label text. 394 // Set the accessible name by getting the label text.
395 View* parent = textfield_->GetParent(); 395 View* parent = textfield_->GetParent();
396 int label_index = parent->GetChildIndex(textfield_) - 1; 396 int label_index = parent->GetChildIndex(textfield_) - 1;
397 if (label_index >= 0) { 397 if (label_index >= 0) {
398 // Try to find the name of this text field. 398 // Try to find the name of this text field.
399 // We expect it to be a Label preceeding this view (if it exists). 399 // We expect it to be a Label preceeding this view (if it exists).
400 std::wstring name; 400 string16 name;
401 View* label_view = parent->GetChildViewAt(label_index ); 401 View* label_view = parent->GetChildViewAt(label_index);
402 if (label_view ->GetClassName() == Label::kViewClassName && 402 if (label_view->GetClassName() == Label::kViewClassName &&
403 label_view ->GetAccessibleName(&name)) { 403 label_view->GetAccessibleName(&name)) {
404 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, 404 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT,
405 CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); 405 CHILDID_SELF, PROPID_ACC_NAME, name.c_str());
406 } 406 }
407 } 407 }
408 } 408 }
409 409
410 void NativeTextfieldWin::UpdateAccessibleState(uint32 state_flag, 410 void NativeTextfieldWin::UpdateAccessibleState(uint32 state_flag,
411 bool set_value) { 411 bool set_value) {
412 base::win::ScopedComPtr<IAccPropServices> pAccPropServices; 412 base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
413 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, 413 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 //////////////////////////////////////////////////////////////////////////////// 1111 ////////////////////////////////////////////////////////////////////////////////
1112 // NativeTextfieldWrapper, public: 1112 // NativeTextfieldWrapper, public:
1113 1113
1114 // static 1114 // static
1115 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( 1115 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper(
1116 Textfield* field) { 1116 Textfield* field) {
1117 return new NativeTextfieldWin(field); 1117 return new NativeTextfieldWin(field);
1118 } 1118 }
1119 1119
1120 } // namespace views 1120 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698