Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1872)

Side by Side Diff: chrome/browser/sync/glue/model_associator.h

Issue 7497014: Revert 94128 - [Sync] Refactor sync datatype error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
14 namespace sync_api { 12 namespace sync_api {
15 class BaseNode; 13 class BaseNode;
16 } 14 }
17 15
18 namespace browser_sync { 16 namespace browser_sync {
19 17
20 // This represents the fundamental operations used for model association that 18 // This represents the fundamental operations used for model association that
21 // are common to all ModelAssociators and do not depend on types of the models 19 // are common to all ModelAssociators and do not depend on types of the models
22 // being associated. 20 // being associated.
23 class AssociatorInterface { 21 class AssociatorInterface {
24 public: 22 public:
25 virtual ~AssociatorInterface() {} 23 virtual ~AssociatorInterface() {}
26 24
27 // Iterates through both the sync and the chrome model looking for 25 // Iterates through both the sync and the chrome model looking for
28 // matched pairs of items. After successful completion, the models 26 // matched pairs of items. After successful completion, the models
29 // should be identical and corresponding. Returns true on 27 // should be identical and corresponding. Returns true on
30 // success. On failure of this step, we should abort the sync 28 // success. On failure of this step, we should abort the sync
31 // operation and report an error to the user. 29 // operation and report an error to the user.
32 // TODO(zea): return a SyncError instead of passing one in. 30 virtual bool AssociateModels() = 0;
33 virtual bool AssociateModels(SyncError* error) = 0;
34 31
35 // Clears all the associations between the chrome and sync models. 32 // Clears all the associations between the chrome and sync models.
36 // TODO(zea): return a SyncError instead of passing one in. 33 virtual bool DisassociateModels() = 0;
37 virtual bool DisassociateModels(SyncError* error) = 0;
38 34
39 // The has_nodes out parameter is set to true if the sync model has 35 // The has_nodes out parameter is set to true if the sync model has
40 // nodes other than the permanent tagged nodes. The method may 36 // nodes other than the permanent tagged nodes. The method may
41 // return false if an error occurred. 37 // return false if an error occurred.
42 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0; 38 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0;
43 39
44 // Calling this method while AssociateModels() is in progress will 40 // Calling this method while AssociateModels() is in progress will
45 // cause the method to exit early with a "false" return value. This 41 // cause the method to exit early with a "false" return value. This
46 // is useful for aborting model associations for shutdown. This 42 // is useful for aborting model associations for shutdown. This
47 // method is only implemented for model associators that are invoked 43 // method is only implemented for model associators that are invoked
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Associates the given chrome node with the given sync id. 81 // Associates the given chrome node with the given sync id.
86 virtual void Associate(const Node* node, int64 sync_id) = 0; 82 virtual void Associate(const Node* node, int64 sync_id) = 0;
87 83
88 // Remove the association that corresponds to the given sync id. 84 // Remove the association that corresponds to the given sync id.
89 virtual void Disassociate(int64 sync_id) = 0; 85 virtual void Disassociate(int64 sync_id) = 0;
90 }; 86 };
91 87
92 } // namespace browser_sync 88 } // namespace browser_sync
93 89
94 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ 90 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.cc ('k') | chrome/browser/sync/glue/model_associator_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698