| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/engine/syncapi.h" | 5 #include "chrome/browser/sync/engine/syncapi.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <iomanip> | 9 #include <iomanip> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/sync/engine/auth_watcher.h" | 28 #include "chrome/browser/sync/engine/auth_watcher.h" |
| 29 #include "chrome/browser/sync/engine/change_reorder_buffer.h" | 29 #include "chrome/browser/sync/engine/change_reorder_buffer.h" |
| 30 #include "chrome/browser/sync/engine/model_safe_worker.h" | 30 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 31 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 31 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 32 #include "chrome/browser/sync/engine/net/syncapi_server_connection_manager.h" | 32 #include "chrome/browser/sync/engine/net/syncapi_server_connection_manager.h" |
| 33 #include "chrome/browser/sync/engine/syncer.h" | 33 #include "chrome/browser/sync/engine/syncer.h" |
| 34 #include "chrome/browser/sync/engine/syncer_thread.h" | 34 #include "chrome/browser/sync/engine/syncer_thread.h" |
| 35 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 35 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
| 36 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 36 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
| 37 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" | 37 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
| 38 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" |
| 38 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 39 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 39 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 40 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
| 40 #include "chrome/browser/sync/protocol/service_constants.h" | 41 #include "chrome/browser/sync/protocol/service_constants.h" |
| 41 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 42 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
| 42 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" | 43 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" |
| 43 #include "chrome/browser/sync/sessions/sync_session_context.h" | 44 #include "chrome/browser/sync/sessions/sync_session_context.h" |
| 44 #include "chrome/browser/sync/syncable/directory_manager.h" | 45 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 45 #include "chrome/browser/sync/syncable/syncable.h" | 46 #include "chrome/browser/sync/syncable/syncable.h" |
| 46 #include "chrome/browser/sync/util/character_set_converters.h" | 47 #include "chrome/browser/sync/util/character_set_converters.h" |
| 47 #include "chrome/browser/sync/util/closure.h" | 48 #include "chrome/browser/sync/util/closure.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { | 239 const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { |
| 239 DCHECK(GetModelType() == syncable::AUTOFILL); | 240 DCHECK(GetModelType() == syncable::AUTOFILL); |
| 240 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::autofill); | 241 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::autofill); |
| 241 } | 242 } |
| 242 | 243 |
| 243 const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { | 244 const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { |
| 244 DCHECK(GetModelType() == syncable::BOOKMARKS); | 245 DCHECK(GetModelType() == syncable::BOOKMARKS); |
| 245 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::bookmark); | 246 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::bookmark); |
| 246 } | 247 } |
| 247 | 248 |
| 249 const sync_pb::NigoriSpecifics& BaseNode::GetNigoriSpecifics() const { |
| 250 DCHECK(GetModelType() == syncable::NIGORI); |
| 251 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::nigori); |
| 252 } |
| 253 |
| 248 bool BaseNode::GetPasswordSpecifics(sync_pb::PasswordSpecificsData* data) | 254 bool BaseNode::GetPasswordSpecifics(sync_pb::PasswordSpecificsData* data) |
| 249 const { | 255 const { |
| 250 DCHECK(GetModelType() == syncable::PASSWORDS); | 256 DCHECK(GetModelType() == syncable::PASSWORDS); |
| 251 DCHECK(data); | 257 DCHECK(data); |
| 252 const sync_pb::PasswordSpecifics& specifics = | 258 const sync_pb::PasswordSpecifics& specifics = |
| 253 GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::password); | 259 GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::password); |
| 254 return data->ParseFromString(specifics.blob()); | 260 return data->ParseFromString(specifics.blob()); |
| 255 } | 261 } |
| 256 | 262 |
| 257 const sync_pb::PreferenceSpecifics& BaseNode::GetPreferenceSpecifics() const { | 263 const sync_pb::PreferenceSpecifics& BaseNode::GetPreferenceSpecifics() const { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 PutBookmarkSpecificsAndMarkForSyncing(new_value); | 332 PutBookmarkSpecificsAndMarkForSyncing(new_value); |
| 327 } | 333 } |
| 328 | 334 |
| 329 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( | 335 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( |
| 330 const sync_pb::BookmarkSpecifics& new_value) { | 336 const sync_pb::BookmarkSpecifics& new_value) { |
| 331 sync_pb::EntitySpecifics entity_specifics; | 337 sync_pb::EntitySpecifics entity_specifics; |
| 332 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); | 338 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); |
| 333 PutSpecificsAndMarkForSyncing(entity_specifics); | 339 PutSpecificsAndMarkForSyncing(entity_specifics); |
| 334 } | 340 } |
| 335 | 341 |
| 342 void WriteNode::SetNigoriSpecifics( |
| 343 const sync_pb::NigoriSpecifics& new_value) { |
| 344 DCHECK(GetModelType() == syncable::NIGORI); |
| 345 PutNigoriSpecificsAndMarkForSyncing(new_value); |
| 346 } |
| 347 |
| 348 void WriteNode::PutNigoriSpecificsAndMarkForSyncing( |
| 349 const sync_pb::NigoriSpecifics& new_value) { |
| 350 sync_pb::EntitySpecifics entity_specifics; |
| 351 entity_specifics.MutableExtension(sync_pb::nigori)->CopyFrom(new_value); |
| 352 PutSpecificsAndMarkForSyncing(entity_specifics); |
| 353 } |
| 354 |
| 336 void WriteNode::SetPasswordSpecifics( | 355 void WriteNode::SetPasswordSpecifics( |
| 337 const sync_pb::PasswordSpecificsData& data) { | 356 const sync_pb::PasswordSpecificsData& data) { |
| 338 DCHECK(GetModelType() == syncable::PASSWORDS); | 357 DCHECK(GetModelType() == syncable::PASSWORDS); |
| 339 std::string serialized_data; | 358 std::string serialized_data; |
| 340 data.SerializeToString(&serialized_data); | 359 data.SerializeToString(&serialized_data); |
| 341 sync_pb::PasswordSpecifics new_value; | 360 sync_pb::PasswordSpecifics new_value; |
| 342 new_value.set_blob(serialized_data); | 361 new_value.set_blob(serialized_data); |
| 343 PutPasswordSpecificsAndMarkForSyncing(new_value); | 362 PutPasswordSpecificsAndMarkForSyncing(new_value); |
| 344 } | 363 } |
| 345 | 364 |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 UserShare* SyncManager::GetUserShare() const { | 1988 UserShare* SyncManager::GetUserShare() const { |
| 1970 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1989 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
| 1971 return data_->GetUserShare(); | 1990 return data_->GetUserShare(); |
| 1972 } | 1991 } |
| 1973 | 1992 |
| 1974 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { | 1993 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { |
| 1975 delete pre_deletion_data; | 1994 delete pre_deletion_data; |
| 1976 } | 1995 } |
| 1977 | 1996 |
| 1978 } // namespace sync_api | 1997 } // namespace sync_api |
| OLD | NEW |