summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 04:41:59 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 04:41:59 +0000
commit9d2951f6037aafcdae278d117b54027421937bac (patch)
tree94379892691f2cce5f9716962971fc489d417c3d /base
parentb7c2e29503c528f053cd8659e1fbe3cbff427e86 (diff)
downloadchromium_src-9d2951f6037aafcdae278d117b54027421937bac.zip
chromium_src-9d2951f6037aafcdae278d117b54027421937bac.tar.gz
chromium_src-9d2951f6037aafcdae278d117b54027421937bac.tar.bz2
Pull latest PPAPI. Change key handling to support the new API.
TEST=PPAPI UI tests BUG=none Review URL: http://codereview.chromium.org/3386019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/i18n/char_iterator.cc20
-rw-r--r--base/i18n/char_iterator.h5
2 files changed, 23 insertions, 2 deletions
diff --git a/base/i18n/char_iterator.cc b/base/i18n/char_iterator.cc
index c323c5d..a6cf944 100644
--- a/base/i18n/char_iterator.cc
+++ b/base/i18n/char_iterator.cc
@@ -40,7 +40,18 @@ UTF16CharIterator::UTF16CharIterator(const string16* str)
char_pos_(0),
char_(0) {
if (len_)
- U16_NEXT(str_, next_pos_, len_, char_);
+ ReadChar();
+}
+
+UTF16CharIterator::UTF16CharIterator(const char16* str, size_t str_len)
+ : str_(str),
+ len_(str_len),
+ array_pos_(0),
+ next_pos_(0),
+ char_pos_(0),
+ char_(0) {
+ if (len_)
+ ReadChar();
}
bool UTF16CharIterator::Advance() {
@@ -50,9 +61,14 @@ bool UTF16CharIterator::Advance() {
array_pos_ = next_pos_;
char_pos_++;
if (next_pos_ < len_)
- U16_NEXT(str_, next_pos_, len_, char_);
+ ReadChar();
return true;
}
+void UTF16CharIterator::ReadChar() {
+ // This is actually a huge macro, so is worth having in a separate function.
+ U16_NEXT(str_, next_pos_, len_, char_);
+}
+
} // namespace base
diff --git a/base/i18n/char_iterator.h b/base/i18n/char_iterator.h
index 784c6e5d..835ac06 100644
--- a/base/i18n/char_iterator.h
+++ b/base/i18n/char_iterator.h
@@ -76,6 +76,7 @@ class UTF16CharIterator {
public:
// Requires |str| to live as long as the UTF16CharIterator does.
UTF16CharIterator(const string16* str);
+ UTF16CharIterator(const char16* str, size_t str_len);
~UTF16CharIterator() {}
// Return the starting array index of the current character within the
@@ -97,6 +98,10 @@ class UTF16CharIterator {
bool Advance();
private:
+ // Fills in the current character we found and advances to the next
+ // character, updating all flags as necessary.
+ void ReadChar();
+
// The string we're iterating over.
const char16* str_;