summaryrefslogtreecommitdiffstats
path: root/app
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 /app
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
Diffstat (limited to 'app')
-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
8 files changed, 35 insertions, 33 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.