OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/bookmark_model_associator.h" | 5 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/format_macros.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/bookmarks/bookmark_model.h" | 18 #include "chrome/browser/bookmarks/bookmark_model.h" |
17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 20 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
19 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
20 #include "sync/api/sync_error.h" | 22 #include "sync/api/sync_error.h" |
21 #include "sync/internal_api/public/delete_journal.h" | 23 #include "sync/internal_api/public/delete_journal.h" |
22 #include "sync/internal_api/public/read_node.h" | 24 #include "sync/internal_api/public/read_node.h" |
23 #include "sync/internal_api/public/read_transaction.h" | 25 #include "sync/internal_api/public/read_transaction.h" |
24 #include "sync/internal_api/public/write_node.h" | 26 #include "sync/internal_api/public/write_node.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 ModelTypeToHistogramInt(syncer::BOOKMARKS), | 727 ModelTypeToHistogramInt(syncer::BOOKMARKS), |
726 syncer::MODEL_TYPE_COUNT); | 728 syncer::MODEL_TYPE_COUNT); |
727 | 729 |
728 // Clear version on bookmark model so that we only report error once. | 730 // Clear version on bookmark model so that we only report error once. |
729 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(), | 731 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(), |
730 kBookmarkTransactionVersionKey); | 732 kBookmarkTransactionVersionKey); |
731 | 733 |
732 // If the native version is higher, there was a sync persistence failure, | 734 // If the native version is higher, there was a sync persistence failure, |
733 // and we need to delay association until after a GetUpdates. | 735 // and we need to delay association until after a GetUpdates. |
734 if (sync_version < native_version) { | 736 if (sync_version < native_version) { |
735 DVLOG(1) << "Native version (" << native_version << ") does not match " | 737 std::string message = base::StringPrintf( |
736 << "sync version (" << sync_version << ")."; | 738 "Native version (%" PRId64 ") does not match sync version (%" |
737 // TODO(zea): return a persistence error here. | 739 PRId64 ")", |
| 740 native_version, |
| 741 sync_version); |
| 742 return syncer::SyncError(FROM_HERE, |
| 743 syncer::SyncError::PERSISTENCE_ERROR, |
| 744 message, |
| 745 syncer::BOOKMARKS); |
738 } | 746 } |
739 } | 747 } |
740 } | 748 } |
741 return syncer::SyncError(); | 749 return syncer::SyncError(); |
742 } | 750 } |
743 | 751 |
744 } // namespace browser_sync | 752 } // namespace browser_sync |
OLD | NEW |