OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ |
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/important_file_writer.h" | 10 #include "base/files/important_file_writer.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 152 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
153 | 153 |
154 // Schedules saving the bookmark bar model to disk. | 154 // Schedules saving the bookmark bar model to disk. |
155 void ScheduleSave(); | 155 void ScheduleSave(); |
156 | 156 |
157 // Notification the bookmark bar model is going to be deleted. If there is | 157 // Notification the bookmark bar model is going to be deleted. If there is |
158 // a pending save, it is saved immediately. | 158 // a pending save, it is saved immediately. |
159 void BookmarkModelDeleted(); | 159 void BookmarkModelDeleted(); |
160 | 160 |
161 // Callback from backend after loading the bookmark file. | 161 // Callback from backend after loading the bookmark file. |
162 void OnLoadFinished(); | 162 void OnLoadFinished(scoped_ptr<BookmarkLoadDetails> details); |
163 | 163 |
164 // ImportantFileWriter::DataSerializer implementation. | 164 // ImportantFileWriter::DataSerializer implementation. |
165 virtual bool SerializeData(std::string* output) OVERRIDE; | 165 virtual bool SerializeData(std::string* output) OVERRIDE; |
166 | 166 |
167 private: | 167 private: |
168 // Serializes the data and schedules save using ImportantFileWriter. | 168 // Serializes the data and schedules save using ImportantFileWriter. |
169 // Returns true on successful serialization. | 169 // Returns true on successful serialization. |
170 bool SaveNow(); | 170 bool SaveNow(); |
171 | 171 |
172 // The model. The model is NULL once BookmarkModelDeleted has been invoked. | 172 // The model. The model is NULL once BookmarkModelDeleted has been invoked. |
173 BookmarkModel* model_; | 173 BookmarkModel* model_; |
174 | 174 |
175 // Helper to write bookmark data safely. | 175 // Helper to write bookmark data safely. |
176 base::ImportantFileWriter writer_; | 176 base::ImportantFileWriter writer_; |
177 | 177 |
178 // See class description of BookmarkLoadDetails for details on this. | |
179 scoped_ptr<BookmarkLoadDetails> details_; | |
180 | |
181 // Sequenced task runner where file I/O operations will be performed at. | 178 // Sequenced task runner where file I/O operations will be performed at. |
182 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; | 179 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; |
183 | 180 |
184 base::WeakPtrFactory<BookmarkStorage> weak_factory_; | 181 base::WeakPtrFactory<BookmarkStorage> weak_factory_; |
185 | 182 |
186 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); | 183 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); |
187 }; | 184 }; |
188 | 185 |
189 } // namespace bookmarks | 186 } // namespace bookmarks |
190 | 187 |
191 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ | 188 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ |
OLD | NEW |