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

Unified Diff: components/login/localized_values_builder.cc

Issue 878253002: LocalizedValuesBuilder moved to components/login. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed dependency on 'base'. Created 5 years, 10 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
« no previous file with comments | « components/login/localized_values_builder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/login/localized_values_builder.cc
diff --git a/components/login/localized_values_builder.cc b/components/login/localized_values_builder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2107b10ecfb75e18ddd4e5bfc29f829a5bfe87ed
--- /dev/null
+++ b/components/login/localized_values_builder.cc
@@ -0,0 +1,62 @@
+// Copyright 2015 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 "components/login/localized_values_builder.h"
+
+#include "base/values.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace login {
+
+LocalizedValuesBuilder::LocalizedValuesBuilder(base::DictionaryValue* dict)
+ : dict_(dict) {
+}
+
+LocalizedValuesBuilder::LocalizedValuesBuilder(const std::string& prefix,
+ base::DictionaryValue* dict)
+ : prefix_(prefix), dict_(dict) {
+}
+
+void LocalizedValuesBuilder::Add(const std::string& key,
+ const std::string& message) {
+ dict_->SetString(prefix_ + key, message);
+}
+
+void LocalizedValuesBuilder::Add(const std::string& key,
+ const base::string16& message) {
+ dict_->SetString(prefix_ + key, message);
+}
+
+void LocalizedValuesBuilder::Add(const std::string& key, int message_id) {
+ dict_->SetString(prefix_ + key, l10n_util::GetStringUTF16(message_id));
+}
+
+void LocalizedValuesBuilder::AddF(const std::string& key,
+ int message_id,
+ const base::string16& a) {
+ dict_->SetString(prefix_ + key, l10n_util::GetStringFUTF16(message_id, a));
+}
+
+void LocalizedValuesBuilder::AddF(const std::string& key,
+ int message_id,
+ const base::string16& a,
+ const base::string16& b) {
+ dict_->SetString(prefix_ + key, l10n_util::GetStringFUTF16(message_id, a, b));
+}
+
+void LocalizedValuesBuilder::AddF(const std::string& key,
+ int message_id,
+ int message_id_a) {
+ AddF(key, message_id, l10n_util::GetStringUTF16(message_id_a));
+}
+
+void LocalizedValuesBuilder::AddF(const std::string& key,
+ int message_id,
+ int message_id_a,
+ int message_id_b) {
+ AddF(key, message_id, l10n_util::GetStringUTF16(message_id_a),
+ l10n_util::GetStringUTF16(message_id_b));
+}
+
+} // namespace login
« no previous file with comments | « components/login/localized_values_builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698