summaryrefslogtreecommitdiffstats
path: root/components/enhanced_bookmarks/enhanced_bookmark_model.h
diff options
context:
space:
mode:
authorrfevang <rfevang@chromium.org>2014-10-09 11:23:14 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-09 18:23:31 +0000
commitb338c55128b4d36dbdf43cc96f3f956ae8d96e77 (patch)
tree993a072603ad4ad8eac95d8db80b8bcc07e9ef64 /components/enhanced_bookmarks/enhanced_bookmark_model.h
parent52fce9455ffd688ef3752a816192f9e76555e7d1 (diff)
downloadchromium_src-b338c55128b4d36dbdf43cc96f3f956ae8d96e77.zip
chromium_src-b338c55128b4d36dbdf43cc96f3f956ae8d96e77.tar.gz
chromium_src-b338c55128b4d36dbdf43cc96f3f956ae8d96e77.tar.bz2
Set offline processing flag for new bookmarks
Sets the NEEDS_OFFLINE_PROCESSING flag for nodes that are created by non-enhanced bookmark aware code. Also fixes a potential issue if a bookmark node was removed while there was a pending operation on it. BUG=411412 Review URL: https://codereview.chromium.org/626213002 Cr-Commit-Position: refs/heads/master@{#298935}
Diffstat (limited to 'components/enhanced_bookmarks/enhanced_bookmark_model.h')
-rw-r--r--components/enhanced_bookmarks/enhanced_bookmark_model.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model.h b/components/enhanced_bookmarks/enhanced_bookmark_model.h
index 4fd1ba1..d46e7d9 100644
--- a/components/enhanced_bookmarks/enhanced_bookmark_model.h
+++ b/components/enhanced_bookmarks/enhanced_bookmark_model.h
@@ -8,6 +8,8 @@
#include <map>
#include <string>
+#include "base/cancelable_callback.h"
+#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
@@ -170,6 +172,9 @@ class EnhancedBookmarkModel : public KeyedService,
// Clears out any duplicate remote ids detected by AddToIdMap calls.
void ResetDuplicateRemoteIds();
+ // Sets the NEEDS_OFFLINE_PROCESSING flag on the given node.
+ void SetNeedsOfflineProcessing(const BookmarkNode* node);
+
// Helper method for setting a meta info field on a node. Also updates the
// version field.
void SetMetaInfo(const BookmarkNode* node,
@@ -190,6 +195,11 @@ class EnhancedBookmarkModel : public KeyedService,
IdToNodeMap id_map_;
NodeToIdMap nodes_to_reset_;
+ // Pending SetNeedsOfflineProcessing calls are stored here, as they may need
+ // to be cancelled if the node is removed.
+ std::map<const BookmarkNode*, linked_ptr<base::CancelableClosure>>
+ set_needs_offline_processing_tasks_;
+
// Caches the remote id of a node before its meta info changes.
std::string prev_remote_id_;