| 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_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // being associated. | 22 // being associated. |
| 23 class AssociatorInterface { | 23 class AssociatorInterface { |
| 24 public: | 24 public: |
| 25 virtual ~AssociatorInterface() {} | 25 virtual ~AssociatorInterface() {} |
| 26 | 26 |
| 27 // Iterates through both the sync and the chrome model looking for | 27 // Iterates through both the sync and the chrome model looking for |
| 28 // matched pairs of items. After successful completion, the models | 28 // matched pairs of items. After successful completion, the models |
| 29 // should be identical and corresponding. Returns true on | 29 // should be identical and corresponding. Returns true on |
| 30 // success. On failure of this step, we should abort the sync | 30 // success. On failure of this step, we should abort the sync |
| 31 // operation and report an error to the user. | 31 // operation and report an error to the user. |
| 32 virtual SyncError AssociateModels() = 0; | 32 virtual csync::SyncError AssociateModels() = 0; |
| 33 | 33 |
| 34 // Clears all the associations between the chrome and sync models. | 34 // Clears all the associations between the chrome and sync models. |
| 35 virtual SyncError DisassociateModels() = 0; | 35 virtual csync::SyncError DisassociateModels() = 0; |
| 36 | 36 |
| 37 // The has_nodes out parameter is set to true if the sync model has | 37 // The has_nodes out parameter is set to true if the sync model has |
| 38 // nodes other than the permanent tagged nodes. The method may | 38 // nodes other than the permanent tagged nodes. The method may |
| 39 // return false if an error occurred. | 39 // return false if an error occurred. |
| 40 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0; | 40 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0; |
| 41 | 41 |
| 42 // Calling this method while AssociateModels() is in progress will | 42 // Calling this method while AssociateModels() is in progress will |
| 43 // cause the method to exit early with a "false" return value. This | 43 // cause the method to exit early with a "false" return value. This |
| 44 // is useful for aborting model associations for shutdown. This | 44 // is useful for aborting model associations for shutdown. This |
| 45 // method is only implemented for model associators that are invoked | 45 // method is only implemented for model associators that are invoked |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Associates the given chrome node with the given sync id. | 84 // Associates the given chrome node with the given sync id. |
| 85 virtual void Associate(const Node* node, int64 sync_id) = 0; | 85 virtual void Associate(const Node* node, int64 sync_id) = 0; |
| 86 | 86 |
| 87 // Remove the association that corresponds to the given sync id. | 87 // Remove the association that corresponds to the given sync id. |
| 88 virtual void Disassociate(int64 sync_id) = 0; | 88 virtual void Disassociate(int64 sync_id) = 0; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace browser_sync | 91 } // namespace browser_sync |
| 92 | 92 |
| 93 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 93 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |