| 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" | |
| 39 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 38 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 40 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 39 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
| 41 #include "chrome/browser/sync/protocol/service_constants.h" | 40 #include "chrome/browser/sync/protocol/service_constants.h" |
| 42 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 41 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
| 43 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" | 42 #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" |
| 44 #include "chrome/browser/sync/sessions/sync_session_context.h" | 43 #include "chrome/browser/sync/sessions/sync_session_context.h" |
| 45 #include "chrome/browser/sync/syncable/directory_manager.h" | 44 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 46 #include "chrome/browser/sync/syncable/syncable.h" | 45 #include "chrome/browser/sync/syncable/syncable.h" |
| 47 #include "chrome/browser/sync/util/character_set_converters.h" | 46 #include "chrome/browser/sync/util/character_set_converters.h" |
| 48 #include "chrome/browser/sync/util/closure.h" | 47 #include "chrome/browser/sync/util/closure.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { | 235 const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { |
| 237 DCHECK(GetModelType() == syncable::AUTOFILL); | 236 DCHECK(GetModelType() == syncable::AUTOFILL); |
| 238 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::autofill); | 237 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::autofill); |
| 239 } | 238 } |
| 240 | 239 |
| 241 const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { | 240 const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { |
| 242 DCHECK(GetModelType() == syncable::BOOKMARKS); | 241 DCHECK(GetModelType() == syncable::BOOKMARKS); |
| 243 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::bookmark); | 242 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::bookmark); |
| 244 } | 243 } |
| 245 | 244 |
| 246 const sync_pb::NigoriSpecifics& BaseNode::GetNigoriSpecifics() const { | |
| 247 DCHECK(GetModelType() == syncable::NIGORI); | |
| 248 return GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::nigori); | |
| 249 } | |
| 250 | |
| 251 bool BaseNode::GetPasswordSpecifics(sync_pb::PasswordSpecificsData* data) | 245 bool BaseNode::GetPasswordSpecifics(sync_pb::PasswordSpecificsData* data) |
| 252 const { | 246 const { |
| 253 DCHECK(GetModelType() == syncable::PASSWORDS); | 247 DCHECK(GetModelType() == syncable::PASSWORDS); |
| 254 DCHECK(data); | 248 DCHECK(data); |
| 255 const sync_pb::PasswordSpecifics& specifics = | 249 const sync_pb::PasswordSpecifics& specifics = |
| 256 GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::password); | 250 GetEntry()->Get(SPECIFICS).GetExtension(sync_pb::password); |
| 257 return data->ParseFromString(specifics.blob()); | 251 return data->ParseFromString(specifics.blob()); |
| 258 } | 252 } |
| 259 | 253 |
| 260 const sync_pb::PreferenceSpecifics& BaseNode::GetPreferenceSpecifics() const { | 254 const sync_pb::PreferenceSpecifics& BaseNode::GetPreferenceSpecifics() const { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 PutBookmarkSpecificsAndMarkForSyncing(new_value); | 323 PutBookmarkSpecificsAndMarkForSyncing(new_value); |
| 330 } | 324 } |
| 331 | 325 |
| 332 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( | 326 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( |
| 333 const sync_pb::BookmarkSpecifics& new_value) { | 327 const sync_pb::BookmarkSpecifics& new_value) { |
| 334 sync_pb::EntitySpecifics entity_specifics; | 328 sync_pb::EntitySpecifics entity_specifics; |
| 335 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); | 329 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); |
| 336 PutSpecificsAndMarkForSyncing(entity_specifics); | 330 PutSpecificsAndMarkForSyncing(entity_specifics); |
| 337 } | 331 } |
| 338 | 332 |
| 339 void WriteNode::SetNigoriSpecifics( | |
| 340 const sync_pb::NigoriSpecifics& new_value) { | |
| 341 DCHECK(GetModelType() == syncable::NIGORI); | |
| 342 PutNigoriSpecificsAndMarkForSyncing(new_value); | |
| 343 } | |
| 344 | |
| 345 void WriteNode::PutNigoriSpecificsAndMarkForSyncing( | |
| 346 const sync_pb::NigoriSpecifics& new_value) { | |
| 347 sync_pb::EntitySpecifics entity_specifics; | |
| 348 entity_specifics.MutableExtension(sync_pb::nigori)->CopyFrom(new_value); | |
| 349 PutSpecificsAndMarkForSyncing(entity_specifics); | |
| 350 } | |
| 351 | |
| 352 void WriteNode::SetPasswordSpecifics( | 333 void WriteNode::SetPasswordSpecifics( |
| 353 const sync_pb::PasswordSpecificsData& data) { | 334 const sync_pb::PasswordSpecificsData& data) { |
| 354 DCHECK(GetModelType() == syncable::PASSWORDS); | 335 DCHECK(GetModelType() == syncable::PASSWORDS); |
| 355 std::string serialized_data; | 336 std::string serialized_data; |
| 356 data.SerializeToString(&serialized_data); | 337 data.SerializeToString(&serialized_data); |
| 357 sync_pb::PasswordSpecifics new_value; | 338 sync_pb::PasswordSpecifics new_value; |
| 358 new_value.set_blob(serialized_data); | 339 new_value.set_blob(serialized_data); |
| 359 PutPasswordSpecificsAndMarkForSyncing(new_value); | 340 PutPasswordSpecificsAndMarkForSyncing(new_value); |
| 360 } | 341 } |
| 361 | 342 |
| (...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 UserShare* SyncManager::GetUserShare() const { | 1987 UserShare* SyncManager::GetUserShare() const { |
| 2007 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1988 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
| 2008 return data_->GetUserShare(); | 1989 return data_->GetUserShare(); |
| 2009 } | 1990 } |
| 2010 | 1991 |
| 2011 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { | 1992 SyncManager::ExtraAutofillChangeRecordData::~ExtraAutofillChangeRecordData() { |
| 2012 delete pre_deletion_data; | 1993 delete pre_deletion_data; |
| 2013 } | 1994 } |
| 2014 | 1995 |
| 2015 } // namespace sync_api | 1996 } // namespace sync_api |
| OLD | NEW |