OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options2/browser_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/i18n/rtl.h" | |
11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "base/value_conversions.h" | 17 #include "base/value_conversions.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 #include "chrome/browser/auto_launch_trial.h" | 19 #include "chrome/browser/auto_launch_trial.h" |
19 #include "chrome/browser/autocomplete/autocomplete.h" | 20 #include "chrome/browser/autocomplete/autocomplete.h" |
20 #include "chrome/browser/autocomplete/autocomplete_match.h" | 21 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 | 537 |
537 void BrowserOptionsHandler::UpdateHomePageLabel() const { | 538 void BrowserOptionsHandler::UpdateHomePageLabel() const { |
538 Profile* profile = Profile::FromWebUI(web_ui()); | 539 Profile* profile = Profile::FromWebUI(web_ui()); |
539 PrefService* prefs = profile->GetPrefs(); | 540 PrefService* prefs = profile->GetPrefs(); |
540 scoped_ptr<Value> label; | 541 scoped_ptr<Value> label; |
541 string16 str; | 542 string16 str; |
542 | 543 |
543 if (prefs->GetBoolean(prefs::kHomePageIsNewTabPage)) { | 544 if (prefs->GetBoolean(prefs::kHomePageIsNewTabPage)) { |
544 str = l10n_util::GetStringUTF16(IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_NTP); | 545 str = l10n_util::GetStringUTF16(IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_NTP); |
545 } else { | 546 } else { |
547 string16 home_page = UTF8ToUTF16(prefs->GetString(prefs::kHomePage)); | |
548 if (base::i18n::IsRTL()) | |
549 base::i18n::WrapStringWithLTRFormatting(&home_page); | |
546 str = l10n_util::GetStringFUTF16( | 550 str = l10n_util::GetStringFUTF16( |
547 IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_URL, | 551 IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_URL, home_page); |
Evan Stade
2012/02/28 22:22:43
does it not work to just set dir=ltr on the DOM no
xji
2012/02/28 22:34:11
If we translate "show home button for" to Arabic o
| |
548 UTF8ToUTF16(prefs->GetString(prefs::kHomePage))); | |
549 } | 552 } |
550 | 553 |
551 label.reset(Value::CreateStringValue(str)); | 554 label.reset(Value::CreateStringValue(str)); |
552 web_ui()->CallJavascriptFunction("BrowserOptions.updateHomePageLabel", | 555 web_ui()->CallJavascriptFunction("BrowserOptions.updateHomePageLabel", |
553 *label); | 556 *label); |
554 } | 557 } |
555 | 558 |
556 void BrowserOptionsHandler::Observe( | 559 void BrowserOptionsHandler::Observe( |
557 int type, | 560 int type, |
558 const content::NotificationSource& source, | 561 const content::NotificationSource& source, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 sync_status->SetBoolean("hasUnrecoverableError", | 783 sync_status->SetBoolean("hasUnrecoverableError", |
781 service->unrecoverable_error_detected()); | 784 service->unrecoverable_error_detected()); |
782 sync_status->SetBoolean("autoLoginVisible", | 785 sync_status->SetBoolean("autoLoginVisible", |
783 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin) && | 786 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin) && |
784 service->AreCredentialsAvailable()); | 787 service->AreCredentialsAvailable()); |
785 | 788 |
786 return sync_status; | 789 return sync_status; |
787 } | 790 } |
788 | 791 |
789 } // namespace options2 | 792 } // namespace options2 |
OLD | NEW |