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

Side by Side Diff: chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc

Issue 3015028: Add Simplified Chinese (Pinyin) input method DOMUI configuration. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/dom_ui/language_options_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/dom_ui/language_chewing_options_handler.h" 5 #include "chrome/browser/chromeos/dom_ui/language_chewing_options_handler.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/chromeos/dom_ui/language_options_util.h"
13 #include "chrome/browser/chromeos/language_preferences.h" 14 #include "chrome/browser/chromeos/language_preferences.h"
14 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Returns an i18n-content value corresponding to |preference|.
19 template <typename T>
20 std::wstring GetI18nContentValue(const T& preference) {
21 return ASCIIToWide(preference.ibus_config_name) + L"Content";
22 }
23
24 // Returns a property name of templateData corresponding to |preference|.
25 template <typename T>
26 std::wstring GetTemplateDataPropertyName(const T& preference) {
27 return ASCIIToWide(preference.ibus_config_name) + L"Value";
28 }
29
30 // Returns an property name of templateData corresponding the value of the min
31 // attribute.
32 template <typename T>
33 std::wstring GetTemplateDataMinName(const T& preference) {
34 return ASCIIToWide(preference.ibus_config_name) + L"Min";
35 }
36
37 // Returns an property name of templateData corresponding the value of the max
38 // attribute.
39 template <typename T>
40 std::wstring GetTemplateDataMaxName(const T& preference) {
41 return ASCIIToWide(preference.ibus_config_name) + L"Max";
42 }
43
44 // Returns a list of options for LanguageMultipleChoicePreference.
45 ListValue* CreateMultipleChoiceList( 19 ListValue* CreateMultipleChoiceList(
46 const chromeos::LanguageMultipleChoicePreference<const char*>& preference) { 20 const chromeos::LanguageMultipleChoicePreference<const char*>& preference) {
47 int list_length = 0; 21 int list_length = 0;
48 for (size_t i = 0; 22 for (size_t i = 0;
49 i < chromeos::LanguageMultipleChoicePreference<const char*>::kMaxItems; 23 i < chromeos::LanguageMultipleChoicePreference<const char*>::kMaxItems;
50 ++i) { 24 ++i) {
51 if (preference.values_and_ids[i].item_message_id == 0) 25 if (preference.values_and_ids[i].item_message_id == 0)
52 break; 26 break;
53 ++list_length; 27 ++list_length;
54 } 28 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 DCHECK_NE(hsu_sel_key_type_min, std::numeric_limits<int>::max()); 105 DCHECK_NE(hsu_sel_key_type_min, std::numeric_limits<int>::max());
132 DCHECK_NE(hsu_sel_key_type_max, std::numeric_limits<int>::min()); 106 DCHECK_NE(hsu_sel_key_type_max, std::numeric_limits<int>::min());
133 107
134 localized_strings->SetString( 108 localized_strings->SetString(
135 GetTemplateDataMinName(chromeos::kChewingHsuSelKeyType), 109 GetTemplateDataMinName(chromeos::kChewingHsuSelKeyType),
136 IntToWString(hsu_sel_key_type_min)); 110 IntToWString(hsu_sel_key_type_min));
137 localized_strings->SetString( 111 localized_strings->SetString(
138 GetTemplateDataMaxName(chromeos::kChewingHsuSelKeyType), 112 GetTemplateDataMaxName(chromeos::kChewingHsuSelKeyType),
139 IntToWString(hsu_sel_key_type_max)); 113 IntToWString(hsu_sel_key_type_max));
140 } 114 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/dom_ui/language_options_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698