summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options
diff options
context:
space:
mode:
authorxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-20 20:42:10 +0000
committerxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-20 20:42:10 +0000
commitefc15bab6e448ac35df399d5f2a89779c212a751 (patch)
tree3b3492e8bdea45368e298435938aee710dc52100 /chrome/browser/views/options
parent1a7375204b8e21dfec1bea87ffa15435c145745f (diff)
downloadchromium_src-efc15bab6e448ac35df399d5f2a89779c212a751.zip
chromium_src-efc15bab6e448ac35df399d5f2a89779c212a751.tar.gz
chromium_src-efc15bab6e448ac35df399d5f2a89779c212a751.tar.bz2
This CL fix the following 2 bugs:
1.7324 -- RTL: Path contains Hebrew is wrong on "Download location" text box (http://crbug.com/7324) 2. 7326 -- RTL: Folder icon missing on "Download location" text box (http://crbug.com/7326) The fix are: 1. force path to have LTR directionality. 2. draw icon in mirrored position in RTL locales. Steps for test: 1. Create a folder with a Hebrew file name on Hebrew XP 2. Change the download location to the folder created in step 1 3. Observe the path displayed on "Google Chrome Options" --> "Minor Tweaks" --> "Download location" text box Without the fix: The path contains Hebrew folder name is wrong. It displayed as "cCBA\:" while the path is "c:\CBA" where "CBA" is a Hebrew folder name. And there is no folder icon in the "download location" text box. With the fix: The path displayed correctly as "c:\CBA" or "c:\CBA\FED" where "FED" is subfolder of "CBA". And the folder icon showed at the very right. Review URL: http://codereview.chromium.org/20038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options')
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc7
-rw-r--r--chrome/browser/views/options/content_page_view.cc28
2 files changed, 27 insertions, 8 deletions
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 898db6f..080f578 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -691,8 +691,11 @@ void WebContentSection::InitControlLayout() {
} else {
// Add an RTL mark so that
// ":" in "Google Gears:" in Hebrew Chrome is displayed left-most.
- gears_label_ = new views::Label(l10n_util::GetString(
- IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME) + l10n_util::kRightToLeftMark);
+ std::wstring gearssetting_group_name =
+ l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME);
+ gearssetting_group_name.push_back(
+ static_cast<wchar_t>(l10n_util::kRightToLeftMark));
+ gears_label_ = new views::Label(gearssetting_group_name);
}
gears_settings_button_ = new views::NativeButton(
l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON));
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 5ca51cb..b3a728c 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -52,7 +52,7 @@ class FileDisplayArea : public views::View {
FileDisplayArea();
virtual ~FileDisplayArea();
- void SetFile(const std::wstring& file_path);
+ void SetFile(const FilePath& file_path);
// views::View overrides:
virtual void Paint(ChromeCanvas* canvas);
@@ -94,8 +94,15 @@ FileDisplayArea::FileDisplayArea()
FileDisplayArea::~FileDisplayArea() {
}
-void FileDisplayArea::SetFile(const std::wstring& file_path) {
- text_field_->SetText(file_path);
+void FileDisplayArea::SetFile(const FilePath& file_path) {
+ // Force file path to have LTR directionality.
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) {
+ string16 localized_file_path;
+ l10n_util::WrapPathWithLTRFormatting(file_path, &localized_file_path);
+ text_field_->SetText(UTF16ToWide(localized_file_path));
+ } else {
+ text_field_->SetText(file_path.ToWStringHack());
+ }
}
void FileDisplayArea::Paint(ChromeCanvas* canvas) {
@@ -105,7 +112,9 @@ void FileDisplayArea::Paint(ChromeCanvas* canvas) {
dc, EP_EDITTEXT, ETS_READONLY, 0, &rect,
skia::SkColorToCOLORREF(text_field_background_color_), true, true);
canvas->endPlatformPaint();
- canvas->DrawBitmapInt(default_folder_icon_, icon_bounds_.x(),
+ // Mirror left point for icon_bounds_ to draw icon in RTL locales correctly.
+ canvas->DrawBitmapInt(default_folder_icon_,
+ MirroredLeftPointForRect(icon_bounds_),
icon_bounds_.y());
}
@@ -144,11 +153,18 @@ void FileDisplayArea::Init() {
text_field_->SetBackgroundColor(text_field_background_color_);
}
+// static
void FileDisplayArea::InitClass() {
static bool initialized = false;
if (!initialized) {
+ // We'd prefer to use UILayoutIsRightToLeft() to perform the RTL
+ // environment check, but it's nonstatic, so, instead, we check whether the
+ // locale is RTL.
+ bool ui_is_rtl = l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- default_folder_icon_ = *rb.GetBitmapNamed(IDR_FOLDER_CLOSED);
+ default_folder_icon_ = *rb.GetBitmapNamed(ui_is_rtl ?
+ IDR_FOLDER_CLOSED_RTL :
+ IDR_FOLDER_CLOSED);
initialized = true;
}
}
@@ -501,6 +517,6 @@ void ContentPageView::InitFontsLangGroup() {
void ContentPageView::UpdateDownloadDirectoryDisplay() {
download_default_download_location_display_->SetFile(
- default_download_location_.GetValue());
+ FilePath::FromWStringHack(default_download_location_.GetValue()));
}