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

Side by Side Diff: components/bookmarks/browser/bookmark_storage.h

Issue 666133002: Standardize usage of virtual/override/final in components/ (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 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // 135 //
136 // Internally BookmarkStorage uses BookmarkCodec to do the actual read/write. 136 // Internally BookmarkStorage uses BookmarkCodec to do the actual read/write.
137 class BookmarkStorage : public base::ImportantFileWriter::DataSerializer { 137 class BookmarkStorage : public base::ImportantFileWriter::DataSerializer {
138 public: 138 public:
139 // Creates a BookmarkStorage for the specified model. The data will be loaded 139 // Creates a BookmarkStorage for the specified model. The data will be loaded
140 // from and saved to a location derived from |profile_path|. The IO code will 140 // from and saved to a location derived from |profile_path|. The IO code will
141 // be executed as a task in |sequenced_task_runner|. 141 // be executed as a task in |sequenced_task_runner|.
142 BookmarkStorage(BookmarkModel* model, 142 BookmarkStorage(BookmarkModel* model,
143 const base::FilePath& profile_path, 143 const base::FilePath& profile_path,
144 base::SequencedTaskRunner* sequenced_task_runner); 144 base::SequencedTaskRunner* sequenced_task_runner);
145 virtual ~BookmarkStorage(); 145 ~BookmarkStorage() override;
146 146
147 // Loads the bookmarks into the model, notifying the model when done. This 147 // Loads the bookmarks into the model, notifying the model when done. This
148 // takes ownership of |details| and send the |OnLoadFinished| callback from 148 // takes ownership of |details| and send the |OnLoadFinished| callback from
149 // a task in |task_runner|. See BookmarkLoadDetails for details. 149 // a task in |task_runner|. See BookmarkLoadDetails for details.
150 void LoadBookmarks( 150 void LoadBookmarks(
151 scoped_ptr<BookmarkLoadDetails> details, 151 scoped_ptr<BookmarkLoadDetails> details,
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(scoped_ptr<BookmarkLoadDetails> details); 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 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 // 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.
179 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; 179 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
180 180
181 base::WeakPtrFactory<BookmarkStorage> weak_factory_; 181 base::WeakPtrFactory<BookmarkStorage> weak_factory_;
182 182
183 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); 183 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
184 }; 184 };
185 185
186 } // namespace bookmarks 186 } // namespace bookmarks
187 187
188 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_ 188 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_node.h ('k') | components/bookmarks/browser/bookmark_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698