OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 static syncable::ModelType model_type() { return syncable::TYPED_URLS; } | 52 static syncable::ModelType model_type() { return syncable::TYPED_URLS; } |
53 TypedUrlModelAssociator(ProfileSyncService* sync_service, | 53 TypedUrlModelAssociator(ProfileSyncService* sync_service, |
54 history::HistoryBackend* history_backend, | 54 history::HistoryBackend* history_backend, |
55 DataTypeErrorHandler* error_handler); | 55 DataTypeErrorHandler* error_handler); |
56 virtual ~TypedUrlModelAssociator(); | 56 virtual ~TypedUrlModelAssociator(); |
57 | 57 |
58 // AssociatorInterface implementation. | 58 // AssociatorInterface implementation. |
59 // | 59 // |
60 // Iterates through the sync model looking for matched pairs of items. | 60 // Iterates through the sync model looking for matched pairs of items. |
61 virtual SyncError AssociateModels() OVERRIDE; | 61 virtual csync::SyncError AssociateModels() OVERRIDE; |
62 | 62 |
63 // Clears all associations. | 63 // Clears all associations. |
64 virtual SyncError DisassociateModels() OVERRIDE; | 64 virtual csync::SyncError DisassociateModels() OVERRIDE; |
65 | 65 |
66 // Called from the main thread, to abort the currently active model | 66 // Called from the main thread, to abort the currently active model |
67 // association (for example, if we are shutting down). | 67 // association (for example, if we are shutting down). |
68 virtual void AbortAssociation() OVERRIDE; | 68 virtual void AbortAssociation() OVERRIDE; |
69 | 69 |
70 // The has_nodes out param is true if the sync model has nodes other | 70 // The has_nodes out param is true if the sync model has nodes other |
71 // than the permanent tagged nodes. | 71 // than the permanent tagged nodes. |
72 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; | 72 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; |
73 | 73 |
74 virtual bool CryptoReadyIfNecessary() OVERRIDE; | 74 virtual bool CryptoReadyIfNecessary() OVERRIDE; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 virtual bool IsAbortPending(); | 166 virtual bool IsAbortPending(); |
167 | 167 |
168 // Helper function that clears our error counters (used to reset stats after | 168 // Helper function that clears our error counters (used to reset stats after |
169 // model association so we can track model association errors separately). | 169 // model association so we can track model association errors separately). |
170 // Overridden by tests. | 170 // Overridden by tests. |
171 virtual void ClearErrorStats(); | 171 virtual void ClearErrorStats(); |
172 | 172 |
173 private: | 173 private: |
174 | 174 |
175 // Helper routine that actually does the work of associating models. | 175 // Helper routine that actually does the work of associating models. |
176 SyncError DoAssociateModels(); | 176 csync::SyncError DoAssociateModels(); |
177 | 177 |
178 // Helper function that determines if we should ignore a URL for the purposes | 178 // Helper function that determines if we should ignore a URL for the purposes |
179 // of sync, because it contains invalid data or is import-only. | 179 // of sync, because it contains invalid data or is import-only. |
180 bool ShouldIgnoreUrl(const history::URLRow& url, | 180 bool ShouldIgnoreUrl(const history::URLRow& url, |
181 const history::VisitVector& visits); | 181 const history::VisitVector& visits); |
182 | 182 |
183 ProfileSyncService* sync_service_; | 183 ProfileSyncService* sync_service_; |
184 history::HistoryBackend* history_backend_; | 184 history::HistoryBackend* history_backend_; |
185 | 185 |
186 MessageLoop* expected_loop_; | 186 MessageLoop* expected_loop_; |
(...skipping 10 matching lines...) Expand all Loading... |
197 // fail for each client via UMA. | 197 // fail for each client via UMA. |
198 int num_db_accesses_; | 198 int num_db_accesses_; |
199 int num_db_errors_; | 199 int num_db_errors_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(TypedUrlModelAssociator); | 201 DISALLOW_COPY_AND_ASSIGN(TypedUrlModelAssociator); |
202 }; | 202 }; |
203 | 203 |
204 } // namespace browser_sync | 204 } // namespace browser_sync |
205 | 205 |
206 #endif // CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ | 206 #endif // CHROME_BROWSER_SYNC_GLUE_TYPED_URL_MODEL_ASSOCIATOR_H_ |
OLD | NEW |