Fix scroll regression when specifying an extension id.
[chromium-blink-merge.git] / components / login / localized_values_builder.cc
blob2107b10ecfb75e18ddd4e5bfc29f829a5bfe87ed
1 // Copyright 2015 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.
5 #include "components/login/localized_values_builder.h"
7 #include "base/values.h"
8 #include "ui/base/l10n/l10n_util.h"
10 namespace login {
12 LocalizedValuesBuilder::LocalizedValuesBuilder(base::DictionaryValue* dict)
13 : dict_(dict) {
16 LocalizedValuesBuilder::LocalizedValuesBuilder(const std::string& prefix,
17 base::DictionaryValue* dict)
18 : prefix_(prefix), dict_(dict) {
21 void LocalizedValuesBuilder::Add(const std::string& key,
22 const std::string& message) {
23 dict_->SetString(prefix_ + key, message);
26 void LocalizedValuesBuilder::Add(const std::string& key,
27 const base::string16& message) {
28 dict_->SetString(prefix_ + key, message);
31 void LocalizedValuesBuilder::Add(const std::string& key, int message_id) {
32 dict_->SetString(prefix_ + key, l10n_util::GetStringUTF16(message_id));
35 void LocalizedValuesBuilder::AddF(const std::string& key,
36 int message_id,
37 const base::string16& a) {
38 dict_->SetString(prefix_ + key, l10n_util::GetStringFUTF16(message_id, a));
41 void LocalizedValuesBuilder::AddF(const std::string& key,
42 int message_id,
43 const base::string16& a,
44 const base::string16& b) {
45 dict_->SetString(prefix_ + key, l10n_util::GetStringFUTF16(message_id, a, b));
48 void LocalizedValuesBuilder::AddF(const std::string& key,
49 int message_id,
50 int message_id_a) {
51 AddF(key, message_id, l10n_util::GetStringUTF16(message_id_a));
54 void LocalizedValuesBuilder::AddF(const std::string& key,
55 int message_id,
56 int message_id_a,
57 int message_id_b) {
58 AddF(key, message_id, l10n_util::GetStringUTF16(message_id_a),
59 l10n_util::GetStringUTF16(message_id_b));
62 } // namespace login