Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8549)

Unified Diff: chrome/browser/views/options/content_page_view.cc

Issue 20038: Review request: fix 7324 and 7326: missing icon and wrong path in "download location" (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/options/advanced_contents_view.cc ('k') | chrome/common/l10n_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/options/content_page_view.cc
===================================================================
--- chrome/browser/views/options/content_page_view.cc (revision 10107)
+++ chrome/browser/views/options/content_page_view.cc (working copy)
@@ -52,7 +52,7 @@
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() {
}
-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 @@
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 @@
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::UpdateDownloadDirectoryDisplay() {
download_default_download_location_display_->SetFile(
- default_download_location_.GetValue());
+ FilePath::FromWStringHack(default_download_location_.GetValue()));
}
« no previous file with comments | « chrome/browser/views/options/advanced_contents_view.cc ('k') | chrome/common/l10n_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698