OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/input_method/input_method_syncer.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_syncer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 AddSupportedInputMethodValues(enabled_extension_imes_.GetValue(), | 235 AddSupportedInputMethodValues(enabled_extension_imes_.GetValue(), |
236 enabled_extension_imes_syncable, | 236 enabled_extension_imes_syncable, |
237 prefs::kLanguageEnabledExtensionImes)); | 237 prefs::kLanguageEnabledExtensionImes)); |
238 | 238 |
239 // Remove unsupported locales before updating the local languages preference. | 239 // Remove unsupported locales before updating the local languages preference. |
240 std::string languages( | 240 std::string languages( |
241 AddSupportedInputMethodValues(preferred_languages_.GetValue(), | 241 AddSupportedInputMethodValues(preferred_languages_.GetValue(), |
242 preferred_languages_syncable, | 242 preferred_languages_syncable, |
243 prefs::kLanguagePreferredLanguages)); | 243 prefs::kLanguagePreferredLanguages)); |
244 base::PostTaskWithTraitsAndReplyWithResult( | 244 base::PostTaskWithTraitsAndReplyWithResult( |
245 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 245 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
246 base::TaskPriority::BACKGROUND), | |
247 base::Bind(&CheckAndResolveLocales, languages), | 246 base::Bind(&CheckAndResolveLocales, languages), |
248 base::Bind(&InputMethodSyncer::FinishMerge, weak_factory_.GetWeakPtr())); | 247 base::Bind(&InputMethodSyncer::FinishMerge, weak_factory_.GetWeakPtr())); |
249 } | 248 } |
250 | 249 |
251 std::string InputMethodSyncer::AddSupportedInputMethodValues( | 250 std::string InputMethodSyncer::AddSupportedInputMethodValues( |
252 const std::string& pref, | 251 const std::string& pref, |
253 const std::string& synced_pref, | 252 const std::string& synced_pref, |
254 const char* pref_name) { | 253 const char* pref_name) { |
255 std::vector<base::StringPiece> old_tokens = base::SplitStringPiece( | 254 std::vector<base::StringPiece> old_tokens = base::SplitStringPiece( |
256 pref, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 255 pref, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 327 |
329 void InputMethodSyncer::OnIsSyncingChanged() { | 328 void InputMethodSyncer::OnIsSyncingChanged() { |
330 if (prefs_->GetBoolean(prefs::kLanguageShouldMergeInputMethods) && | 329 if (prefs_->GetBoolean(prefs::kLanguageShouldMergeInputMethods) && |
331 prefs_->IsSyncing()) { | 330 prefs_->IsSyncing()) { |
332 MergeSyncedPrefs(); | 331 MergeSyncedPrefs(); |
333 } | 332 } |
334 } | 333 } |
335 | 334 |
336 } // namespace input_method | 335 } // namespace input_method |
337 } // namespace chromeos | 336 } // namespace chromeos |
OLD | NEW |