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

Side by Side Diff: chrome/browser/views/options/advanced_contents_view.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/options/advanced_contents_view.h" 5 #include "chrome/browser/views/options/advanced_contents_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <cryptuiapi.h> 9 #include <cryptuiapi.h>
10 #pragma comment(lib, "cryptui.lib") 10 #pragma comment(lib, "cryptui.lib")
11 #include <shellapi.h> 11 #include <shellapi.h>
12 #include <vsstyle.h> 12 #include <vsstyle.h>
13 #include <vssym32.h> 13 #include <vssym32.h>
14 14
15 #include "app/combobox_model.h" 15 #include "app/combobox_model.h"
16 #include "app/gfx/canvas.h" 16 #include "app/gfx/canvas.h"
17 #include "app/l10n_util.h" 17 #include "app/l10n_util.h"
18 #include "app/resource_bundle.h" 18 #include "app/resource_bundle.h"
19 #include "base/file_util.h" 19 #include "base/file_util.h"
20 #include "base/i18n/rtl.h"
20 #include "base/message_loop.h" 21 #include "base/message_loop.h"
21 #include "base/path_service.h" 22 #include "base/path_service.h"
22 #include "base/thread.h" 23 #include "base/thread.h"
23 #include "chrome/browser/browser.h" 24 #include "chrome/browser/browser.h"
24 #include "chrome/browser/browser_list.h" 25 #include "chrome/browser/browser_list.h"
25 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/download/download_manager.h" 27 #include "chrome/browser/download/download_manager.h"
27 #include "chrome/browser/gears_integration.h" 28 #include "chrome/browser/gears_integration.h"
28 #include "chrome/browser/net/dns_global.h" 29 #include "chrome/browser/net/dns_global.h"
29 #include "chrome/browser/options_util.h" 30 #include "chrome/browser/options_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 text_field_background_color_(0), 140 text_field_background_color_(0),
140 initialized_(false) { 141 initialized_(false) {
141 InitClass(); 142 InitClass();
142 } 143 }
143 144
144 FileDisplayArea::~FileDisplayArea() { 145 FileDisplayArea::~FileDisplayArea() {
145 } 146 }
146 147
147 void FileDisplayArea::SetFile(const FilePath& file_path) { 148 void FileDisplayArea::SetFile(const FilePath& file_path) {
148 // Force file path to have LTR directionality. 149 // Force file path to have LTR directionality.
149 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { 150 if (base::i18n::IsRTL()) {
150 string16 localized_file_path; 151 string16 localized_file_path;
151 l10n_util::WrapPathWithLTRFormatting(file_path, &localized_file_path); 152 base::i18n::WrapPathWithLTRFormatting(file_path, &localized_file_path);
152 text_field_->SetText(UTF16ToWide(localized_file_path)); 153 text_field_->SetText(UTF16ToWide(localized_file_path));
153 } else { 154 } else {
154 text_field_->SetText(file_path.ToWStringHack()); 155 text_field_->SetText(file_path.ToWStringHack());
155 } 156 }
156 } 157 }
157 158
158 void FileDisplayArea::Paint(gfx::Canvas* canvas) { 159 void FileDisplayArea::Paint(gfx::Canvas* canvas) {
159 HDC dc = canvas->beginPlatformPaint(); 160 HDC dc = canvas->beginPlatformPaint();
160 RECT rect = { 0, 0, width(), height() }; 161 RECT rect = { 0, 0, width(), height() };
161 gfx::NativeTheme::instance()->PaintTextField( 162 gfx::NativeTheme::instance()->PaintTextField(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 text_field_->SetBackgroundColor(text_field_background_color_); 204 text_field_->SetBackgroundColor(text_field_background_color_);
204 } 205 }
205 206
206 // static 207 // static
207 void FileDisplayArea::InitClass() { 208 void FileDisplayArea::InitClass() {
208 static bool initialized = false; 209 static bool initialized = false;
209 if (!initialized) { 210 if (!initialized) {
210 // We'd prefer to use UILayoutIsRightToLeft() to perform the RTL 211 // We'd prefer to use UILayoutIsRightToLeft() to perform the RTL
211 // environment check, but it's nonstatic, so, instead, we check whether the 212 // environment check, but it's nonstatic, so, instead, we check whether the
212 // locale is RTL. 213 // locale is RTL.
213 bool ui_is_rtl = l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; 214 bool ui_is_rtl = base::i18n::IsRTL();
214 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 215 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
215 default_folder_icon_ = *rb.GetBitmapNamed(ui_is_rtl ? 216 default_folder_icon_ = *rb.GetBitmapNamed(ui_is_rtl ?
216 IDR_FOLDER_CLOSED_RTL : 217 IDR_FOLDER_CLOSED_RTL :
217 IDR_FOLDER_CLOSED); 218 IDR_FOLDER_CLOSED);
218 initialized = true; 219 initialized = true;
219 } 220 }
220 } 221 }
221 222
222 //////////////////////////////////////////////////////////////////////////////// 223 ////////////////////////////////////////////////////////////////////////////////
223 // AdvancedSection 224 // AdvancedSection
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 views::Window::CreateChromeWindow( 750 views::Window::CreateChromeWindow(
750 GetWindow()->GetNativeWindow(), 751 GetWindow()->GetNativeWindow(),
751 gfx::Rect(), 752 gfx::Rect(),
752 new FontsLanguagesWindowView(profile()))->Show(); 753 new FontsLanguagesWindowView(profile()))->Show();
753 } 754 }
754 } 755 }
755 756
756 void WebContentSection::InitControlLayout() { 757 void WebContentSection::InitControlLayout() {
757 AdvancedSection::InitControlLayout(); 758 AdvancedSection::InitControlLayout();
758 759
759 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) { 760 if (!base::i18n::IsRTL()) {
760 gears_label_ = new views::Label( 761 gears_label_ = new views::Label(
761 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME)); 762 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME));
762 } else { 763 } else {
763 // Add an RTL mark so that 764 // Add an RTL mark so that
764 // ":" in "Google Gears:" in Hebrew Chrome is displayed left-most. 765 // ":" in "Google Gears:" in Hebrew Chrome is displayed left-most.
765 std::wstring gearssetting_group_name = 766 std::wstring gearssetting_group_name =
766 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME); 767 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME);
767 gearssetting_group_name.push_back( 768 gearssetting_group_name.push_back(
768 static_cast<wchar_t>(l10n_util::kRightToLeftMark)); 769 static_cast<wchar_t>(base::i18n::kRightToLeftMark));
769 gears_label_ = new views::Label(gearssetting_group_name); 770 gears_label_ = new views::Label(gearssetting_group_name);
770 } 771 }
771 gears_settings_button_ = new views::NativeButton( 772 gears_settings_button_ = new views::NativeButton(
772 this, 773 this,
773 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON)); 774 l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON));
774 fonts_and_languages_label_ = new views::Label( 775 fonts_and_languages_label_ = new views::Label(
775 l10n_util::GetString(IDS_OPTIONS_FONTSETTINGS_INFO)); 776 l10n_util::GetString(IDS_OPTIONS_FONTSETTINGS_INFO));
776 777
777 change_content_fonts_button_ = new views::NativeButton( 778 change_content_fonts_button_ = new views::NativeButton(
778 this, 779 this,
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1423
1423 void AdvancedScrollViewContainer::Layout() { 1424 void AdvancedScrollViewContainer::Layout() {
1424 gfx::Rect lb = GetLocalBounds(false); 1425 gfx::Rect lb = GetLocalBounds(false);
1425 1426
1426 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( 1427 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize(
1427 gfx::NativeTheme::LIST); 1428 gfx::NativeTheme::LIST);
1428 lb.Inset(border.width(), border.height()); 1429 lb.Inset(border.width(), border.height());
1429 scroll_view_->SetBounds(lb); 1430 scroll_view_->SetBounds(lb);
1430 scroll_view_->Layout(); 1431 scroll_view_->Layout();
1431 } 1432 }
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar_view.cc ('k') | chrome/browser/views/options/passwords_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698