OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/spellchecker/spellcheck_service.h" | 5 #include "chrome/browser/spellchecker/spellcheck_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 base::SPLIT_WANT_NONEMPTY)); | 126 base::SPLIT_WANT_NONEMPTY)); |
127 prefs_->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionaries_value); | 127 prefs_->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionaries_value); |
128 } | 128 } |
129 | 129 |
130 std::string GetMultilingualDictionaries() { | 130 std::string GetMultilingualDictionaries() { |
131 const base::ListValue* list_value = | 131 const base::ListValue* list_value = |
132 prefs_->GetList(spellcheck::prefs::kSpellCheckDictionaries); | 132 prefs_->GetList(spellcheck::prefs::kSpellCheckDictionaries); |
133 std::vector<base::StringPiece> dictionaries; | 133 std::vector<base::StringPiece> dictionaries; |
134 for (const auto& item_value : *list_value) { | 134 for (const auto& item_value : *list_value) { |
135 base::StringPiece dictionary; | 135 base::StringPiece dictionary; |
136 EXPECT_TRUE(item_value.GetAsString(&dictionary)); | 136 EXPECT_TRUE(item_value->GetAsString(&dictionary)); |
137 dictionaries.push_back(dictionary); | 137 dictionaries.push_back(dictionary); |
138 } | 138 } |
139 return base::JoinString(dictionaries, ","); | 139 return base::JoinString(dictionaries, ","); |
140 } | 140 } |
141 | 141 |
142 void SetAcceptLanguages(const std::string& accept_languages) { | 142 void SetAcceptLanguages(const std::string& accept_languages) { |
143 ScopedPreferenceChange scope(&renderer_->sink()); | 143 ScopedPreferenceChange scope(&renderer_->sink()); |
144 prefs_->SetString(prefs::kAcceptLanguages, accept_languages); | 144 prefs_->SetString(prefs::kAcceptLanguages, accept_languages); |
145 } | 145 } |
146 | 146 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 std::string pref; | 388 std::string pref; |
389 ASSERT_TRUE(GetPrefs() | 389 ASSERT_TRUE(GetPrefs() |
390 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) | 390 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) |
391 ->GetString(0, &pref)); | 391 ->GetString(0, &pref)); |
392 EXPECT_EQ("en-US", pref); | 392 EXPECT_EQ("en-US", pref); |
393 ASSERT_TRUE(GetPrefs() | 393 ASSERT_TRUE(GetPrefs() |
394 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) | 394 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) |
395 ->GetString(1, &pref)); | 395 ->GetString(1, &pref)); |
396 EXPECT_EQ("fr", pref); | 396 EXPECT_EQ("fr", pref); |
397 } | 397 } |
OLD | NEW |