Workaround for xkbcommon dead keys.
[chromium-blink-merge.git] / components / bookmarks / browser / bookmark_expanded_state_tracker.h
blobc960b232c01e27ca052fbfcb7585e3f308658816
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_EXPANDED_STATE_TRACKER_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_EXPANDED_STATE_TRACKER_H_
8 #include <set>
10 #include "components/bookmarks/browser/base_bookmark_model_observer.h"
12 class BookmarkModel;
13 class BookmarkNode;
14 class PrefService;
16 namespace bookmarks {
18 // BookmarkExpandedStateTracker is used to track a set of expanded nodes. The
19 // nodes are persisted in preferences. If an expanded node is removed from the
20 // model BookmarkExpandedStateTracker removes the node.
21 class BookmarkExpandedStateTracker : public BaseBookmarkModelObserver {
22 public:
23 typedef std::set<const BookmarkNode*> Nodes;
25 BookmarkExpandedStateTracker(BookmarkModel* bookmark_model,
26 PrefService* pref_service);
27 ~BookmarkExpandedStateTracker() override;
29 // The set of expanded nodes.
30 void SetExpandedNodes(const Nodes& nodes);
31 Nodes GetExpandedNodes();
33 private:
34 // BaseBookmarkModelObserver:
35 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override;
36 void BookmarkModelChanged() override;
37 void BookmarkModelBeingDeleted(BookmarkModel* model) override;
38 void BookmarkNodeRemoved(BookmarkModel* model,
39 const BookmarkNode* parent,
40 int old_index,
41 const BookmarkNode* node,
42 const std::set<GURL>& removed_urls) override;
43 void BookmarkAllUserNodesRemoved(BookmarkModel* model,
44 const std::set<GURL>& removed_urls) override;
46 // Updates the value for |prefs::kBookmarkEditorExpandedNodes| from
47 // GetExpandedNodes().
48 void UpdatePrefs(const Nodes& nodes);
50 BookmarkModel* bookmark_model_;
51 PrefService* pref_service_;
53 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTracker);
56 } // namespace bookmarks
58 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_EXPANDED_STATE_TRACKER_H_