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

Unified Diff: chrome/browser/chromeos/dom_ui/language_options_util.cc

Issue 3043023: Add remaining stuff for Mozc configuration DOMUI. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix for review comments (real for this time) 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/dom_ui/language_options_util.cc
diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.cc b/chrome/browser/chromeos/dom_ui/language_options_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6c62f68b9f0e0f5cc88d8b4b95c55b2e774c57c6
--- /dev/null
+++ b/chrome/browser/chromeos/dom_ui/language_options_util.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "language_options_util.h"
+
+#include "app/l10n_util.h"
+#include "base/values.h"
+
+namespace chromeos {
+
+ListValue* CreateMultipleChoiceList(
+ const LanguageMultipleChoicePreference<const char*>& preference) {
+ int list_length = 0;
+ for (size_t i = 0;
+ i < LanguageMultipleChoicePreference<const char*>::kMaxItems;
+ ++i) {
+ if (preference.values_and_ids[i].item_message_id == 0)
+ break;
+ ++list_length;
+ }
+ DCHECK_GT(list_length, 0);
+
+ ListValue* list_value = new ListValue();
+ for (int i = 0; i < list_length; ++i) {
+ ListValue* option = new ListValue();
+ option->Append(Value::CreateStringValue(
+ preference.values_and_ids[i].ibus_config_value));
+ option->Append(Value::CreateStringValue(l10n_util::GetString(
+ preference.values_and_ids[i].item_message_id)));
+ list_value->Append(option);
+ }
+ return list_value;
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698