OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
11 | 11 |
12 class SyncError; | |
13 | |
12 namespace sync_api { | 14 namespace sync_api { |
13 class BaseNode; | 15 class BaseNode; |
14 } | 16 } |
15 | 17 |
16 namespace browser_sync { | 18 namespace browser_sync { |
17 | 19 |
18 // This represents the fundamental operations used for model association that | 20 // This represents the fundamental operations used for model association that |
19 // are common to all ModelAssociators and do not depend on types of the models | 21 // are common to all ModelAssociators and do not depend on types of the models |
20 // being associated. | 22 // being associated. |
21 class AssociatorInterface { | 23 class AssociatorInterface { |
22 public: | 24 public: |
23 virtual ~AssociatorInterface() {} | 25 virtual ~AssociatorInterface() {} |
24 | 26 |
25 // Iterates through both the sync and the chrome model looking for | 27 // Iterates through both the sync and the chrome model looking for |
26 // matched pairs of items. After successful completion, the models | 28 // matched pairs of items. After successful completion, the models |
27 // should be identical and corresponding. Returns true on | 29 // should be identical and corresponding. Returns true on |
28 // success. On failure of this step, we should abort the sync | 30 // success. On failure of this step, we should abort the sync |
29 // operation and report an error to the user. | 31 // operation and report an error to the user. |
30 virtual bool AssociateModels() = 0; | 32 virtual bool AssociateModels(SyncError* error) = 0; |
akalin
2011/07/25 22:43:13
Change these to return SyncErrors too? (and subcl
Nicolas Zea
2011/07/25 23:08:19
Since this is already an established (and now depr
akalin
2011/07/25 23:49:32
Yeah, for practicality's sake I guess we can leave
| |
31 | 33 |
32 // Clears all the associations between the chrome and sync models. | 34 // Clears all the associations between the chrome and sync models. |
33 virtual bool DisassociateModels() = 0; | 35 virtual bool DisassociateModels(SyncError* error) = 0; |
34 | 36 |
35 // 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 |
36 // nodes other than the permanent tagged nodes. The method may | 38 // nodes other than the permanent tagged nodes. The method may |
37 // return false if an error occurred. | 39 // return false if an error occurred. |
38 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0; | 40 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0; |
39 | 41 |
40 // Calling this method while AssociateModels() is in progress will | 42 // Calling this method while AssociateModels() is in progress will |
41 // 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 |
42 // is useful for aborting model associations for shutdown. This | 44 // is useful for aborting model associations for shutdown. This |
43 // method is only implemented for model associators that are invoked | 45 // method is only implemented for model associators that are invoked |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 // Associates the given chrome node with the given sync id. | 83 // Associates the given chrome node with the given sync id. |
82 virtual void Associate(const Node* node, int64 sync_id) = 0; | 84 virtual void Associate(const Node* node, int64 sync_id) = 0; |
83 | 85 |
84 // Remove the association that corresponds to the given sync id. | 86 // Remove the association that corresponds to the given sync id. |
85 virtual void Disassociate(int64 sync_id) = 0; | 87 virtual void Disassociate(int64 sync_id) = 0; |
86 }; | 88 }; |
87 | 89 |
88 } // namespace browser_sync | 90 } // namespace browser_sync |
89 | 91 |
90 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 92 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
OLD | NEW |