summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 05:12:29 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 05:12:29 +0000
commitb5b2385af64eb08b1feb53fb0ad65c835f472912 (patch)
tree6af57cd4a4965cebe2107e07ca8e563444c3afe9
parent80d6524d33061e0e4f7b06dd87ee94de3e05c7a8 (diff)
downloadchromium_src-b5b2385af64eb08b1feb53fb0ad65c835f472912.zip
chromium_src-b5b2385af64eb08b1feb53fb0ad65c835f472912.tar.gz
chromium_src-b5b2385af64eb08b1feb53fb0ad65c835f472912.tar.bz2
Use 'icu::' namespace explicitly throughout Chrome tree instead of relying on 'using namespace icu'.
This is Chrome's counterpart to the ICU header change that disables 'using namespace icu' (http://codereview.chromium.org/171010/show), which is required to avoid the name colission between Chrome's StringPiece (in base) and ICU's StringPiece. The webkit change (which is minor) will be dealt with in the webkit bugzilla. This can go in before the ICU change/upgrade without affecting anything. BUG=8198 TEST=All the targets are built without an error on all platforms. Review URL: http://codereview.chromium.org/171012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23613 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/gfx/text_elider.cc2
-rw-r--r--app/gfx/text_elider.h2
-rw-r--r--app/gfx/text_elider_unittest.cc3
-rw-r--r--app/l10n_util.cc25
-rw-r--r--app/l10n_util.h18
-rw-r--r--app/l10n_util_unittest.cc8
-rw-r--r--app/table_model.cc8
-rw-r--r--app/table_model.h2
-rw-r--r--base/file_util_icu.cc8
-rw-r--r--base/file_util_posix.cc6
-rw-r--r--base/string_util_icu.cc12
-rw-r--r--base/time_format.cc28
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc10
-rw-r--r--chrome/browser/history/snippet.cc10
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util.cc2
-rw-r--r--chrome/browser/spellcheck_worditerator.cc16
-rw-r--r--chrome/browser/task_manager.cc4
-rw-r--r--chrome/common/time_format.cc52
-rw-r--r--net/base/net_util.cc32
19 files changed, 125 insertions, 123 deletions
diff --git a/app/gfx/text_elider.cc b/app/gfx/text_elider.cc
index 72ee61d..7f56fac 100644
--- a/app/gfx/text_elider.cc
+++ b/app/gfx/text_elider.cc
@@ -337,7 +337,7 @@ SortedDisplayURL::SortedDisplayURL(const GURL& url,
}
int SortedDisplayURL::Compare(const SortedDisplayURL& other,
- Collator* collator) const {
+ icu::Collator* collator) const {
// Compare on hosts first. The host won't contain 'www.'.
UErrorCode compare_status = U_ZERO_ERROR;
UCollationResult host_compare_result = collator->compare(
diff --git a/app/gfx/text_elider.h b/app/gfx/text_elider.h
index 96afdfb..4c9c1fa 100644
--- a/app/gfx/text_elider.h
+++ b/app/gfx/text_elider.h
@@ -60,7 +60,7 @@ class SortedDisplayURL {
// Compares this SortedDisplayURL to |url| using |collator|. Returns a value
// < 0, = 1 or > 0 as to whether this url is less then, equal to or greater
// than the supplied url.
- int Compare(const SortedDisplayURL& other, Collator* collator) const;
+ int Compare(const SortedDisplayURL& other, icu::Collator* collator) const;
// Returns the display string for the URL.
const string16& display_url() const { return display_url_; }
diff --git a/app/gfx/text_elider_unittest.cc b/app/gfx/text_elider_unittest.cc
index 03e0bad..bf07428 100644
--- a/app/gfx/text_elider_unittest.cc
+++ b/app/gfx/text_elider_unittest.cc
@@ -234,7 +234,8 @@ TEST(TextEliderTest, SortedDisplayURL) {
// Verifies DisplayURL::Compare works correctly.
TEST(TextEliderTest, SortedDisplayURLCompare) {
UErrorCode create_status = U_ZERO_ERROR;
- scoped_ptr<Collator> collator(Collator::createInstance(create_status));
+ scoped_ptr<icu::Collator> collator(
+ icu::Collator::createInstance(create_status));
if (!U_SUCCESS(create_status))
return;
diff --git a/app/l10n_util.cc b/app/l10n_util.cc
index 1330263..0e263b6de 100644
--- a/app/l10n_util.cc
+++ b/app/l10n_util.cc
@@ -45,7 +45,7 @@ void GetLanguageAndRegionFromOS(std::string* lang, std::string* region) {
// it's not affected by ICU's default locale. It's all right
// to do this way because SetICUDefaultLocale is internal
// to this file and we know where/when it's called.
- Locale locale = Locale::getDefault();
+ icu::Locale locale = icu::Locale::getDefault();
const char* language = locale.getLanguage();
const char* country = locale.getCountry();
DCHECK(language);
@@ -89,9 +89,9 @@ std::string ICULocaleName(const std::string& locale_string) {
// everytime we call locale-dependent ICU APIs as long as we make sure
// that this is called before any locale-dependent API is called.
UBool SetICUDefaultLocale(const std::string& locale_string) {
- Locale locale(ICULocaleName(locale_string).c_str());
+ icu::Locale locale(ICULocaleName(locale_string).c_str());
UErrorCode error_code = U_ZERO_ERROR;
- Locale::setDefault(locale, error_code);
+ icu::Locale::setDefault(locale, error_code);
// This return value is actually bogus because Locale object is
// an ID and setDefault seems to always succeed (regardless of the
// presence of actual locale data). However,
@@ -455,19 +455,20 @@ std::wstring TruncateString(const std::wstring& string, size_t length) {
#endif
// Use a line iterator to find the first boundary.
UErrorCode status = U_ZERO_ERROR;
- scoped_ptr<RuleBasedBreakIterator> bi(static_cast<RuleBasedBreakIterator*>(
- RuleBasedBreakIterator::createLineInstance(Locale::getDefault(),
- status)));
+ scoped_ptr<icu::RuleBasedBreakIterator> bi(
+ static_cast<icu::RuleBasedBreakIterator*>(
+ icu::RuleBasedBreakIterator::createLineInstance(
+ icu::Locale::getDefault(), status)));
if (U_FAILURE(status))
return string.substr(0, max) + kElideString;
bi->setText(string_utf16.c_str());
int32_t index = bi->preceding(static_cast<int32_t>(max));
- if (index == BreakIterator::DONE) {
+ if (index == icu::BreakIterator::DONE) {
index = static_cast<int32_t>(max);
} else {
// Found a valid break (may be the beginning of the string). Now use
// a character iterator to find the previous non-whitespace character.
- StringCharacterIterator char_iterator(string_utf16.c_str());
+ icu::StringCharacterIterator char_iterator(string_utf16.c_str());
if (index == 0) {
// No valid line breaks. Start at the end again. This ensures we break
// on a valid character boundary.
@@ -503,8 +504,8 @@ std::wstring ToLower(const std::wstring& string) {
#endif // defined(WCHAR_T_IS_UTF32)
string16 ToLower(const string16& string) {
- UnicodeString lower_u_str(
- UnicodeString(string.c_str()).toLower(Locale::getDefault()));
+ icu::UnicodeString lower_u_str(
+ icu::UnicodeString(string.c_str()).toLower(icu::Locale::getDefault()));
string16 result;
lower_u_str.extract(0, lower_u_str.length(),
WriteInto(&result, lower_u_str.length() + 1));
@@ -521,7 +522,7 @@ TextDirection GetTextDirection() {
g_text_direction =
(gtk_dir == GTK_TEXT_DIR_LTR) ? LEFT_TO_RIGHT : RIGHT_TO_LEFT;
#else
- const Locale& locale = Locale::getDefault();
+ const icu::Locale& locale = icu::Locale::getDefault();
g_text_direction = GetTextDirectionForLocale(locale.getName());
#endif
}
@@ -668,7 +669,7 @@ int DefaultCanvasTextAlignment() {
// Compares the character data stored in two different strings by specified
// Collator instance.
-UCollationResult CompareStringWithCollator(const Collator* collator,
+UCollationResult CompareStringWithCollator(const icu::Collator* collator,
const std::wstring& lhs,
const std::wstring& rhs) {
DCHECK(collator);
diff --git a/app/l10n_util.h b/app/l10n_util.h
index 0944912..37a40cd 100644
--- a/app/l10n_util.h
+++ b/app/l10n_util.h
@@ -261,7 +261,7 @@ void WrapPathWithLTRFormatting(const FilePath& path,
int DefaultCanvasTextAlignment();
// Compares the two strings using the specified collator.
-UCollationResult CompareStringWithCollator(const Collator* collator,
+UCollationResult CompareStringWithCollator(const icu::Collator* collator,
const std::wstring& lhs,
const std::wstring& rhs);
@@ -273,7 +273,7 @@ class StringMethodComparatorWithCollator :
const std::wstring&,
bool> {
public:
- StringMethodComparatorWithCollator(Collator* collator, Method method)
+ StringMethodComparatorWithCollator(icu::Collator* collator, Method method)
: collator_(collator),
method_(method) { }
@@ -284,7 +284,7 @@ class StringMethodComparatorWithCollator :
}
private:
- Collator* collator_;
+ icu::Collator* collator_;
Method method_;
};
@@ -314,8 +314,8 @@ void SortStringsUsingMethod(const std::wstring& locale,
std::vector<T*>* elements,
Method method) {
UErrorCode error = U_ZERO_ERROR;
- Locale loc(WideToUTF8(locale).c_str());
- scoped_ptr<Collator> collator(Collator::createInstance(loc, error));
+ icu::Locale loc(WideToUTF8(locale).c_str());
+ scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error));
if (U_FAILURE(error)) {
sort(elements->begin(), elements->end(),
StringMethodComparator<T,Method>(method));
@@ -336,7 +336,7 @@ class StringComparator : public std::binary_function<const Element&,
const Element&,
bool> {
public:
- explicit StringComparator(Collator* collator)
+ explicit StringComparator(icu::Collator* collator)
: collator_(collator) { }
// Returns true if lhs precedes rhs.
@@ -349,7 +349,7 @@ class StringComparator : public std::binary_function<const Element&,
}
private:
- Collator* collator_;
+ icu::Collator* collator_;
};
// Specialization of operator() method for std::wstring version.
@@ -371,8 +371,8 @@ void SortVectorWithStringKey(const std::string& locale,
DCHECK(begin_index >= 0 && begin_index < end_index &&
end_index <= static_cast<unsigned int>(elements->size()));
UErrorCode error = U_ZERO_ERROR;
- Locale loc(locale.c_str());
- scoped_ptr<Collator> collator(Collator::createInstance(loc, error));
+ icu::Locale loc(locale.c_str());
+ scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error));
if (U_FAILURE(error))
collator.reset();
StringComparator<Element> c(collator.get());
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc
index 6906983..d763484 100644
--- a/app/l10n_util_unittest.cc
+++ b/app/l10n_util_unittest.cc
@@ -85,9 +85,9 @@ TEST_F(L10nUtilTest, TruncateString) {
}
void SetICUDefaultLocale(const std::string& locale_string) {
- Locale locale(locale_string.c_str());
+ icu::Locale locale(locale_string.c_str());
UErrorCode error_code = U_ZERO_ERROR;
- Locale::setDefault(locale, error_code);
+ icu::Locale::setDefault(locale, error_code);
EXPECT_TRUE(U_SUCCESS(error_code));
}
@@ -134,7 +134,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
}
// Keep a copy of ICU's default locale before we overwrite it.
- Locale locale = Locale::getDefault();
+ icu::Locale locale = icu::Locale::getDefault();
SetICUDefaultLocale("en-US");
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L""));
@@ -213,7 +213,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
PathService::Override(app::DIR_LOCALES, orig_locale_dir.ToWStringHack());
file_util::Delete(new_locale_dir, true);
UErrorCode error_code = U_ZERO_ERROR;
- Locale::setDefault(locale, error_code);
+ icu::Locale::setDefault(locale, error_code);
}
#endif // defined(OS_WIN) || defined(OS_LINUX)
diff --git a/app/table_model.cc b/app/table_model.cc
index 0f35905..fa4ccb7 100644
--- a/app/table_model.cc
+++ b/app/table_model.cc
@@ -68,7 +68,7 @@ TableColumn::TableColumn(int id, Alignment alignment, int width, float percent)
// TableModel -----------------------------------------------------------------
// Used for sorting.
-static Collator* collator = NULL;
+static icu::Collator* collator = NULL;
SkBitmap TableModel::GetIcon(int row) {
return SkBitmap();
@@ -79,7 +79,7 @@ int TableModel::CompareValues(int row1, int row2, int column_id) {
row2 >= 0 && row2 < RowCount());
std::wstring value1 = GetText(row1, column_id);
std::wstring value2 = GetText(row2, column_id);
- Collator* collator = GetCollator();
+ icu::Collator* collator = GetCollator();
if (collator)
return l10n_util::CompareStringWithCollator(collator, value1, value2);
@@ -88,10 +88,10 @@ int TableModel::CompareValues(int row1, int row2, int column_id) {
return 0;
}
-Collator* TableModel::GetCollator() {
+icu::Collator* TableModel::GetCollator() {
if (!collator) {
UErrorCode create_status = U_ZERO_ERROR;
- collator = Collator::createInstance(create_status);
+ collator = icu::Collator::createInstance(create_status);
if (!U_SUCCESS(create_status)) {
collator = NULL;
NOTREACHED();
diff --git a/app/table_model.h b/app/table_model.h
index ba7043e..c1e61b1 100644
--- a/app/table_model.h
+++ b/app/table_model.h
@@ -95,7 +95,7 @@ class TableModel {
protected:
// Returns the collator used by CompareValues.
- Collator* GetCollator();
+ icu::Collator* GetCollator();
};
// TableColumn specifies the title, alignment and size of a particular column.
diff --git a/base/file_util_icu.cc b/base/file_util_icu.cc
index 39e2ccf..eeffa92 100644
--- a/base/file_util_icu.cc
+++ b/base/file_util_icu.cc
@@ -24,7 +24,7 @@ class IllegalCharacters {
}
bool containsNone(const string16 &s) {
- return !!set->containsNone(UnicodeString(s.c_str(), s.size()));
+ return !!set->containsNone(icu::UnicodeString(s.c_str(), s.size()));
}
private:
@@ -34,7 +34,7 @@ class IllegalCharacters {
IllegalCharacters();
~IllegalCharacters() { }
- scoped_ptr<UnicodeSet> set;
+ scoped_ptr<icu::UnicodeSet> set;
DISALLOW_COPY_AND_ASSIGN(IllegalCharacters);
};
@@ -52,10 +52,10 @@ IllegalCharacters::IllegalCharacters() {
// freeze it only once. Note that there's a trade-off between memory and
// speed.
#if defined(WCHAR_T_IS_UTF16)
- set.reset(new UnicodeSet(UnicodeString(
+ set.reset(new icu::UnicodeSet(icu::UnicodeString(
L"[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\u200c\u200d]]"), status));
#else
- set.reset(new UnicodeSet(UNICODE_STRING_SIMPLE(
+ set.reset(new icu::UnicodeSet(UNICODE_STRING_SIMPLE(
"[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\\u200c\\u200d]]").unescape(),
status));
#endif
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index fb5a7c4..5a02278 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -40,10 +40,10 @@ class LocaleAwareComparator {
UErrorCode error_code = U_ZERO_ERROR;
// Use the default collator. The default locale should have been properly
// set by the time this constructor is called.
- collator_.reset(Collator::createInstance(error_code));
+ collator_.reset(icu::Collator::createInstance(error_code));
DCHECK(U_SUCCESS(error_code));
// Make it case-sensitive.
- collator_->setStrength(Collator::TERTIARY);
+ collator_->setStrength(icu::Collator::TERTIARY);
// Note: We do not set UCOL_NORMALIZATION_MODE attribute. In other words, we
// do not pay performance penalty to guarantee sort order correctness for
// non-FCD (http://unicode.org/notes/tn5/#FCD) file names. This should be a
@@ -71,7 +71,7 @@ class LocaleAwareComparator {
}
private:
- scoped_ptr<Collator> collator_;
+ scoped_ptr<icu::Collator> collator_;
Lock lock_;
friend struct DefaultSingletonTraits<LocaleAwareComparator>;
diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc
index 9b4eab6..a043e97 100644
--- a/base/string_util_icu.cc
+++ b/base/string_util_icu.cc
@@ -631,10 +631,10 @@ bool CodepageToUTF16(const std::string& encoded,
namespace {
struct NumberFormatSingletonTraits
- : public DefaultSingletonTraits<NumberFormat> {
- static NumberFormat* New() {
+ : public DefaultSingletonTraits<icu::NumberFormat> {
+ static icu::NumberFormat* New() {
UErrorCode status = U_ZERO_ERROR;
- NumberFormat* formatter = NumberFormat::createInstance(status);
+ icu::NumberFormat* formatter = icu::NumberFormat::createInstance(status);
DCHECK(U_SUCCESS(status));
return formatter;
}
@@ -647,14 +647,14 @@ struct NumberFormatSingletonTraits
} // namespace
std::wstring FormatNumber(int64 number) {
- NumberFormat* number_format =
- Singleton<NumberFormat, NumberFormatSingletonTraits>::get();
+ icu::NumberFormat* number_format =
+ Singleton<icu::NumberFormat, NumberFormatSingletonTraits>::get();
if (!number_format) {
// As a fallback, just return the raw number in a string.
return StringPrintf(L"%lld", number);
}
- UnicodeString ustr;
+ icu::UnicodeString ustr;
number_format->format(number, ustr);
#if defined(WCHAR_T_IS_UTF16)
diff --git a/base/time_format.cc b/base/time_format.cc
index e17b048..80c4235 100644
--- a/base/time_format.cc
+++ b/base/time_format.cc
@@ -14,10 +14,10 @@ using base::Time;
namespace {
-std::wstring TimeFormat(const DateFormat* formatter,
+std::wstring TimeFormat(const icu::DateFormat* formatter,
const Time& time) {
DCHECK(formatter);
- UnicodeString date_string;
+ icu::UnicodeString date_string;
formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
std::wstring output;
@@ -34,38 +34,38 @@ namespace base {
std::wstring TimeFormatTimeOfDay(const Time& time) {
// We can omit the locale parameter because the default should match
// Chrome's application locale.
- scoped_ptr<DateFormat> formatter(DateFormat::createTimeInstance(
- DateFormat::kShort));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createTimeInstance(icu::DateFormat::kShort));
return TimeFormat(formatter.get(), time);
}
std::wstring TimeFormatShortDate(const Time& time) {
- scoped_ptr<DateFormat> formatter(DateFormat::createDateInstance(
- DateFormat::kMedium));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createDateInstance(icu::DateFormat::kMedium));
return TimeFormat(formatter.get(), time);
}
std::wstring TimeFormatShortDateNumeric(const Time& time) {
- scoped_ptr<DateFormat> formatter(DateFormat::createDateInstance(
- DateFormat::kShort));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createDateInstance(icu::DateFormat::kShort));
return TimeFormat(formatter.get(), time);
}
std::wstring TimeFormatShortDateAndTime(const Time& time) {
- scoped_ptr<DateFormat> formatter(DateFormat::createDateTimeInstance(
- DateFormat::kShort));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createDateTimeInstance(icu::DateFormat::kShort));
return TimeFormat(formatter.get(), time);
}
std::wstring TimeFormatFriendlyDateAndTime(const Time& time) {
- scoped_ptr<DateFormat> formatter(DateFormat::createDateTimeInstance(
- DateFormat::kFull));
+ scoped_ptr<icu::DateFormat> formatter(
+ icu::DateFormat::createDateTimeInstance(icu::DateFormat::kFull));
return TimeFormat(formatter.get(), time);
}
std::wstring TimeFormatFriendlyDate(const Time& time) {
- scoped_ptr<DateFormat> formatter(DateFormat::createDateInstance(
- DateFormat::kFull));
+ scoped_ptr<icu::DateFormat> formatter(icu::DateFormat::createDateInstance(
+ icu::DateFormat::kFull));
return TimeFormat(formatter.get(), time);
}
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 9bcc8c3..2eeeff1 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -83,7 +83,7 @@ class SortComparator : public std::binary_function<const BookmarkNode*,
const BookmarkNode*,
bool> {
public:
- explicit SortComparator(Collator* collator) : collator_(collator) { }
+ explicit SortComparator(icu::Collator* collator) : collator_(collator) { }
// Returns true if lhs preceeds rhs.
bool operator() (const BookmarkNode* n1, const BookmarkNode* n2) {
@@ -99,7 +99,7 @@ class SortComparator : public std::binary_function<const BookmarkNode*,
}
private:
- Collator* collator_;
+ icu::Collator* collator_;
};
} // namespace
@@ -343,9 +343,9 @@ void BookmarkModel::SortChildren(const BookmarkNode* parent) {
}
UErrorCode error = U_ZERO_ERROR;
- scoped_ptr<Collator> collator(
- Collator::createInstance(
- Locale(g_browser_process->GetApplicationLocale().c_str()),
+ scoped_ptr<icu::Collator> collator(
+ icu::Collator::createInstance(
+ icu::Locale(g_browser_process->GetApplicationLocale().c_str()),
error));
if (U_FAILURE(error))
collator.reset(NULL);
diff --git a/chrome/browser/history/snippet.cc b/chrome/browser/history/snippet.cc
index b13a901..b44bb00 100644
--- a/chrome/browser/history/snippet.cc
+++ b/chrome/browser/history/snippet.cc
@@ -118,7 +118,7 @@ size_t AdvanceAndReturnWidePos(const char* utf8_string,
// Given a character break iterator over a UTF-8 string, set the iterator
// position to |*utf8_pos| and move by |count| characters. |count| can
// be either positive or negative.
-void MoveByNGraphemes(BreakIterator* bi, int count, size_t* utf8_pos) {
+void MoveByNGraphemes(icu::BreakIterator* bi, int count, size_t* utf8_pos) {
// Ignore the return value. A side effect of the current position
// being set at or following |*utf8_pos| is exploited here.
// It's simpler than calling following(n) and then previous().
@@ -136,7 +136,7 @@ const int kSnippetContext = 50;
// Returns true if next match falls within a snippet window
// from the previous match. The window size is counted in terms
// of graphemes rather than bytes in UTF-8.
-bool IsNextMatchWithinSnippetWindow(BreakIterator* bi,
+bool IsNextMatchWithinSnippetWindow(icu::BreakIterator* bi,
size_t previous_match_end,
size_t next_match_start) {
// If it's within a window in terms of bytes, it's certain
@@ -152,7 +152,7 @@ bool IsNextMatchWithinSnippetWindow(BreakIterator* bi,
bi->next(kSnippetContext);
int64 current = bi->current();
return (next_match_start < static_cast<uint64>(current) ||
- current == BreakIterator::DONE);
+ current == icu::BreakIterator::DONE);
}
} // namespace
@@ -211,8 +211,8 @@ void Snippet::ComputeSnippet(const MatchPositions& match_positions,
document.size(), &status);
// Locale does not matter because there's no per-locale customization
// for character iterator.
- scoped_ptr<BreakIterator> bi(
- BreakIterator::createCharacterInstance(Locale::getDefault(), status));
+ scoped_ptr<icu::BreakIterator> bi(icu::BreakIterator::createCharacterInstance(
+ icu::Locale::getDefault(), status));
bi->setText(document_utext, status);
DCHECK(U_SUCCESS(status));
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index 4f9d776..f0267c1 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -193,7 +193,7 @@ void FreeChunks(std::deque<SBChunk>* chunks) {
GURL GeneratePhishingReportUrl(const std::string& report_page,
const std::string& url_to_report) {
- Locale locale = Locale::getDefault();
+ icu::Locale locale = icu::Locale::getDefault();
const char* lang = locale.getLanguage();
if (!lang)
lang = "en"; // fallback
diff --git a/chrome/browser/spellcheck_worditerator.cc b/chrome/browser/spellcheck_worditerator.cc
index ab85fb0..dde4752 100644
--- a/chrome/browser/spellcheck_worditerator.cc
+++ b/chrome/browser/spellcheck_worditerator.cc
@@ -84,16 +84,16 @@ void SpellcheckCharAttribute::SetDefaultLanguage(const std::string& language) {
// combining characters for such languages.
// To treat such combining characters as word characters, we decompose
// this exemplar set and treat the decomposed characters as word characters.
- UnicodeString composed;
+ icu::UnicodeString composed;
for (int i = 0; i < length; ++i)
composed.append(uset_charAt(exemplar_set, i));
- UnicodeString decomposed;
- Normalizer::decompose(composed, FALSE, 0, decomposed, status);
+ icu::UnicodeString decomposed;
+ icu::Normalizer::decompose(composed, FALSE, 0, decomposed, status);
if (U_SUCCESS(status)) {
- StringCharacterIterator iterator(decomposed);
+ icu::StringCharacterIterator iterator(decomposed);
UChar32 character = iterator.first32();
- while (character != CharacterIterator::DONE) {
+ while (character != icu::CharacterIterator::DONE) {
SetWordScript(GetScriptCode(character), true);
character = iterator.next32();
}
@@ -264,10 +264,10 @@ bool SpellcheckWordIterator::Normalize(int input_start,
// does not only write NFKD and NFKC can compose ligatures into their ASCII
// alternatives, but also write NFKC keeps accents of characters.
// Therefore, NFKC seems to be the best option for hunspell.
- UnicodeString input(FALSE, &word_[input_start], input_length);
+ icu::UnicodeString input(FALSE, &word_[input_start], input_length);
UErrorCode status = U_ZERO_ERROR;
- UnicodeString output;
- Normalizer::normalize(input, UNORM_NFKC, 0, output, status);
+ icu::UnicodeString output;
+ icu::Normalizer::normalize(input, UNORM_NFKC, 0, output, status);
if (U_SUCCESS(status))
output_string->assign(output.getTerminatedBuffer());
return status == U_ZERO_ERROR || status == U_STRING_NOT_TERMINATED_WARNING;
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index b7de95e..62c00dc 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -202,10 +202,10 @@ int TaskManagerModel::CompareValues(int row1, int row2, int col_id) const {
switch (col_id) {
case IDS_TASK_MANAGER_PAGE_COLUMN: {
// Let's do the default, string compare on the resource title.
- static Collator* collator = NULL;
+ static icu::Collator* collator = NULL;
if (!collator) {
UErrorCode create_status = U_ZERO_ERROR;
- collator = Collator::createInstance(create_status);
+ collator = icu::Collator::createInstance(create_status);
if (!U_SUCCESS(create_status)) {
collator = NULL;
NOTREACHED();
diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc
index 80fe242b..a692218 100644
--- a/chrome/common/time_format.cc
+++ b/chrome/common/time_format.cc
@@ -113,7 +113,7 @@ enum FormatType {
class TimeFormatter {
public:
- const std::vector<PluralFormat*>& formatter(FormatType format_type) {
+ const std::vector<icu::PluralFormat*>& formatter(FormatType format_type) {
switch (format_type) {
case FORMAT_SHORT:
return short_formatter_;
@@ -171,39 +171,38 @@ class TimeFormatter {
friend class Singleton<TimeFormatter>;
friend struct DefaultSingletonTraits<TimeFormatter>;
- std::vector<PluralFormat*> short_formatter_;
- std::vector<PluralFormat*> time_left_formatter_;
- std::vector<PluralFormat*> time_elapsed_formatter_;
+ std::vector<icu::PluralFormat*> short_formatter_;
+ std::vector<icu::PluralFormat*> time_left_formatter_;
+ std::vector<icu::PluralFormat*> time_elapsed_formatter_;
static void BuildFormats(FormatType format_type,
- std::vector<PluralFormat*>* time_formats);
- static PluralFormat* createFallbackFormat(const PluralRules& rules,
- int index,
- FormatType format_type);
+ std::vector<icu::PluralFormat*>* time_formats);
+ static icu::PluralFormat* createFallbackFormat(
+ const icu::PluralRules& rules, int index, FormatType format_type);
DISALLOW_EVIL_CONSTRUCTORS(TimeFormatter);
};
-void TimeFormatter::BuildFormats(FormatType format_type,
- std::vector<PluralFormat*>* time_formats) {
- const static UnicodeString kKeywords[] = {
+void TimeFormatter::BuildFormats(
+ FormatType format_type, std::vector<icu::PluralFormat*>* time_formats) {
+ static const icu::UnicodeString kKeywords[] = {
UNICODE_STRING_SIMPLE("other"), UNICODE_STRING_SIMPLE("one"),
UNICODE_STRING_SIMPLE("zero"), UNICODE_STRING_SIMPLE("two"),
UNICODE_STRING_SIMPLE("few"), UNICODE_STRING_SIMPLE("many")
};
UErrorCode err = U_ZERO_ERROR;
- scoped_ptr<PluralRules> rules(
- PluralRules::forLocale(Locale::getDefault(), err));
+ scoped_ptr<icu::PluralRules> rules(
+ icu::PluralRules::forLocale(icu::Locale::getDefault(), err));
if (U_FAILURE(err)) {
err = U_ZERO_ERROR;
- UnicodeString fallback_rules("one: n is 1", -1, US_INV);
- rules.reset(PluralRules::createRules(fallback_rules, err));
+ icu::UnicodeString fallback_rules("one: n is 1", -1, US_INV);
+ rules.reset(icu::PluralRules::createRules(fallback_rules, err));
DCHECK(U_SUCCESS(err));
}
const MessageIDs& message_ids = GetMessageIDs(format_type);
for (int i = 0; i < 4; ++i) {
- UnicodeString pattern;
+ icu::UnicodeString pattern;
for (size_t j = 0; j < arraysize(kKeywords); ++j) {
int msg_id = message_ids.ids[i][j];
std::string sub_pattern = WideToUTF8(l10n_util::GetString(msg_id));
@@ -216,11 +215,11 @@ void TimeFormatter::BuildFormats(FormatType format_type,
(j == 0 || rules->isKeyword(kKeywords[j]))) {
pattern += kKeywords[j];
pattern += UNICODE_STRING_SIMPLE("{");
- pattern += UnicodeString(sub_pattern.c_str(), "UTF-8");
+ pattern += icu::UnicodeString(sub_pattern.c_str(), "UTF-8");
pattern += UNICODE_STRING_SIMPLE("}");
}
}
- PluralFormat* format = new PluralFormat(*rules, pattern, err);
+ icu::PluralFormat* format = new icu::PluralFormat(*rules, pattern, err);
if (U_SUCCESS(err)) {
time_formats->push_back(format);
} else {
@@ -234,23 +233,22 @@ void TimeFormatter::BuildFormats(FormatType format_type,
// Create a hard-coded fallback plural format. This will never be called
// unless translators make a mistake.
-PluralFormat* TimeFormatter::createFallbackFormat(const PluralRules& rules,
- int index,
- FormatType format_type) {
- const static UnicodeString kUnits[4][2] = {
+icu::PluralFormat* TimeFormatter::createFallbackFormat(
+ const icu::PluralRules& rules, int index, FormatType format_type) {
+ static const icu::UnicodeString kUnits[4][2] = {
{ UNICODE_STRING_SIMPLE("sec"), UNICODE_STRING_SIMPLE("secs") },
{ UNICODE_STRING_SIMPLE("min"), UNICODE_STRING_SIMPLE("mins") },
{ UNICODE_STRING_SIMPLE("hour"), UNICODE_STRING_SIMPLE("hours") },
{ UNICODE_STRING_SIMPLE("day"), UNICODE_STRING_SIMPLE("days") }
};
- UnicodeString suffix(GetFallbackFormatSuffix(format_type), -1, US_INV);
- UnicodeString pattern;
+ icu::UnicodeString suffix(GetFallbackFormatSuffix(format_type), -1, US_INV);
+ icu::UnicodeString pattern;
if (rules.isKeyword(UNICODE_STRING_SIMPLE("one"))) {
pattern += UNICODE_STRING_SIMPLE("one{# ") + kUnits[index][0] + suffix;
}
pattern += UNICODE_STRING_SIMPLE(" other{# ") + kUnits[index][1] + suffix;
UErrorCode err = U_ZERO_ERROR;
- PluralFormat* format = new PluralFormat(rules, pattern, err);
+ icu::PluralFormat* format = new icu::PluralFormat(rules, pattern, err);
DCHECK(U_SUCCESS(err));
return format;
}
@@ -266,11 +264,11 @@ static std::wstring FormatTimeImpl(const TimeDelta& delta,
int number;
- const std::vector<PluralFormat*>& formatters =
+ const std::vector<icu::PluralFormat*>& formatters =
time_formatter->formatter(format_type);
UErrorCode error = U_ZERO_ERROR;
- UnicodeString time_string;
+ icu::UnicodeString time_string;
// Less than a minute gets "X seconds left"
if (delta.ToInternalValue() < Time::kMicrosecondsPerMinute) {
number = static_cast<int>(delta.ToInternalValue() /
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 492f7a8..9224cc1 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -494,7 +494,7 @@ bool IsCompatibleWithASCIILetters(const std::string& lang) {
!lang.substr(0, 2).compare("ko");
}
-typedef std::map<std::string, UnicodeSet*> LangToExemplarSetMap;
+typedef std::map<std::string, icu::UnicodeSet*> LangToExemplarSetMap;
class LangToExemplarSet {
private:
@@ -506,13 +506,14 @@ class LangToExemplarSet {
friend class Singleton<LangToExemplarSet>;
friend struct DefaultSingletonTraits<LangToExemplarSet>;
- friend bool GetExemplarSetForLang(const std::string&, UnicodeSet**);
- friend void SetExemplarSetForLang(const std::string&, UnicodeSet*);
+ friend bool GetExemplarSetForLang(const std::string&, icu::UnicodeSet**);
+ friend void SetExemplarSetForLang(const std::string&, icu::UnicodeSet*);
DISALLOW_COPY_AND_ASSIGN(LangToExemplarSet);
};
-bool GetExemplarSetForLang(const std::string& lang, UnicodeSet** lang_set) {
+bool GetExemplarSetForLang(const std::string& lang,
+ icu::UnicodeSet** lang_set) {
const LangToExemplarSetMap& map = Singleton<LangToExemplarSet>()->map;
LangToExemplarSetMap::const_iterator pos = map.find(lang);
if (pos != map.end()) {
@@ -522,7 +523,8 @@ bool GetExemplarSetForLang(const std::string& lang, UnicodeSet** lang_set) {
return false;
}
-void SetExemplarSetForLang(const std::string& lang, UnicodeSet* lang_set) {
+void SetExemplarSetForLang(const std::string& lang,
+ icu::UnicodeSet* lang_set) {
LangToExemplarSetMap& map = Singleton<LangToExemplarSet>()->map;
map.insert(std::make_pair(lang, lang_set));
}
@@ -531,10 +533,10 @@ static Lock lang_set_lock;
// Returns true if all the characters in component_characters are used by
// the language |lang|.
-bool IsComponentCoveredByLang(const UnicodeSet& component_characters,
+bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters,
const std::string& lang) {
- static const UnicodeSet kASCIILetters(0x61, 0x7a); // [a-z]
- UnicodeSet* lang_set;
+ static const icu::UnicodeSet kASCIILetters(0x61, 0x7a); // [a-z]
+ icu::UnicodeSet* lang_set;
// We're called from both the UI thread and the history thread.
{
AutoLock lock(lang_set_lock);
@@ -549,14 +551,14 @@ bool IsComponentCoveredByLang(const UnicodeSet& component_characters,
// (issue 2078)
// DCHECK(U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING);
if (U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING) {
- lang_set = reinterpret_cast<UnicodeSet *>(
+ lang_set = reinterpret_cast<icu::UnicodeSet *>(
ulocdata_getExemplarSet(uld, NULL, 0,
ULOCDATA_ES_STANDARD, &status));
// If |lang| is compatible with ASCII Latin letters, add them.
if (IsCompatibleWithASCIILetters(lang))
lang_set->addAll(kASCIILetters);
} else {
- lang_set = new UnicodeSet(1, 0);
+ lang_set = new icu::UnicodeSet(1, 0);
}
lang_set->freeze();
SetExemplarSetForLang(lang, lang_set);
@@ -598,7 +600,7 @@ bool IsIDNComponentSafe(const char16* str,
L"[\ufffa-\ufffd]]"), status);
#else
UnicodeSet dangerous_characters(UnicodeString(
- "[[\\ \\u0020\\u00bc\\u00bd\\u01c3\\u0337\\u0338"
+ "[[\\u0020\\u00bc\\u00bd\\u01c3\\u0337\\u0338"
"\\u05c3\\u05f4\\u06d4\\u0702\\u115f\\u1160][\\u2000-\\u200b]"
"[\\u2024\\u2027\\u2028\\u2029\\u2039\\u203a\\u2044\\u205f]"
"[\\u2154-\\u2156][\\u2159-\\u215b][\\u215f\\u2215\\u23ae"
@@ -608,8 +610,8 @@ bool IsIDNComponentSafe(const char16* str,
"[\\ufffa-\\ufffd]]", -1, US_INV), status);
#endif
DCHECK(U_SUCCESS(status));
- UnicodeSet component_characters;
- component_characters.addAll(UnicodeString(str, str_len));
+ icu::UnicodeSet component_characters;
+ component_characters.addAll(icu::UnicodeString(str, str_len));
if (dangerous_characters.containsSome(component_characters))
return false;
@@ -626,8 +628,8 @@ bool IsIDNComponentSafe(const char16* str,
// underscore that are used across scripts and allowed in domain names.
// (sync'd with characters allowed in url_canon_host with square
// brackets excluded.) See kHostCharLookup[] array in url_canon_host.cc.
- UnicodeSet common_characters(UNICODE_STRING_SIMPLE("[[0-9]\\-_+\\ ]"),
- status);
+ icu::UnicodeSet common_characters(UNICODE_STRING_SIMPLE("[[0-9]\\-_+\\ ]"),
+ status);
DCHECK(U_SUCCESS(status));
// Subtract common characters because they're always allowed so that
// we just have to check if a language-specific set contains