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

Side by Side Diff: webkit/plugins/ppapi/event_conversion.cc

Issue 6355005: base/i18n: Add namespace i18n to CharIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brett review 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
« no previous file with comments | « chrome/browser/chromeos/login/wizard_accessibility_handler.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/event_conversion.h" 5 #include "webkit/plugins/ppapi/event_conversion.h"
6 6
7 #include "base/i18n/char_iterator.h" 7 #include "base/i18n/char_iterator.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // just padded with 0 values for the unused ones, but is not necessarily 87 // just padded with 0 values for the unused ones, but is not necessarily
88 // null-terminated. 88 // null-terminated.
89 // 89 //
90 // Here we see how many UTF-16 characters we have. 90 // Here we see how many UTF-16 characters we have.
91 size_t utf16_char_count = 0; 91 size_t utf16_char_count = 0;
92 while (utf16_char_count < WebKeyboardEvent::textLengthCap && 92 while (utf16_char_count < WebKeyboardEvent::textLengthCap &&
93 key_event.text[utf16_char_count]) 93 key_event.text[utf16_char_count])
94 utf16_char_count++; 94 utf16_char_count++;
95 95
96 // Make a separate PP_InputEvent for each Unicode character in the input. 96 // Make a separate PP_InputEvent for each Unicode character in the input.
97 base::UTF16CharIterator iter(key_event.text, utf16_char_count); 97 base::i18n::UTF16CharIterator iter(key_event.text, utf16_char_count);
98 while (!iter.end()) { 98 while (!iter.end()) {
99 PP_InputEvent result = GetPPEventWithCommonFieldsAndType(event); 99 PP_InputEvent result = GetPPEventWithCommonFieldsAndType(event);
100 result.u.character.modifier = key_event.modifiers; 100 result.u.character.modifier = key_event.modifiers;
101 101
102 std::string utf8_char; 102 std::string utf8_char;
103 base::WriteUnicodeCharacter(iter.get(), &utf8_char); 103 base::WriteUnicodeCharacter(iter.get(), &utf8_char);
104 base::strlcpy(result.u.character.text, utf8_char.c_str(), 104 base::strlcpy(result.u.character.text, utf8_char.c_str(),
105 sizeof(result.u.character.text)); 105 sizeof(result.u.character.text));
106 106
107 pp_events->push_back(result); 107 pp_events->push_back(result);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 case PP_INPUTEVENT_TYPE_CHAR: 293 case PP_INPUTEVENT_TYPE_CHAR:
294 web_input_event.reset(BuildCharEvent(event)); 294 web_input_event.reset(BuildCharEvent(event));
295 break; 295 break;
296 } 296 }
297 297
298 return web_input_event.release(); 298 return web_input_event.release();
299 } 299 }
300 } // namespace ppapi 300 } // namespace ppapi
301 } // namespace webkit 301 } // namespace webkit
302 302
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_accessibility_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698