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

Side by Side Diff: views/controls/tree/tree_view.cc

Issue 5154009: Cleanup AdjustStringForLocaleDirection() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: further fixes Created 10 years 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/tree/tree_view.h" 5 #include "views/controls/tree/tree_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/keyboard_code_conversion_win.h" 9 #include "app/keyboard_code_conversion_win.h"
10 #include "app/keyboard_codes.h" 10 #include "app/keyboard_codes.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 NMTVDISPINFO* info = reinterpret_cast<NMTVDISPINFO*>(l_param); 363 NMTVDISPINFO* info = reinterpret_cast<NMTVDISPINFO*>(l_param);
364 const NodeDetails* details = 364 const NodeDetails* details =
365 GetNodeDetailsByID(static_cast<int>(info->item.lParam)); 365 GetNodeDetailsByID(static_cast<int>(info->item.lParam));
366 if (info->item.mask & TVIF_CHILDREN) 366 if (info->item.mask & TVIF_CHILDREN)
367 info->item.cChildren = model_->GetChildCount(details->node); 367 info->item.cChildren = model_->GetChildCount(details->node);
368 if (info->item.mask & TVIF_TEXT) { 368 if (info->item.mask & TVIF_TEXT) {
369 std::wstring text = details->node->GetTitle(); 369 std::wstring text = details->node->GetTitle();
370 DCHECK(info->item.cchTextMax); 370 DCHECK(info->item.cchTextMax);
371 371
372 // Adjust the string direction if such adjustment is required. 372 // Adjust the string direction if such adjustment is required.
373 std::wstring localized_text; 373 base::i18n::AdjustStringForLocaleDirection(&text);
374 if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text))
375 text.swap(localized_text);
376 374
377 wcsncpy_s(info->item.pszText, info->item.cchTextMax, text.c_str(), 375 wcsncpy_s(info->item.pszText, info->item.cchTextMax, text.c_str(),
378 _TRUNCATE); 376 _TRUNCATE);
379 } 377 }
380 // Instructs windows to cache the values for this node. 378 // Instructs windows to cache the values for this node.
381 info->item.mask |= TVIF_DI_SETITEM; 379 info->item.mask |= TVIF_DI_SETITEM;
382 // Return value ignored. 380 // Return value ignored.
383 return 0; 381 return 0;
384 } 382 }
385 383
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 759 }
762 // Fall through and let the default handler process as well. 760 // Fall through and let the default handler process as well.
763 break; 761 break;
764 } 762 }
765 WNDPROC handler = tree->original_handler_; 763 WNDPROC handler = tree->original_handler_;
766 DCHECK(handler); 764 DCHECK(handler);
767 return CallWindowProc(handler, window, message, w_param, l_param); 765 return CallWindowProc(handler, window, message, w_param, l_param);
768 } 766 }
769 767
770 } // namespace views 768 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698