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

Side by Side Diff: ui/views/controls/menu/menu_item_view.cc

Issue 111373008: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
« no previous file with comments | « ui/views/controls/menu/menu_item_view.h ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/controls/menu/menu_item_view.h" 5 #include "ui/views/controls/menu/menu_item_view.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 anchor == MenuItemView::BUBBLE_BELOW; 188 anchor == MenuItemView::BUBBLE_BELOW;
189 } 189 }
190 190
191 // static 191 // static
192 base::string16 MenuItemView::GetAccessibleNameForMenuItem( 192 base::string16 MenuItemView::GetAccessibleNameForMenuItem(
193 const base::string16& item_text, const base::string16& minor_text) { 193 const base::string16& item_text, const base::string16& minor_text) {
194 base::string16 accessible_name = item_text; 194 base::string16 accessible_name = item_text;
195 195
196 // Filter out the "&" for accessibility clients. 196 // Filter out the "&" for accessibility clients.
197 size_t index = 0; 197 size_t index = 0;
198 const char16 amp = '&'; 198 const base::char16 amp = '&';
199 while ((index = accessible_name.find(amp, index)) != base::string16::npos && 199 while ((index = accessible_name.find(amp, index)) != base::string16::npos &&
200 index + 1 < accessible_name.length()) { 200 index + 1 < accessible_name.length()) {
201 accessible_name.replace(index, accessible_name.length() - index, 201 accessible_name.replace(index, accessible_name.length() - index,
202 accessible_name.substr(index + 1)); 202 accessible_name.substr(index + 1));
203 203
204 // Special case for "&&" (escaped for "&"). 204 // Special case for "&&" (escaped for "&").
205 if (accessible_name[index] == '&') 205 if (accessible_name[index] == '&')
206 ++index; 206 ++index;
207 } 207 }
208 208
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 436
437 const MenuItemView* MenuItemView::GetRootMenuItem() const { 437 const MenuItemView* MenuItemView::GetRootMenuItem() const {
438 const MenuItemView* item = this; 438 const MenuItemView* item = this;
439 for (const MenuItemView* parent = GetParentMenuItem(); parent; 439 for (const MenuItemView* parent = GetParentMenuItem(); parent;
440 parent = item->GetParentMenuItem()) 440 parent = item->GetParentMenuItem())
441 item = parent; 441 item = parent;
442 return item; 442 return item;
443 } 443 }
444 444
445 char16 MenuItemView::GetMnemonic() { 445 base::char16 MenuItemView::GetMnemonic() {
446 if (!GetRootMenuItem()->has_mnemonics_) 446 if (!GetRootMenuItem()->has_mnemonics_)
447 return 0; 447 return 0;
448 448
449 size_t index = 0; 449 size_t index = 0;
450 do { 450 do {
451 index = title_.find('&', index); 451 index = title_.find('&', index);
452 if (index != base::string16::npos) { 452 if (index != base::string16::npos) {
453 if (index + 1 != title_.size() && title_[index + 1] != '&') { 453 if (index + 1 != title_.size() && title_[index + 1] != '&') {
454 char16 char_array[] = { title_[index + 1], 0 }; 454 base::char16 char_array[] = { title_[index + 1], 0 };
455 // TODO(jshin): What about Turkish locale? See http://crbug.com/81719. 455 // TODO(jshin): What about Turkish locale? See http://crbug.com/81719.
456 // If the mnemonic is capital I and the UI language is Turkish, 456 // If the mnemonic is capital I and the UI language is Turkish,
457 // lowercasing it results in 'small dotless i', which is different 457 // lowercasing it results in 'small dotless i', which is different
458 // from a 'dotted i'. Similar issues may exist for az and lt locales. 458 // from a 'dotted i'. Similar issues may exist for az and lt locales.
459 return base::i18n::ToLower(char_array)[0]; 459 return base::i18n::ToLower(char_array)[0];
460 } 460 }
461 index++; 461 index++;
462 } 462 }
463 } while (index != base::string16::npos); 463 } while (index != base::string16::npos);
464 return 0; 464 return 0;
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 } else { 1062 } else {
1063 const Type& type = menu_item->GetType(); 1063 const Type& type = menu_item->GetType();
1064 if (type == CHECKBOX || type == RADIO) 1064 if (type == CHECKBOX || type == RADIO)
1065 return true; 1065 return true;
1066 } 1066 }
1067 } 1067 }
1068 return false; 1068 return false;
1069 } 1069 }
1070 1070
1071 } // namespace views 1071 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_item_view.h ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698