diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 20:38:53 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 20:38:53 +0000 |
commit | 8891d14891423a0bf861fb6cb8a88cc2b0b11d8e (patch) | |
tree | 286765dee398d8ef885c8895a06834063b53cdee | |
parent | cb34b251707323165c85b7079467e9a03c65af8e (diff) | |
download | chromium_src-8891d14891423a0bf861fb6cb8a88cc2b0b11d8e.zip chromium_src-8891d14891423a0bf861fb6cb8a88cc2b0b11d8e.tar.gz chromium_src-8891d14891423a0bf861fb6cb8a88cc2b0b11d8e.tar.bz2 |
remove ICU includes from l10n_util.h
95% of users of l10n_util use it for some functions; the other 5%
want some complicated templates that pull in a ton of ICU headers
as well.
Before this change, the average includer of l10n_util.h pulled in
an additional 80 subheaders because of it.
Additionally, #including ICU headers from a header makes the includee
depend on having the ICU include path in the -I header.
Review URL: http://codereview.chromium.org/515059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37032 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/app_base.gypi | 1 | ||||
-rw-r--r-- | app/bidi_line_iterator.cc | 58 | ||||
-rw-r--r-- | app/bidi_line_iterator.h | 41 | ||||
-rw-r--r-- | app/l10n_util.cc | 55 | ||||
-rw-r--r-- | app/l10n_util.h | 166 | ||||
-rw-r--r-- | app/l10n_util_collator.h | 147 | ||||
-rw-r--r-- | app/l10n_util_unittest.cc | 1 | ||||
-rw-r--r-- | app/table_model.cc | 1 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.cc | 1 | ||||
-rw-r--r-- | chrome/browser/bug_report_util.cc | 1 | ||||
-rw-r--r-- | chrome/browser/character_encoding.cc | 1 | ||||
-rw-r--r-- | chrome/browser/gtk/options/fonts_page_gtk.cc | 1 | ||||
-rw-r--r-- | chrome/browser/task_manager.cc | 1 | ||||
-rwxr-xr-x | chrome/browser/views/about_chrome_view.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/options/fonts_page_view.cc | 1 | ||||
-rw-r--r-- | chrome/common/extensions/extension_l10n_util.cc | 1 |
17 files changed, 267 insertions, 216 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index 6b4eed0..daa2f52 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -92,6 +92,7 @@ 'animation.h', 'active_window_watcher_x.cc', 'active_window_watcher_x.h', + 'bidi_line_iterator.cc', 'clipboard/clipboard.cc', 'clipboard/clipboard.h', 'clipboard/clipboard_linux.cc', diff --git a/app/bidi_line_iterator.cc b/app/bidi_line_iterator.cc new file mode 100644 index 0000000..e58d375 --- /dev/null +++ b/app/bidi_line_iterator.cc @@ -0,0 +1,58 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/bidi_line_iterator.h" + +#include "base/logging.h" +#include "base/string16.h" +#include "base/string_util.h" + +BiDiLineIterator::~BiDiLineIterator() { + if (bidi_) { + ubidi_close(bidi_); + bidi_ = NULL; + } +} + +UBool BiDiLineIterator::Open(const std::wstring& text, + bool right_to_left, + bool url) { + DCHECK(bidi_ == NULL); + UErrorCode error = U_ZERO_ERROR; + bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); + if (U_FAILURE(error)) + return false; + if (right_to_left && url) + ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY); +#if defined(WCHAR_T_IS_UTF32) + const string16 text_utf16 = WideToUTF16(text); +#else + const std::wstring &text_utf16 = text; +#endif // U_SIZEOF_WCHAR_T != 4 + ubidi_setPara(bidi_, text_utf16.data(), static_cast<int>(text_utf16.length()), + right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, + NULL, &error); + return U_SUCCESS(error); +} + +int BiDiLineIterator::CountRuns() { + DCHECK(bidi_ != NULL); + UErrorCode error = U_ZERO_ERROR; + const int runs = ubidi_countRuns(bidi_, &error); + return U_SUCCESS(error) ? runs : 0; +} + +UBiDiDirection BiDiLineIterator::GetVisualRun(int index, + int* start, + int* length) { + DCHECK(bidi_ != NULL); + return ubidi_getVisualRun(bidi_, index, start, length); +} + +void BiDiLineIterator::GetLogicalRun(int start, + int* end, + UBiDiLevel* level) { + DCHECK(bidi_ != NULL); + ubidi_getLogicalRun(bidi_, start, end, level); +} diff --git a/app/bidi_line_iterator.h b/app/bidi_line_iterator.h new file mode 100644 index 0000000..5f2f7e0 --- /dev/null +++ b/app/bidi_line_iterator.h @@ -0,0 +1,41 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APP_BIDI_LINE_ITERATOR_H_ +#define APP_BIDI_LINE_ITERATOR_H_ + +#include <string> + +#include "unicode/ubidi.h" + +#include "base/basictypes.h" + +// A simple wrapper class for the bidirectional iterator of ICU. +// This class uses the bidirectional iterator of ICU to split a line of +// bidirectional texts into visual runs in its display order. +class BiDiLineIterator { + public: + BiDiLineIterator() : bidi_(NULL) { } + ~BiDiLineIterator(); + + // Initializes the bidirectional iterator with the specified text. Returns + // whether initialization succeeded. + UBool Open(const std::wstring& text, bool right_to_left, bool url); + + // Returns the number of visual runs in the text, or zero on error. + int CountRuns(); + + // Gets the logical offset, length, and direction of the specified visual run. + UBiDiDirection GetVisualRun(int index, int* start, int* length); + + // Given a start position, figure out where the run ends (and the BiDiLevel). + void GetLogicalRun(int start, int* end, UBiDiLevel* level); + + private: + UBiDi* bidi_; + + DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); +}; + +#endif // APP_BIDI_LINE_ITERATOR_H_ diff --git a/app/l10n_util.cc b/app/l10n_util.cc index 9f81006..9f28842 100644 --- a/app/l10n_util.cc +++ b/app/l10n_util.cc @@ -5,9 +5,11 @@ #include "app/l10n_util.h" #include <cstdlib> + #include "app/app_paths.h" #include "app/app_switches.h" #include "app/gfx/canvas.h" +#include "app/l10n_util_collator.h" #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" @@ -19,6 +21,10 @@ #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "build/build_config.h" +#include "unicode/coll.h" +#include "unicode/locid.h" +#include "unicode/rbbi.h" +#include "unicode/uchar.h" #include "unicode/uscript.h" #if defined(TOOLKIT_GTK) @@ -1015,53 +1021,4 @@ void GetAcceptLanguagesForLocale(const std::string& display_locale, } } -BiDiLineIterator::~BiDiLineIterator() { - if (bidi_) { - ubidi_close(bidi_); - bidi_ = NULL; - } -} - -UBool BiDiLineIterator::Open(const std::wstring& text, - bool right_to_left, - bool url) { - DCHECK(bidi_ == NULL); - UErrorCode error = U_ZERO_ERROR; - bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); - if (U_FAILURE(error)) - return false; - if (right_to_left && url) - ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY); -#if defined(WCHAR_T_IS_UTF32) - const string16 text_utf16 = WideToUTF16(text); -#else - const std::wstring &text_utf16 = text; -#endif // U_SIZEOF_WCHAR_T != 4 - ubidi_setPara(bidi_, text_utf16.data(), static_cast<int>(text_utf16.length()), - right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, - NULL, &error); - return U_SUCCESS(error); -} - -int BiDiLineIterator::CountRuns() { - DCHECK(bidi_ != NULL); - UErrorCode error = U_ZERO_ERROR; - const int runs = ubidi_countRuns(bidi_, &error); - return U_SUCCESS(error) ? runs : 0; -} - -UBiDiDirection BiDiLineIterator::GetVisualRun(int index, - int* start, - int* length) { - DCHECK(bidi_ != NULL); - return ubidi_getVisualRun(bidi_, index, start, length); -} - -void BiDiLineIterator::GetLogicalRun(int start, - int* end, - UBiDiLevel* level) { - DCHECK(bidi_ != NULL); - ubidi_getLogicalRun(bidi_, start, end, level); -} - } // namespace l10n_util diff --git a/app/l10n_util.h b/app/l10n_util.h index 0c65934..d75d357 100644 --- a/app/l10n_util.h +++ b/app/l10n_util.h @@ -20,11 +20,6 @@ #include "base/scoped_ptr.h" #include "base/string16.h" #include "base/string_util.h" -#include "unicode/coll.h" -#include "unicode/locid.h" -#include "unicode/rbbi.h" -#include "unicode/ubidi.h" -#include "unicode/uchar.h" #if defined(OS_MACOSX) #include "app/l10n_util_mac.h" @@ -269,139 +264,6 @@ std::wstring GetDisplayStringInLTRDirectionality(std::wstring* text); // gfx::Canvas::TEXT_ALIGN_RIGHT. int DefaultCanvasTextAlignment(); -// Compares the two strings using the specified collator. -UCollationResult CompareStringWithCollator(const icu::Collator* collator, - const std::wstring& lhs, - const std::wstring& rhs); - -// Used by SortStringsUsingMethod. Invokes a method on the objects passed to -// operator (), comparing the string results using a collator. -template <class T, class Method> -class StringMethodComparatorWithCollator - : public std::binary_function<const std::wstring&, - const std::wstring&, - bool> { - public: - StringMethodComparatorWithCollator(icu::Collator* collator, Method method) - : collator_(collator), - method_(method) { } - - // Returns true if lhs preceeds rhs. - bool operator() (T* lhs_t, T* rhs_t) { - return CompareStringWithCollator(collator_, (lhs_t->*method_)(), - (rhs_t->*method_)()) == UCOL_LESS; - } - - private: - icu::Collator* collator_; - Method method_; -}; - -// Used by SortStringsUsingMethod. Invokes a method on the objects passed to -// operator (), comparing the string results using <. -template <class T, class Method> -class StringMethodComparator : public std::binary_function<const std::wstring&, - const std::wstring&, - bool> { - public: - explicit StringMethodComparator(Method method) : method_(method) { } - - // Returns true if lhs preceeds rhs. - bool operator() (T* lhs_t, T* rhs_t) { - return (lhs_t->*method_)() < (rhs_t->*method_)(); - } - - private: - Method method_; -}; - -// Sorts the objects in |elements| using the method |method|, which must return -// a string. Sorting is done using a collator, unless a collator can not be -// found in which case the strings are sorted using the operator <. -template <class T, class Method> -void SortStringsUsingMethod(const std::wstring& locale, - std::vector<T*>* elements, - Method method) { - UErrorCode error = U_ZERO_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)); - return; - } - - std::sort(elements->begin(), elements->end(), - StringMethodComparatorWithCollator<T, Method>(collator.get(), method)); -} - -// Compares two elements' string keys and returns true if the first element's -// string key is less than the second element's string key. The Element must -// have a method like the follow format to return the string key. -// const std::wstring& GetStringKey() const; -// This uses the locale specified in the constructor. -template <class Element> -class StringComparator : public std::binary_function<const Element&, - const Element&, - bool> { - public: - explicit StringComparator(icu::Collator* collator) - : collator_(collator) { } - - // Returns true if lhs precedes rhs. - bool operator()(const Element& lhs, const Element& rhs) { - const std::wstring& lhs_string_key = lhs.GetStringKey(); - const std::wstring& rhs_string_key = rhs.GetStringKey(); - - return StringComparator<std::wstring>(collator_)(lhs_string_key, - rhs_string_key); - } - - private: - icu::Collator* collator_; -}; - -// Specialization of operator() method for std::wstring version. -template <> -bool StringComparator<std::wstring>::operator()(const std::wstring& lhs, - const std::wstring& rhs); - -// In place sorting of |elements| of a vector according to the string key of -// each element in the vector by using collation rules for |locale|. -// |begin_index| points to the start position of elements in the vector which -// want to be sorted. |end_index| points to the end position of elements in the -// vector which want to be sorted -template <class Element> -void SortVectorWithStringKey(const std::string& locale, - std::vector<Element>* elements, - unsigned int begin_index, - unsigned int end_index, - bool needs_stable_sort) { - DCHECK(begin_index < end_index && - end_index <= static_cast<unsigned int>(elements->size())); - UErrorCode error = U_ZERO_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()); - if (needs_stable_sort) { - stable_sort(elements->begin() + begin_index, - elements->begin() + end_index, - c); - } else { - sort(elements->begin() + begin_index, elements->begin() + end_index, c); - } -} - -template <class Element> -void SortVectorWithStringKey(const std::string& locale, - std::vector<Element>* elements, - bool needs_stable_sort) { - SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(), - needs_stable_sort); -} - // In place sorting of strings using collation rules for |locale|. // TODO(port): this should take string16. void SortStrings(const std::string& locale, @@ -415,33 +277,7 @@ const std::vector<std::string>& GetAvailableLocales(); void GetAcceptLanguagesForLocale(const std::string& display_locale, std::vector<std::string>* locale_codes); -// A simple wrapper class for the bidirectional iterator of ICU. -// This class uses the bidirectional iterator of ICU to split a line of -// bidirectional texts into visual runs in its display order. -class BiDiLineIterator { - public: - BiDiLineIterator() : bidi_(NULL) { } - ~BiDiLineIterator(); - - // Initializes the bidirectional iterator with the specified text. Returns - // whether initialization succeeded. - UBool Open(const std::wstring& text, bool right_to_left, bool url); - - // Returns the number of visual runs in the text, or zero on error. - int CountRuns(); - - // Gets the logical offset, length, and direction of the specified visual run. - UBiDiDirection GetVisualRun(int index, int* start, int* length); - // Given a start position, figure out where the run ends (and the BiDiLevel). - void GetLogicalRun(int start, int* end, UBiDiLevel* level); - - private: - UBiDi* bidi_; - - DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); -}; - -} +} // namespace l10n_util #endif // APP_L10N_UTIL_H_ diff --git a/app/l10n_util_collator.h b/app/l10n_util_collator.h new file mode 100644 index 0000000..c0abad1 --- /dev/null +++ b/app/l10n_util_collator.h @@ -0,0 +1,147 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APP_L10N_UTIL_COLLATOR_H_ +#define APP_L10N_UTIL_COLLATOR_H_ + +#include "unicode/coll.h" + +namespace l10n_util { + +// Compares the two strings using the specified collator. +UCollationResult CompareStringWithCollator(const icu::Collator* collator, + const std::wstring& lhs, + const std::wstring& rhs); + +// Used by SortStringsUsingMethod. Invokes a method on the objects passed to +// operator (), comparing the string results using a collator. +template <class T, class Method> +class StringMethodComparatorWithCollator + : public std::binary_function<const std::wstring&, + const std::wstring&, + bool> { + public: + StringMethodComparatorWithCollator(icu::Collator* collator, Method method) + : collator_(collator), + method_(method) { } + + // Returns true if lhs preceeds rhs. + bool operator() (T* lhs_t, T* rhs_t) { + return CompareStringWithCollator(collator_, (lhs_t->*method_)(), + (rhs_t->*method_)()) == UCOL_LESS; + } + + private: + icu::Collator* collator_; + Method method_; +}; + +// Used by SortStringsUsingMethod. Invokes a method on the objects passed to +// operator (), comparing the string results using <. +template <class T, class Method> +class StringMethodComparator : public std::binary_function<const std::wstring&, + const std::wstring&, + bool> { + public: + explicit StringMethodComparator(Method method) : method_(method) { } + + // Returns true if lhs preceeds rhs. + bool operator() (T* lhs_t, T* rhs_t) { + return (lhs_t->*method_)() < (rhs_t->*method_)(); + } + + private: + Method method_; +}; + +// Sorts the objects in |elements| using the method |method|, which must return +// a string. Sorting is done using a collator, unless a collator can not be +// found in which case the strings are sorted using the operator <. +template <class T, class Method> +void SortStringsUsingMethod(const std::wstring& locale, + std::vector<T*>* elements, + Method method) { + UErrorCode error = U_ZERO_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)); + return; + } + + std::sort(elements->begin(), elements->end(), + StringMethodComparatorWithCollator<T, Method>(collator.get(), method)); +} + +// Compares two elements' string keys and returns true if the first element's +// string key is less than the second element's string key. The Element must +// have a method like the follow format to return the string key. +// const std::wstring& GetStringKey() const; +// This uses the locale specified in the constructor. +template <class Element> +class StringComparator : public std::binary_function<const Element&, + const Element&, + bool> { + public: + explicit StringComparator(icu::Collator* collator) + : collator_(collator) { } + + // Returns true if lhs precedes rhs. + bool operator()(const Element& lhs, const Element& rhs) { + const std::wstring& lhs_string_key = lhs.GetStringKey(); + const std::wstring& rhs_string_key = rhs.GetStringKey(); + + return StringComparator<std::wstring>(collator_)(lhs_string_key, + rhs_string_key); + } + + private: + icu::Collator* collator_; +}; + +// Specialization of operator() method for std::wstring version. +template <> +bool StringComparator<std::wstring>::operator()(const std::wstring& lhs, + const std::wstring& rhs); + +// In place sorting of |elements| of a vector according to the string key of +// each element in the vector by using collation rules for |locale|. +// |begin_index| points to the start position of elements in the vector which +// want to be sorted. |end_index| points to the end position of elements in the +// vector which want to be sorted +template <class Element> +void SortVectorWithStringKey(const std::string& locale, + std::vector<Element>* elements, + unsigned int begin_index, + unsigned int end_index, + bool needs_stable_sort) { + DCHECK(begin_index < end_index && + end_index <= static_cast<unsigned int>(elements->size())); + UErrorCode error = U_ZERO_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()); + if (needs_stable_sort) { + stable_sort(elements->begin() + begin_index, + elements->begin() + end_index, + c); + } else { + sort(elements->begin() + begin_index, elements->begin() + end_index, c); + } +} + +template <class Element> +void SortVectorWithStringKey(const std::string& locale, + std::vector<Element>* elements, + bool needs_stable_sort) { + SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(), + needs_stable_sort); +} + +} // namespace l10n_util + +#endif // APP_L10N_UTIL_COLLATOR_H_ diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc index 8cdf3c9..693c586 100644 --- a/app/l10n_util_unittest.cc +++ b/app/l10n_util_unittest.cc @@ -10,6 +10,7 @@ #include "app/app_paths.h" #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #if !defined(OS_MACOSX) #include "app/test/data/resource.h" #endif diff --git a/app/table_model.cc b/app/table_model.cc index fa4ccb7..b70ad2d 100644 --- a/app/table_model.cc +++ b/app/table_model.cc @@ -5,6 +5,7 @@ #include "app/table_model.h" #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #include "third_party/skia/include/core/SkBitmap.h" // TableColumn ----------------------------------------------------------------- diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index 19e1fcc..434fde0 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -6,6 +6,7 @@ #include "app/gfx/codec/png_codec.h" #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #include "base/scoped_vector.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_index.h" diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index fb40773..b238713 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -14,6 +14,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "googleurl/src/gurl.h" #include "grit/locale_settings.h" +#include "unicode/locid.h" namespace { diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc index a865b49..a1afb4e 100644 --- a/chrome/browser/character_encoding.cc +++ b/chrome/browser/character_encoding.cc @@ -8,6 +8,7 @@ #include <set> #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/string_tokenizer.h" diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc index 0493df9..531cfe0 100644 --- a/chrome/browser/gtk/options/fonts_page_gtk.cc +++ b/chrome/browser/gtk/options/fonts_page_gtk.cc @@ -5,6 +5,7 @@ #include "chrome/browser/gtk/options/fonts_page_gtk.h" #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/gtk/options/options_layout_gtk.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index a3b671f..fed7f29 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -30,6 +30,7 @@ #include "grit/generated_resources.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" +#include "unicode/coll.h" #if defined(OS_MACOSX) #include "chrome/browser/mach_broker_mac.h" diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 42936a3..36971a4 100755 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/about_chrome_view.h" +#include "app/bidi_line_iterator.h" #include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "base/i18n/word_iterator.h" @@ -496,7 +497,7 @@ void AboutChromeView::DrawTextAndPositionUrl(gfx::Canvas* canvas, // (a run is a sequence of words that share the same directionality). We // initialize a bidirectional ICU line iterator and split the text into runs // that are either strictly LTR or strictly RTL (and do not contain a mix). - l10n_util::BiDiLineIterator bidi_line; + BiDiLineIterator bidi_line; if (!bidi_line.Open(text.c_str(), true, false)) return; diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 9f0097e..006f23d 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" +#include "app/bidi_line_iterator.h" #include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "app/gfx/insets.h" @@ -469,7 +470,7 @@ int AutocompleteResultView::DrawString( // Initialize a bidirectional line iterator of ICU and split the text into // visual runs. (A visual run is consecutive characters which have the same // display direction and should be displayed at once.) - l10n_util::BiDiLineIterator bidi_line; + BiDiLineIterator bidi_line; if (!bidi_line.Open(text, mirroring_context_->mirrored(), false)) return x; const int runs = bidi_line.CountRuns(); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 17aadae7..a24458d 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -16,6 +16,7 @@ #include "app/gfx/font.h" #include "app/gfx/native_theme_win.h" #include "app/l10n_util.h" +#include "app/l10n_util_collator.h" #include "app/resource_bundle.h" #include "base/file_util.h" #include "base/string_util.h" diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index 0e21ca5..dcc8cc5 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -19,6 +19,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_message_bundle.h" #include "chrome/common/json_value_serializer.h" +#include "unicode/uloc.h" namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; |