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