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

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

Issue 9453036: [Sync] Remove --create-mobile-bookmarks-folder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address yaron's comments Created 8 years, 9 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) 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 18 matching lines...) Expand all
29 namespace browser_sync { 29 namespace browser_sync {
30 30
31 // Contains all model association related logic: 31 // Contains all model association related logic:
32 // * Algorithm to associate bookmark model and sync model. 32 // * Algorithm to associate bookmark model and sync model.
33 // * Methods to get a bookmark node for a given sync node and vice versa. 33 // * Methods to get a bookmark node for a given sync node and vice versa.
34 // * Persisting model associations and loading them back. 34 // * Persisting model associations and loading them back.
35 class BookmarkModelAssociator 35 class BookmarkModelAssociator
36 : public PerDataTypeAssociatorInterface<BookmarkNode, int64> { 36 : public PerDataTypeAssociatorInterface<BookmarkNode, int64> {
37 public: 37 public:
38 static syncable::ModelType model_type() { return syncable::BOOKMARKS; } 38 static syncable::ModelType model_type() { return syncable::BOOKMARKS; }
39 // |create_mobile_bookmarks_folder| controls whether or not we try
40 // to create the mobile bookmarks top-level folder.
39 BookmarkModelAssociator( 41 BookmarkModelAssociator(
40 BookmarkModel* bookmark_model, 42 BookmarkModel* bookmark_model,
41 sync_api::UserShare* user_share, 43 sync_api::UserShare* user_share,
42 DataTypeErrorHandler* unrecoverable_error_handler); 44 DataTypeErrorHandler* unrecoverable_error_handler,
45 bool create_mobile_bookmarks_folder);
43 virtual ~BookmarkModelAssociator(); 46 virtual ~BookmarkModelAssociator();
44 47
45 // Updates the visibility of the permanents node in the BookmarkModel. 48 // Updates the visibility of the permanents node in the BookmarkModel.
46 void UpdatePermanentNodeVisibility(); 49 void UpdatePermanentNodeVisibility();
47 50
48 // AssociatorInterface implementation. 51 // AssociatorInterface implementation.
49 // 52 //
50 // AssociateModels iterates through both the sync and the browser 53 // AssociateModels iterates through both the sync and the browser
51 // bookmark model, looking for matched pairs of items. For any pairs it 54 // bookmark model, looking for matched pairs of items. For any pairs it
52 // finds, it will call AssociateSyncID. For any unmatched items, 55 // finds, it will call AssociateSyncID. For any unmatched items,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, 126 bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node,
124 const std::string& tag) WARN_UNUSED_RESULT; 127 const std::string& tag) WARN_UNUSED_RESULT;
125 128
126 // Compare the properties of a pair of nodes from either domain. 129 // Compare the properties of a pair of nodes from either domain.
127 bool NodesMatch(const BookmarkNode* bookmark, 130 bool NodesMatch(const BookmarkNode* bookmark,
128 const sync_api::BaseNode* sync_node) const; 131 const sync_api::BaseNode* sync_node) const;
129 132
130 BookmarkModel* bookmark_model_; 133 BookmarkModel* bookmark_model_;
131 sync_api::UserShare* user_share_; 134 sync_api::UserShare* user_share_;
132 DataTypeErrorHandler* unrecoverable_error_handler_; 135 DataTypeErrorHandler* unrecoverable_error_handler_;
136 const bool create_mobile_bookmarks_folder_;
133 BookmarkIdToSyncIdMap id_map_; 137 BookmarkIdToSyncIdMap id_map_;
134 SyncIdToBookmarkNodeMap id_map_inverse_; 138 SyncIdToBookmarkNodeMap id_map_inverse_;
135 // Stores sync ids for dirty associations. 139 // Stores sync ids for dirty associations.
136 DirtyAssociationsSyncIds dirty_associations_sync_ids_; 140 DirtyAssociationsSyncIds dirty_associations_sync_ids_;
137 141
138 // Used to post PersistAssociation tasks to the current message loop and 142 // Used to post PersistAssociation tasks to the current message loop and
139 // guarantees no invocations can occur if |this| has been deleted. (This 143 // guarantees no invocations can occur if |this| has been deleted. (This
140 // allows this class to be non-refcounted). 144 // allows this class to be non-refcounted).
141 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; 145 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_;
142 146
143 int number_of_new_sync_nodes_created_at_association_; 147 int number_of_new_sync_nodes_created_at_association_;
144 148
145 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 149 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
146 }; 150 };
147 151
148 } // namespace browser_sync 152 } // namespace browser_sync
149 153
150 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ 154 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698