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

Unified Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 114055: We need to save bookmarks file when the persist_ids settings changes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bookmarks/bookmark_model.cc
===================================================================
--- chrome/browser/bookmarks/bookmark_model.cc (revision 17017)
+++ chrome/browser/bookmarks/bookmark_model.cc (working copy)
@@ -89,6 +89,7 @@
: profile_(profile),
loaded_(false),
persist_ids_(false),
+ file_changed_(false),
root_(GURL()),
bookmark_bar_node_(NULL),
other_node_(NULL),
@@ -392,6 +393,9 @@
PrefService* pref_service = profile_->GetPrefs();
pref_service->SetBoolean(kPrefPersistIDs, persist_ids_);
}
+ // Need to save the bookmark data if the value of persist IDs changes.
+ if (store_.get())
+ store_->ScheduleSave();
}
bool BookmarkModel::IsBookmarkedNoLock(const GURL& url) {
@@ -449,6 +453,8 @@
bookmark_bar_node_ = details->bb_node();
other_node_ = details->other_folder_node();
next_node_id_ = details->max_id();
+ if (details->computed_checksum() != details->stored_checksum())
+ SetFileChanged();
index_.reset(details->index());
details->release();
@@ -700,6 +706,16 @@
return next_node_id_++;
}
+void BookmarkModel::SetFileChanged() {
+ file_changed_ = true;
+ // If bookmarks file changed externally, the IDs may have changed externally.
+ // in that case, the decoder may have reassigned IDs to make them unique.
+ // So when the file has changed externally and IDs are persisted, we should
+ // save the bookmarks file to persist new IDs.
+ if (persist_ids_ && store_.get())
+ store_->ScheduleSave();
+}
+
BookmarkStorage::LoadDetails* BookmarkModel::CreateLoadDetails() {
BookmarkNode* bb_node = CreateBookmarkNode();
BookmarkNode* other_folder_node = CreateOtherBookmarksNode();

Powered by Google App Engine
This is Rietveld 408576698