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

Side by Side Diff: content/renderer/pepper/event_conversion.cc

Issue 121033002: Update uses of UTF conversions in content/ 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 | « content/renderer/npapi/webplugin_impl.cc ('k') | content/renderer/pepper/host_globals.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 "content/renderer/pepper/event_conversion.h" 5 #include "content/renderer/pepper/event_conversion.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/i18n/char_iterator.h" 10 #include "base/i18n/char_iterator.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 363
364 WebKeyboardEvent* BuildCharEvent(const InputEventData& event) { 364 WebKeyboardEvent* BuildCharEvent(const InputEventData& event) {
365 WebKeyboardEvent* key_event = new WebKeyboardEvent(); 365 WebKeyboardEvent* key_event = new WebKeyboardEvent();
366 key_event->type = WebInputEvent::Char; 366 key_event->type = WebInputEvent::Char;
367 key_event->timeStampSeconds = PPTimeTicksToEventTime(event.event_time_stamp); 367 key_event->timeStampSeconds = PPTimeTicksToEventTime(event.event_time_stamp);
368 key_event->modifiers = event.event_modifiers; 368 key_event->modifiers = event.event_modifiers;
369 369
370 // Make sure to not read beyond the buffer in case some bad code doesn't 370 // Make sure to not read beyond the buffer in case some bad code doesn't
371 // NULL-terminate it (this is called from plugins). 371 // NULL-terminate it (this is called from plugins).
372 size_t text_length_cap = WebKeyboardEvent::textLengthCap; 372 size_t text_length_cap = WebKeyboardEvent::textLengthCap;
373 base::string16 text16 = UTF8ToUTF16(event.character_text); 373 base::string16 text16 = base::UTF8ToUTF16(event.character_text);
374 374
375 memset(key_event->text, 0, text_length_cap); 375 memset(key_event->text, 0, text_length_cap);
376 memset(key_event->unmodifiedText, 0, text_length_cap); 376 memset(key_event->unmodifiedText, 0, text_length_cap);
377 for (size_t i = 0; 377 for (size_t i = 0;
378 i < std::min(text_length_cap, text16.size()); 378 i < std::min(text_length_cap, text16.size());
379 ++i) 379 ++i)
380 key_event->text[i] = text16[i]; 380 key_event->text[i] = text16[i];
381 return key_event; 381 return key_event;
382 } 382 }
383 383
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 case WebInputEvent::TouchStart: 725 case WebInputEvent::TouchStart:
726 return PP_INPUTEVENT_CLASS_TOUCH; 726 return PP_INPUTEVENT_CLASS_TOUCH;
727 case WebInputEvent::Undefined: 727 case WebInputEvent::Undefined:
728 default: 728 default:
729 NOTREACHED(); 729 NOTREACHED();
730 return PP_InputEvent_Class(0); 730 return PP_InputEvent_Class(0);
731 } 731 }
732 } 732 }
733 733
734 } // namespace content 734 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/npapi/webplugin_impl.cc ('k') | content/renderer/pepper/host_globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698