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

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

Issue 8470005: Add OVERRIDE to chrome/browser/sync/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: includes Created 9 years 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_BOOKMARK_MODEL_ASSOCIATOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
14 #include "base/task.h" 15 #include "base/task.h"
15 #include "chrome/browser/sync/unrecoverable_error_handler.h" 16 #include "chrome/browser/sync/unrecoverable_error_handler.h"
16 #include "chrome/browser/sync/glue/model_associator.h" 17 #include "chrome/browser/sync/glue/model_associator.h"
17 18
18 class BookmarkModel; 19 class BookmarkModel;
19 class BookmarkNode; 20 class BookmarkNode;
20 21
21 namespace sync_api { 22 namespace sync_api {
22 class BaseNode; 23 class BaseNode;
23 struct UserShare; 24 struct UserShare;
(...skipping 17 matching lines...) Expand all
41 42
42 // AssociatorInterface implementation. 43 // AssociatorInterface implementation.
43 // 44 //
44 // AssociateModels iterates through both the sync and the browser 45 // AssociateModels iterates through both the sync and the browser
45 // bookmark model, looking for matched pairs of items. For any pairs it 46 // bookmark model, looking for matched pairs of items. For any pairs it
46 // finds, it will call AssociateSyncID. For any unmatched items, 47 // finds, it will call AssociateSyncID. For any unmatched items,
47 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new 48 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new
48 // node. After successful completion, the models should be identical and 49 // node. After successful completion, the models should be identical and
49 // corresponding. Returns true on success. On failure of this step, we 50 // corresponding. Returns true on success. On failure of this step, we
50 // should abort the sync operation and report an error to the user. 51 // should abort the sync operation and report an error to the user.
51 virtual bool AssociateModels(SyncError* error); 52 virtual bool AssociateModels(SyncError* error) OVERRIDE;
52 53
53 virtual bool DisassociateModels(SyncError* error); 54 virtual bool DisassociateModels(SyncError* error) OVERRIDE;
54 55
55 // The has_nodes out param is true if the sync model has nodes other 56 // The has_nodes out param is true if the sync model has nodes other
56 // than the permanent tagged nodes. 57 // than the permanent tagged nodes.
57 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); 58 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE;
58 59
59 // Returns sync id for the given bookmark node id. 60 // Returns sync id for the given bookmark node id.
60 // Returns sync_api::kInvalidId if the sync node is not found for the given 61 // Returns sync_api::kInvalidId if the sync node is not found for the given
61 // bookmark node id. 62 // bookmark node id.
62 virtual int64 GetSyncIdFromChromeId(const int64& node_id); 63 virtual int64 GetSyncIdFromChromeId(const int64& node_id) OVERRIDE;
63 64
64 // Returns the bookmark node for the given sync id. 65 // Returns the bookmark node for the given sync id.
65 // Returns NULL if no bookmark node is found for the given sync id. 66 // Returns NULL if no bookmark node is found for the given sync id.
66 virtual const BookmarkNode* GetChromeNodeFromSyncId(int64 sync_id); 67 virtual const BookmarkNode* GetChromeNodeFromSyncId(int64 sync_id) OVERRIDE;
67 68
68 // Initializes the given sync node from the given bookmark node id. 69 // Initializes the given sync node from the given bookmark node id.
69 // Returns false if no sync node was found for the given bookmark node id or 70 // Returns false if no sync node was found for the given bookmark node id or
70 // if the initialization of sync node fails. 71 // if the initialization of sync node fails.
71 virtual bool InitSyncNodeFromChromeId(const int64& node_id, 72 virtual bool InitSyncNodeFromChromeId(const int64& node_id,
72 sync_api::BaseNode* sync_node); 73 sync_api::BaseNode* sync_node) OVERRIDE;
73 74
74 // Associates the given bookmark node with the given sync id. 75 // Associates the given bookmark node with the given sync id.
75 virtual void Associate(const BookmarkNode* node, int64 sync_id); 76 virtual void Associate(const BookmarkNode* node, int64 sync_id) OVERRIDE;
76 // Remove the association that corresponds to the given sync id. 77 // Remove the association that corresponds to the given sync id.
77 virtual void Disassociate(int64 sync_id); 78 virtual void Disassociate(int64 sync_id) OVERRIDE;
78 79
79 virtual void AbortAssociation() { 80 virtual void AbortAssociation() OVERRIDE {
80 // No implementation needed, this associator runs on the main 81 // No implementation needed, this associator runs on the main
81 // thread. 82 // thread.
82 } 83 }
83 84
84 // See ModelAssociator interface. 85 // See ModelAssociator interface.
85 virtual bool CryptoReadyIfNecessary(); 86 virtual bool CryptoReadyIfNecessary() OVERRIDE;
86 87
87 protected: 88 protected:
88 // Stores the id of the node with the given tag in |sync_id|. 89 // Stores the id of the node with the given tag in |sync_id|.
89 // Returns of that node was found successfully. 90 // Returns of that node was found successfully.
90 // Tests override this. 91 // Tests override this.
91 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); 92 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id);
92 93
93 private: 94 private:
94 typedef std::map<int64, int64> BookmarkIdToSyncIdMap; 95 typedef std::map<int64, int64> BookmarkIdToSyncIdMap;
95 typedef std::map<int64, const BookmarkNode*> SyncIdToBookmarkNodeMap; 96 typedef std::map<int64, const BookmarkNode*> SyncIdToBookmarkNodeMap;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; 136 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_;
136 137
137 int number_of_new_sync_nodes_created_at_association_; 138 int number_of_new_sync_nodes_created_at_association_;
138 139
139 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 140 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
140 }; 141 };
141 142
142 } // namespace browser_sync 143 } // namespace browser_sync
143 144
144 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 145 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bookmark_data_type_controller.h ('k') | chrome/browser/sync/glue/data_type_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698