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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/language_chewing_handler.cc

Issue 10837331: Options: s/options2/options/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wut Created 8 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/options2/chromeos/language_chewing_handler.h"
6
7 #include <limits>
8
9 #include "base/logging.h"
10 #include "base/string_number_conversions.h"
11 #include "base/utf_string_conversions.h"
12 #include "base/values.h"
13 #include "chrome/browser/chromeos/language_preferences.h"
14 #include "chrome/browser/ui/webui/options2/chromeos/language_options_util.h"
15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h"
17
18 namespace {
19 const char kI18nPrefix[] = "Chewing_";
20 } // namespace
21
22 namespace chromeos {
23 namespace options {
24
25 LanguageChewingHandler::LanguageChewingHandler() {
26 }
27
28 LanguageChewingHandler::~LanguageChewingHandler() {
29 }
30
31 void LanguageChewingHandler::GetLocalizedValues(
32 DictionaryValue* localized_strings) {
33 DCHECK(localized_strings);
34
35 RegisterTitle(localized_strings, "languageChewingPage",
36 IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTINGS_TITLE);
37
38 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
39 localized_strings->SetString(
40 GetI18nContentValue(language_prefs::kChewingBooleanPrefs[i],
41 kI18nPrefix),
42 l10n_util::GetStringUTF16(
43 language_prefs::kChewingBooleanPrefs[i].message_id));
44 }
45
46 // For maximum Chinese characters in pre-edit buffer, we use slider UI.
47 {
48 const language_prefs::LanguageIntegerRangePreference& preference =
49 language_prefs::kChewingIntegerPrefs[
50 language_prefs::kChewingMaxChiSymbolLenIndex];
51 localized_strings->SetString(
52 GetI18nContentValue(preference, kI18nPrefix),
53 l10n_util::GetStringUTF16(preference.message_id));
54 localized_strings->SetString(
55 GetTemplateDataMinName(preference, kI18nPrefix),
56 base::IntToString(preference.min_pref_value));
57 localized_strings->SetString(
58 GetTemplateDataMaxName(preference, kI18nPrefix),
59 base::IntToString(preference.max_pref_value));
60 }
61
62 // For number of candidates per page, we use select-option UI.
63 {
64 const language_prefs::LanguageIntegerRangePreference& preference =
65 language_prefs::kChewingIntegerPrefs[
66 language_prefs::kChewingCandPerPageIndex];
67 localized_strings->SetString(
68 GetI18nContentValue(preference, kI18nPrefix),
69 l10n_util::GetStringUTF16(preference.message_id));
70 ListValue* list_value = new ListValue();
71 for (int i = preference.min_pref_value; i <= preference.max_pref_value;
72 ++i) {
73 ListValue* option = new ListValue();
74 option->Append(CreateValue(i));
75 option->Append(CreateValue(i));
76 list_value->Append(option);
77 }
78 localized_strings->Set(GetTemplateDataPropertyName(preference, kI18nPrefix),
79 list_value);
80 }
81
82 for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs;
83 ++i) {
84 const language_prefs::LanguageMultipleChoicePreference<const char*>&
85 preference = language_prefs::kChewingMultipleChoicePrefs[i];
86 localized_strings->SetString(
87 GetI18nContentValue(preference, kI18nPrefix),
88 l10n_util::GetStringUTF16(preference.label_message_id));
89 localized_strings->Set(
90 GetTemplateDataPropertyName(preference, kI18nPrefix),
91 CreateMultipleChoiceList(preference));
92 }
93
94 localized_strings->SetString(
95 GetI18nContentValue(language_prefs::kChewingHsuSelKeyType, kI18nPrefix),
96 l10n_util::GetStringUTF16(
97 language_prefs::kChewingHsuSelKeyType.label_message_id));
98 localized_strings->Set(
99 GetTemplateDataPropertyName(language_prefs::kChewingHsuSelKeyType,
100 kI18nPrefix),
101 CreateMultipleChoiceList(language_prefs::kChewingHsuSelKeyType));
102 }
103
104 } // namespace options
105 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698