Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 virtual void ApplyChangesFromSyncModel( | 66 virtual void ApplyChangesFromSyncModel( |
| 67 const syncer::BaseTransaction* trans, | 67 const syncer::BaseTransaction* trans, |
| 68 int64 model_version, | 68 int64 model_version, |
| 69 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | 69 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; |
| 70 | 70 |
| 71 // Create a bookmark node corresponding to |src| if one is not already | 71 // Create a bookmark node corresponding to |src| if one is not already |
| 72 // associated with |src|. Returns the node that was created or updated. | 72 // associated with |src|. Returns the node that was created or updated. |
| 73 static const BookmarkNode* CreateOrUpdateBookmarkNode( | 73 static const BookmarkNode* CreateOrUpdateBookmarkNode( |
| 74 syncer::BaseNode* src, | 74 syncer::BaseNode* src, |
| 75 BookmarkModel* model, | 75 BookmarkModel* model, |
| 76 Profile* profile, | |
| 76 BookmarkModelAssociator* model_associator); | 77 BookmarkModelAssociator* model_associator); |
| 77 | 78 |
| 78 // The following methods are static and hence may be invoked at any time, | 79 // The following methods are static and hence may be invoked at any time, |
| 79 // and do not depend on having a running ChangeProcessor. | 80 // and do not depend on having a running ChangeProcessor. |
| 80 // Creates a bookmark node under the given parent node from the given sync | 81 // Creates a bookmark node under the given parent node from the given sync |
| 81 // node. Returns the newly created node. | 82 // node. Returns the newly created node. |
| 82 static const BookmarkNode* CreateBookmarkNode( | 83 static const BookmarkNode* CreateBookmarkNode( |
| 83 syncer::BaseNode* sync_node, | 84 syncer::BaseNode* sync_node, |
| 84 const BookmarkNode* parent, | 85 const BookmarkNode* parent, |
| 85 BookmarkModel* model, | 86 BookmarkModel* model, |
| 87 Profile* profile, | |
| 86 int index); | 88 int index); |
| 87 | 89 |
| 88 // Sets the favicon of the given bookmark node from the given sync node. | 90 // Sets the favicon of the given bookmark node from the given sync node. |
| 89 // Returns whether the favicon was set in the bookmark node. | 91 // Returns whether the favicon was set in the bookmark node. |
| 90 // |profile| is the profile that contains the HistoryService and BookmarkModel | 92 // |profile| is the profile that contains the HistoryService and BookmarkModel |
| 91 // for the bookmark in question. | 93 // for the bookmark in question. |
| 92 static bool SetBookmarkFavicon(syncer::BaseNode* sync_node, | 94 static bool SetBookmarkFavicon(syncer::BaseNode* sync_node, |
| 93 const BookmarkNode* bookmark_node, | 95 const BookmarkNode* bookmark_node, |
| 94 BookmarkModel* model); | 96 BookmarkModel* model, |
| 97 Profile* profile); | |
| 95 | 98 |
| 96 // Applies the 1x favicon |bitmap_data| and |icon_url| to |bookmark_node|. | 99 // Applies the 1x favicon |bitmap_data| and |icon_url| to |bookmark_node|. |
| 97 // |profile| is the profile that contains the HistoryService and BookmarkModel | 100 // |profile| is the profile that contains the HistoryService and BookmarkModel |
| 98 // for the bookmark in question. | 101 // for the bookmark in question. |
| 99 static void ApplyBookmarkFavicon( | 102 static void ApplyBookmarkFavicon( |
| 100 const BookmarkNode* bookmark_node, | 103 const BookmarkNode* bookmark_node, |
| 101 Profile* profile, | 104 Profile* profile, |
| 102 const GURL& icon_url, | 105 const GURL& icon_url, |
| 103 const scoped_refptr<base::RefCountedMemory>& bitmap_data); | 106 const scoped_refptr<base::RefCountedMemory>& bitmap_data); |
| 104 | 107 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 void RemoveOneSyncNode(syncer::WriteTransaction* trans, | 178 void RemoveOneSyncNode(syncer::WriteTransaction* trans, |
| 176 const BookmarkNode* node); | 179 const BookmarkNode* node); |
| 177 | 180 |
| 178 // Remove all the sync nodes associated with |node| and its children. | 181 // Remove all the sync nodes associated with |node| and its children. |
| 179 void RemoveSyncNodeHierarchy(const BookmarkNode* node); | 182 void RemoveSyncNodeHierarchy(const BookmarkNode* node); |
| 180 | 183 |
| 181 // The bookmark model we are processing changes from. Non-NULL when | 184 // The bookmark model we are processing changes from. Non-NULL when |
| 182 // |running_| is true. | 185 // |running_| is true. |
| 183 BookmarkModel* bookmark_model_; | 186 BookmarkModel* bookmark_model_; |
| 184 | 187 |
| 188 Profile* profile_; | |
|
sky
2013/03/27 15:32:53
Doesn't look like you member initialize this.
| |
| 189 | |
| 185 // The two models should be associated according to this ModelAssociator. | 190 // The two models should be associated according to this ModelAssociator. |
| 186 BookmarkModelAssociator* model_associator_; | 191 BookmarkModelAssociator* model_associator_; |
| 187 | 192 |
| 188 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 193 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
| 189 }; | 194 }; |
| 190 | 195 |
| 191 } // namespace browser_sync | 196 } // namespace browser_sync |
| 192 | 197 |
| 193 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 198 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
| OLD | NEW |