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/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 <bitset> | 9 #include <bitset> |
10 #include <iomanip> | 10 #include <iomanip> |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 PutAutofillSpecificsAndMarkForSyncing(new_value); | 375 PutAutofillSpecificsAndMarkForSyncing(new_value); |
376 } | 376 } |
377 | 377 |
378 void WriteNode::PutAutofillSpecificsAndMarkForSyncing( | 378 void WriteNode::PutAutofillSpecificsAndMarkForSyncing( |
379 const sync_pb::AutofillSpecifics& new_value) { | 379 const sync_pb::AutofillSpecifics& new_value) { |
380 sync_pb::EntitySpecifics entity_specifics; | 380 sync_pb::EntitySpecifics entity_specifics; |
381 entity_specifics.MutableExtension(sync_pb::autofill)->CopyFrom(new_value); | 381 entity_specifics.MutableExtension(sync_pb::autofill)->CopyFrom(new_value); |
382 PutSpecificsAndMarkForSyncing(entity_specifics); | 382 PutSpecificsAndMarkForSyncing(entity_specifics); |
383 } | 383 } |
384 | 384 |
385 void WriteNode::SetAutofillProfileSpecifics( | |
386 const sync_pb::AutofillProfileSpecifics& new_value) { | |
387 DCHECK_EQ(GetModelType(), syncable::AUTOFILL_PROFILE); | |
388 PutAutofillProfileSpecificsAndMarkForSyncing(new_value); | |
389 } | |
390 | |
391 void WriteNode::PutAutofillProfileSpecificsAndMarkForSyncing( | |
392 const sync_pb::AutofillProfileSpecifics& new_value) { | |
393 sync_pb::EntitySpecifics entity_specifics; | |
394 entity_specifics.MutableExtension(sync_pb::autofill_profile)->CopyFrom( | |
395 new_value); | |
396 PutSpecificsAndMarkForSyncing(entity_specifics); | |
397 } | |
398 | |
385 void WriteNode::SetBookmarkSpecifics( | 399 void WriteNode::SetBookmarkSpecifics( |
386 const sync_pb::BookmarkSpecifics& new_value) { | 400 const sync_pb::BookmarkSpecifics& new_value) { |
387 DCHECK(GetModelType() == syncable::BOOKMARKS); | 401 DCHECK(GetModelType() == syncable::BOOKMARKS); |
388 PutBookmarkSpecificsAndMarkForSyncing(new_value); | 402 PutBookmarkSpecificsAndMarkForSyncing(new_value); |
389 } | 403 } |
390 | 404 |
391 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( | 405 void WriteNode::PutBookmarkSpecificsAndMarkForSyncing( |
392 const sync_pb::BookmarkSpecifics& new_value) { | 406 const sync_pb::BookmarkSpecifics& new_value) { |
393 sync_pb::EntitySpecifics entity_specifics; | 407 sync_pb::EntitySpecifics entity_specifics; |
394 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); | 408 entity_specifics.MutableExtension(sync_pb::bookmark)->CopyFrom(new_value); |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2169 // Check if the service url is a sync URL. An empty service URL is | 2183 // Check if the service url is a sync URL. An empty service URL is |
2170 // treated as a legacy sync notification. If we're listening to | 2184 // treated as a legacy sync notification. If we're listening to |
2171 // server-issued notifications, no need to check the service_url. | 2185 // server-issued notifications, no need to check the service_url. |
2172 if (notifier_options_.notification_method == | 2186 if (notifier_options_.notification_method == |
2173 notifier::NOTIFICATION_SERVER) { | 2187 notifier::NOTIFICATION_SERVER) { |
2174 VLOG(1) << "Sync received server notification: " << | 2188 VLOG(1) << "Sync received server notification: " << |
2175 notification_data.service_specific_data; | 2189 notification_data.service_specific_data; |
2176 | 2190 |
2177 if (!syncable::ModelTypeBitSetFromString( | 2191 if (!syncable::ModelTypeBitSetFromString( |
2178 notification_data.service_specific_data, | 2192 notification_data.service_specific_data, |
2179 &model_types)) { | 2193 &model_types)) { |
lipalani
2010/12/08 21:37:46
this needs to go back.
| |
2180 LOG(DFATAL) << "Could not extract model types from server data."; | 2194 // LOG(DFATAL) << "Could not extract model types from server data."; |
2181 model_types.set(); | 2195 model_types.set(); |
2182 } | 2196 } |
2183 } else if (notification_data.service_url.empty() || | 2197 } else if (notification_data.service_url.empty() || |
2184 (notification_data.service_url == | 2198 (notification_data.service_url == |
2185 browser_sync::kSyncLegacyServiceUrl) || | 2199 browser_sync::kSyncLegacyServiceUrl) || |
2186 (notification_data.service_url == | 2200 (notification_data.service_url == |
2187 browser_sync::kSyncServiceUrl)) { | 2201 browser_sync::kSyncServiceUrl)) { |
2188 VLOG(1) << "Sync received P2P notification."; | 2202 VLOG(1) << "Sync received P2P notification."; |
2189 | 2203 |
2190 // Catch for sync integration tests (uses p2p). Just set all datatypes. | 2204 // Catch for sync integration tests (uses p2p). Just set all datatypes. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2273 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 2287 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
2274 return data_->GetUserShare(); | 2288 return data_->GetUserShare(); |
2275 } | 2289 } |
2276 | 2290 |
2277 bool SyncManager::HasUnsyncedItems() const { | 2291 bool SyncManager::HasUnsyncedItems() const { |
2278 sync_api::ReadTransaction trans(GetUserShare()); | 2292 sync_api::ReadTransaction trans(GetUserShare()); |
2279 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); | 2293 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); |
2280 } | 2294 } |
2281 | 2295 |
2282 } // namespace sync_api | 2296 } // namespace sync_api |
OLD | NEW |