| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/glue/preference_model_associator.h" | 5 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 << "might be running against an out-of-date server."; | 147 << "might be running against an out-of-date server."; |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // The sync model has user created nodes if the preferences folder has any | 151 // The sync model has user created nodes if the preferences folder has any |
| 152 // children. | 152 // children. |
| 153 *has_nodes = sync_api::kInvalidId != preferences_node.GetFirstChildId(); | 153 *has_nodes = sync_api::kInvalidId != preferences_node.GetFirstChildId(); |
| 154 return true; | 154 return true; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool PreferenceModelAssociator::ChromeModelHasUserCreatedNodes( | |
| 158 bool* has_nodes) { | |
| 159 DCHECK(has_nodes); | |
| 160 // Assume the preferences model always have user-created nodes. | |
| 161 *has_nodes = true; | |
| 162 return true; | |
| 163 } | |
| 164 | |
| 165 int64 PreferenceModelAssociator::GetSyncIdFromChromeId( | 157 int64 PreferenceModelAssociator::GetSyncIdFromChromeId( |
| 166 const std::wstring preference_name) { | 158 const std::wstring preference_name) { |
| 167 PreferenceNameToSyncIdMap::const_iterator iter = | 159 PreferenceNameToSyncIdMap::const_iterator iter = |
| 168 id_map_.find(preference_name); | 160 id_map_.find(preference_name); |
| 169 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; | 161 return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; |
| 170 } | 162 } |
| 171 | 163 |
| 172 void PreferenceModelAssociator::Associate( | 164 void PreferenceModelAssociator::Associate( |
| 173 const PrefService::Preference* preference, int64 sync_id) { | 165 const PrefService::Preference* preference, int64 sync_id) { |
| 174 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 166 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // Note that for all other types we want to preserve the "to" | 282 // Note that for all other types we want to preserve the "to" |
| 291 // values so we do nothing here. | 283 // values so we do nothing here. |
| 292 } else { | 284 } else { |
| 293 result->SetWithoutPathExpansion(*key, from_value->DeepCopy()); | 285 result->SetWithoutPathExpansion(*key, from_value->DeepCopy()); |
| 294 } | 286 } |
| 295 } | 287 } |
| 296 return result; | 288 return result; |
| 297 } | 289 } |
| 298 | 290 |
| 299 } // namespace browser_sync | 291 } // namespace browser_sync |
| OLD | NEW |