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" |
11 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
12 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 12 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
13 #include "chrome/browser/sync/glue/change_processor.h" | 13 #include "chrome/browser/sync/glue/change_processor.h" |
14 #include "chrome/browser/sync/glue/data_type_error_handler.h" | 14 #include "chrome/browser/sync/glue/data_type_error_handler.h" |
15 #include "chrome/browser/sync/glue/sync_backend_host.h" | 15 #include "chrome/browser/sync/glue/sync_backend_host.h" |
16 | 16 |
17 namespace base { | |
18 class RefCountedMemory; | |
19 } | |
20 | |
17 namespace syncer { | 21 namespace syncer { |
18 class WriteNode; | 22 class WriteNode; |
19 class WriteTransaction; | 23 class WriteTransaction; |
20 } // namespace syncer | 24 } // namespace syncer |
21 | 25 |
22 namespace browser_sync { | 26 namespace browser_sync { |
23 | 27 |
24 extern const char kBookmarkTransactionVersionKey[]; | 28 extern const char kBookmarkTransactionVersionKey[]; |
25 | 29 |
26 // This class is responsible for taking changes from the BookmarkModel | 30 // This class is responsible for taking changes from the BookmarkModel |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 int index); | 86 int index); |
83 | 87 |
84 // Sets the favicon of the given bookmark node from the given sync node. | 88 // Sets the favicon of the given bookmark node from the given sync node. |
85 // Returns whether the favicon was set in the bookmark node. | 89 // Returns whether the favicon was set in the bookmark node. |
86 // |profile| is the profile that contains the HistoryService and BookmarkModel | 90 // |profile| is the profile that contains the HistoryService and BookmarkModel |
87 // for the bookmark in question. | 91 // for the bookmark in question. |
88 static bool SetBookmarkFavicon(syncer::BaseNode* sync_node, | 92 static bool SetBookmarkFavicon(syncer::BaseNode* sync_node, |
89 const BookmarkNode* bookmark_node, | 93 const BookmarkNode* bookmark_node, |
90 BookmarkModel* model); | 94 BookmarkModel* model); |
91 | 95 |
92 // Applies the favicon data in |icon_bytes_vector| to |bookmark_node|. | 96 // Applies the favicon 1x |bitmap_data| to |bookmark_node|. |
93 // |profile| is the profile that contains the HistoryService and BookmarkModel | 97 // |profile| is the profile that contains the HistoryService and BookmarkModel |
94 // for the bookmark in question. | 98 // for the bookmark in question. |
95 static void ApplyBookmarkFavicon( | 99 static void ApplyBookmarkFavicon( |
96 const BookmarkNode* bookmark_node, | 100 const BookmarkNode* bookmark_node, |
97 Profile* profile, | 101 Profile* profile, |
98 const std::vector<unsigned char>& icon_bytes_vector); | 102 scoped_refptr<base::RefCountedMemory> bitmap_data); |
Nicolas Zea
2012/11/26 22:15:45
const ref? (to avoid adding temporary references)
| |
99 | 103 |
100 // Sets the favicon of the given sync node from the given bookmark node. | 104 // Sets the favicon of the given sync node from the given bookmark node. |
101 static void SetSyncNodeFavicon(const BookmarkNode* bookmark_node, | 105 static void SetSyncNodeFavicon(const BookmarkNode* bookmark_node, |
102 BookmarkModel* model, | 106 BookmarkModel* model, |
103 syncer::WriteNode* sync_node); | 107 syncer::WriteNode* sync_node); |
104 | 108 |
105 // Treat the |index|th child of |parent| as a newly added node, and create a | 109 // Treat the |index|th child of |parent| as a newly added node, and create a |
106 // corresponding node in the sync domain using |trans|. All properties | 110 // corresponding node in the sync domain using |trans|. All properties |
107 // will be transferred to the new node. A node corresponding to |parent| | 111 // will be transferred to the new node. A node corresponding to |parent| |
108 // must already exist and be associated for this call to succeed. Returns | 112 // must already exist and be associated for this call to succeed. Returns |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 | 183 |
180 // The two models should be associated according to this ModelAssociator. | 184 // The two models should be associated according to this ModelAssociator. |
181 BookmarkModelAssociator* model_associator_; | 185 BookmarkModelAssociator* model_associator_; |
182 | 186 |
183 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 187 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
184 }; | 188 }; |
185 | 189 |
186 } // namespace browser_sync | 190 } // namespace browser_sync |
187 | 191 |
188 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ | 192 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_CHANGE_PROCESSOR_H_ |
OLD | NEW |