| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
| 15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "components/pref_registry/pref_registry_syncable.h" | 18 #include "components/pref_registry/pref_registry_syncable.h" |
| 19 #include "components/syncable_prefs/pref_service_syncable.h" | 19 #include "components/sync_preferences/pref_service_syncable.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | 21 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 22 #include "ui/base/ime/chromeos/extension_ime_util.h" | 22 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 namespace input_method { | 26 namespace input_method { |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // Checks input method IDs, converting engine IDs to input method IDs and | 29 // Checks input method IDs, converting engine IDs to input method IDs and |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (binary_search(unique_tokens.begin(), unique_tokens.end(), token)) | 106 if (binary_search(unique_tokens.begin(), unique_tokens.end(), token)) |
| 107 continue; | 107 continue; |
| 108 dest->push_back(token); | 108 dest->push_back(token); |
| 109 unique_tokens.insert(token); | 109 unique_tokens.insert(token); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // anonymous namespace | 113 } // anonymous namespace |
| 114 | 114 |
| 115 InputMethodSyncer::InputMethodSyncer( | 115 InputMethodSyncer::InputMethodSyncer( |
| 116 syncable_prefs::PrefServiceSyncable* prefs, | 116 sync_preferences::PrefServiceSyncable* prefs, |
| 117 scoped_refptr<input_method::InputMethodManager::State> ime_state) | 117 scoped_refptr<input_method::InputMethodManager::State> ime_state) |
| 118 : prefs_(prefs), | 118 : prefs_(prefs), |
| 119 ime_state_(ime_state), | 119 ime_state_(ime_state), |
| 120 merging_(false), | 120 merging_(false), |
| 121 weak_factory_(this) {} | 121 weak_factory_(this) {} |
| 122 | 122 |
| 123 InputMethodSyncer::~InputMethodSyncer() { | 123 InputMethodSyncer::~InputMethodSyncer() { |
| 124 prefs_->RemoveObserver(this); | 124 prefs_->RemoveObserver(this); |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 void InputMethodSyncer::OnIsSyncingChanged() { | 323 void InputMethodSyncer::OnIsSyncingChanged() { |
| 324 if (prefs_->GetBoolean(prefs::kLanguageShouldMergeInputMethods) && | 324 if (prefs_->GetBoolean(prefs::kLanguageShouldMergeInputMethods) && |
| 325 prefs_->IsSyncing()) { | 325 prefs_->IsSyncing()) { |
| 326 MergeSyncedPrefs(); | 326 MergeSyncedPrefs(); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace input_method | 330 } // namespace input_method |
| 331 } // namespace chromeos | 331 } // namespace chromeos |
| OLD | NEW |