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

Side by Side Diff: ui/gfx/text_utils.cc

Issue 16051006: ui/gfx: Use base::string16 now that string16 was moved into base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ui/gfx/text_utils.h ('k') | ui/gfx/text_utils_unittest.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/gfx/text_utils.h" 5 #include "ui/gfx/text_utils.h"
6 6
7 #include "base/i18n/char_iterator.h" 7 #include "base/i18n/char_iterator.h"
8 8
9 namespace gfx { 9 namespace gfx {
10 10
11 string16 RemoveAcceleratorChar(const string16& s, 11 base::string16 RemoveAcceleratorChar(const base::string16& s,
12 char16 accelerator_char, 12 base::char16 accelerator_char,
13 int* accelerated_char_pos, 13 int* accelerated_char_pos,
14 int* accelerated_char_span) { 14 int* accelerated_char_span) {
15 bool escaped = false; 15 bool escaped = false;
16 ptrdiff_t last_char_pos = -1; 16 ptrdiff_t last_char_pos = -1;
17 int last_char_span = 0; 17 int last_char_span = 0;
18 base::i18n::UTF16CharIterator chars(&s); 18 base::i18n::UTF16CharIterator chars(&s);
19 string16 accelerator_removed; 19 base::string16 accelerator_removed;
20 20
21 accelerator_removed.reserve(s.size()); 21 accelerator_removed.reserve(s.size());
22 while (!chars.end()) { 22 while (!chars.end()) {
23 int32 c = chars.get(); 23 int32 c = chars.get();
24 int array_pos = chars.array_pos(); 24 int array_pos = chars.array_pos();
25 chars.Advance(); 25 chars.Advance();
26 26
27 if (c != accelerator_char || escaped) { 27 if (c != accelerator_char || escaped) {
28 int span = chars.array_pos() - array_pos; 28 int span = chars.array_pos() - array_pos;
29 if (escaped && c != accelerator_char) { 29 if (escaped && c != accelerator_char) {
(...skipping 10 matching lines...) Expand all
40 40
41 if (accelerated_char_pos) 41 if (accelerated_char_pos)
42 *accelerated_char_pos = last_char_pos; 42 *accelerated_char_pos = last_char_pos;
43 if (accelerated_char_span) 43 if (accelerated_char_span)
44 *accelerated_char_span = last_char_span; 44 *accelerated_char_span = last_char_span;
45 45
46 return accelerator_removed; 46 return accelerator_removed;
47 } 47 }
48 48
49 } // namespace gfx 49 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/text_utils.h ('k') | ui/gfx/text_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698