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

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

Issue 666733003: Standardize usage of virtual/override/final in chrome/browser/sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
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_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 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 28 matching lines...) Expand all
39 static syncer::ModelType model_type() { return syncer::BOOKMARKS; } 39 static syncer::ModelType model_type() { return syncer::BOOKMARKS; }
40 // |expect_mobile_bookmarks_folder| controls whether or not we 40 // |expect_mobile_bookmarks_folder| controls whether or not we
41 // expect the mobile bookmarks permanent folder to be created. 41 // expect the mobile bookmarks permanent folder to be created.
42 // Should be set to true only by mobile clients. 42 // Should be set to true only by mobile clients.
43 BookmarkModelAssociator( 43 BookmarkModelAssociator(
44 BookmarkModel* bookmark_model, 44 BookmarkModel* bookmark_model,
45 Profile* profile_, 45 Profile* profile_,
46 syncer::UserShare* user_share, 46 syncer::UserShare* user_share,
47 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler, 47 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler,
48 bool expect_mobile_bookmarks_folder); 48 bool expect_mobile_bookmarks_folder);
49 virtual ~BookmarkModelAssociator(); 49 ~BookmarkModelAssociator() override;
50 50
51 // Updates the visibility of the permanents node in the BookmarkModel. 51 // Updates the visibility of the permanents node in the BookmarkModel.
52 void UpdatePermanentNodeVisibility(); 52 void UpdatePermanentNodeVisibility();
53 53
54 // AssociatorInterface implementation. 54 // AssociatorInterface implementation.
55 // 55 //
56 // AssociateModels iterates through both the sync and the browser 56 // AssociateModels iterates through both the sync and the browser
57 // bookmark model, looking for matched pairs of items. For any pairs it 57 // bookmark model, looking for matched pairs of items. For any pairs it
58 // finds, it will call AssociateSyncID. For any unmatched items, 58 // finds, it will call AssociateSyncID. For any unmatched items,
59 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new 59 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new
60 // node. After successful completion, the models should be identical and 60 // node. After successful completion, the models should be identical and
61 // corresponding. Returns true on success. On failure of this step, we 61 // corresponding. Returns true on success. On failure of this step, we
62 // should abort the sync operation and report an error to the user. 62 // should abort the sync operation and report an error to the user.
63 virtual syncer::SyncError AssociateModels( 63 syncer::SyncError AssociateModels(
64 syncer::SyncMergeResult* local_merge_result, 64 syncer::SyncMergeResult* local_merge_result,
65 syncer::SyncMergeResult* syncer_merge_result) override; 65 syncer::SyncMergeResult* syncer_merge_result) override;
66 66
67 virtual syncer::SyncError DisassociateModels() override; 67 syncer::SyncError DisassociateModels() override;
68 68
69 // The has_nodes out param is true if the sync model has nodes other 69 // The has_nodes out param is true if the sync model has nodes other
70 // than the permanent tagged nodes. 70 // than the permanent tagged nodes.
71 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) override; 71 bool SyncModelHasUserCreatedNodes(bool* has_nodes) override;
72 72
73 // Returns sync id for the given bookmark node id. 73 // Returns sync id for the given bookmark node id.
74 // Returns syncer::kInvalidId if the sync node is not found for the given 74 // Returns syncer::kInvalidId if the sync node is not found for the given
75 // bookmark node id. 75 // bookmark node id.
76 virtual int64 GetSyncIdFromChromeId(const int64& node_id) override; 76 int64 GetSyncIdFromChromeId(const int64& node_id) override;
77 77
78 // Returns the bookmark node for the given sync id. 78 // Returns the bookmark node for the given sync id.
79 // Returns NULL if no bookmark node is found for the given sync id. 79 // Returns NULL if no bookmark node is found for the given sync id.
80 virtual const BookmarkNode* GetChromeNodeFromSyncId(int64 sync_id) override; 80 const BookmarkNode* GetChromeNodeFromSyncId(int64 sync_id) override;
81 81
82 // Initializes the given sync node from the given bookmark node id. 82 // Initializes the given sync node from the given bookmark node id.
83 // Returns false if no sync node was found for the given bookmark node id or 83 // Returns false if no sync node was found for the given bookmark node id or
84 // if the initialization of sync node fails. 84 // if the initialization of sync node fails.
85 virtual bool InitSyncNodeFromChromeId( 85 bool InitSyncNodeFromChromeId(const int64& node_id,
86 const int64& node_id, 86 syncer::BaseNode* sync_node) override;
87 syncer::BaseNode* sync_node) override;
88 87
89 // Associates the given bookmark node with the given sync id. 88 // Associates the given bookmark node with the given sync id.
90 virtual void Associate(const BookmarkNode* node, int64 sync_id) override; 89 void Associate(const BookmarkNode* node, int64 sync_id) override;
91 // Remove the association that corresponds to the given sync id. 90 // Remove the association that corresponds to the given sync id.
92 virtual void Disassociate(int64 sync_id) override; 91 void Disassociate(int64 sync_id) override;
93 92
94 virtual void AbortAssociation() override { 93 void AbortAssociation() override {
95 // No implementation needed, this associator runs on the main 94 // No implementation needed, this associator runs on the main
96 // thread. 95 // thread.
97 } 96 }
98 97
99 // See ModelAssociator interface. 98 // See ModelAssociator interface.
100 virtual bool CryptoReadyIfNecessary() override; 99 bool CryptoReadyIfNecessary() override;
101 100
102 protected: 101 protected:
103 // Stores the id of the node with the given tag in |sync_id|. 102 // Stores the id of the node with the given tag in |sync_id|.
104 // Returns of that node was found successfully. 103 // Returns of that node was found successfully.
105 // Tests override this. 104 // Tests override this.
106 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id); 105 virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id);
107 106
108 private: 107 private:
109 typedef std::map<int64, int64> BookmarkIdToSyncIdMap; 108 typedef std::map<int64, int64> BookmarkIdToSyncIdMap;
110 typedef std::map<int64, const BookmarkNode*> SyncIdToBookmarkNodeMap; 109 typedef std::map<int64, const BookmarkNode*> SyncIdToBookmarkNodeMap;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // guarantees no invocations can occur if |this| has been deleted. (This 160 // guarantees no invocations can occur if |this| has been deleted. (This
162 // allows this class to be non-refcounted). 161 // allows this class to be non-refcounted).
163 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; 162 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_;
164 163
165 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 164 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
166 }; 165 };
167 166
168 } // namespace browser_sync 167 } // namespace browser_sync
169 168
170 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 169 #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/browser_thread_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698