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

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

Issue 11116015: bookmarks: Pass browser context pointer to BookmarkStorage instead of a pointer to Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_storage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BOOKMARKS_BOOKMARK_STORAGE_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/bookmarks/bookmark_index.h" 10 #include "chrome/browser/bookmarks/bookmark_index.h"
11 #include "chrome/common/important_file_writer.h" 11 #include "chrome/common/important_file_writer.h"
12 12
13 class BookmarkModel; 13 class BookmarkModel;
14 class BookmarkPermanentNode; 14 class BookmarkPermanentNode;
15 class Profile; 15
16 namespace content {
17 class BrowserContext;
18 }
16 19
17 // BookmarkLoadDetails is used by BookmarkStorage when loading bookmarks. 20 // BookmarkLoadDetails is used by BookmarkStorage when loading bookmarks.
18 // BookmarkModel creates a BookmarkLoadDetails and passes it (including 21 // BookmarkModel creates a BookmarkLoadDetails and passes it (including
19 // ownership) to BookmarkStorage. BookmarkStorage loads the bookmarks (and 22 // ownership) to BookmarkStorage. BookmarkStorage loads the bookmarks (and
20 // index) in the background thread, then calls back to the BookmarkModel (on 23 // index) in the background thread, then calls back to the BookmarkModel (on
21 // the main thread) when loading is done, passing ownership back to the 24 // the main thread) when loading is done, passing ownership back to the
22 // BookmarkModel. While loading BookmarkModel does not maintain references to 25 // BookmarkModel. While loading BookmarkModel does not maintain references to
23 // the contents of the BookmarkLoadDetails, this ensures we don't have any 26 // the contents of the BookmarkLoadDetails, this ensures we don't have any
24 // threading problems. 27 // threading problems.
25 class BookmarkLoadDetails { 28 class BookmarkLoadDetails {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 89
87 // BookmarkStorage handles reading/write the bookmark bar model. The 90 // BookmarkStorage handles reading/write the bookmark bar model. The
88 // BookmarkModel uses the BookmarkStorage to load bookmarks from disk, as well 91 // BookmarkModel uses the BookmarkStorage to load bookmarks from disk, as well
89 // as notifying the BookmarkStorage every time the model changes. 92 // as notifying the BookmarkStorage every time the model changes.
90 // 93 //
91 // Internally BookmarkStorage uses BookmarkCodec to do the actual read/write. 94 // Internally BookmarkStorage uses BookmarkCodec to do the actual read/write.
92 class BookmarkStorage : public ImportantFileWriter::DataSerializer, 95 class BookmarkStorage : public ImportantFileWriter::DataSerializer,
93 public base::RefCountedThreadSafe<BookmarkStorage> { 96 public base::RefCountedThreadSafe<BookmarkStorage> {
94 public: 97 public:
95 // Creates a BookmarkStorage for the specified model 98 // Creates a BookmarkStorage for the specified model
96 BookmarkStorage(Profile* profile, BookmarkModel* model); 99 BookmarkStorage(content::BrowserContext* context, BookmarkModel* model);
97 100
98 // Loads the bookmarks into the model, notifying the model when done. This 101 // Loads the bookmarks into the model, notifying the model when done. This
99 // takes ownership of |details|. See BookmarkLoadDetails for details. 102 // takes ownership of |details|. See BookmarkLoadDetails for details.
100 void LoadBookmarks(BookmarkLoadDetails* details); 103 void LoadBookmarks(BookmarkLoadDetails* details);
101 104
102 // Schedules saving the bookmark bar model to disk. 105 // Schedules saving the bookmark bar model to disk.
103 void ScheduleSave(); 106 void ScheduleSave();
104 107
105 // Notification the bookmark bar model is going to be deleted. If there is 108 // Notification the bookmark bar model is going to be deleted. If there is
106 // a pending save, it is saved immediately. 109 // a pending save, it is saved immediately.
(...skipping 20 matching lines...) Expand all
127 // Helper to write bookmark data safely. 130 // Helper to write bookmark data safely.
128 ImportantFileWriter writer_; 131 ImportantFileWriter writer_;
129 132
130 // See class description of BookmarkLoadDetails for details on this. 133 // See class description of BookmarkLoadDetails for details on this.
131 scoped_ptr<BookmarkLoadDetails> details_; 134 scoped_ptr<BookmarkLoadDetails> details_;
132 135
133 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); 136 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
134 }; 137 };
135 138
136 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 139 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698