Chromium Code Reviews| Index: components/policy/core/browser/managed_bookmarks_tracker.h |
| diff --git a/components/policy/core/browser/managed_bookmarks_tracker.h b/components/policy/core/browser/managed_bookmarks_tracker.h |
| index 99f0761e5ad2b16c4dde4d84f9218975567331f4..c4ced3cda7532919d0ce286fa3a23f176ef2193a 100644 |
| --- a/components/policy/core/browser/managed_bookmarks_tracker.h |
| +++ b/components/policy/core/browser/managed_bookmarks_tracker.h |
| @@ -26,8 +26,10 @@ class BookmarkModel; |
| namespace policy { |
| -// Tracks the Managed Bookmarks policy value and makes the managed_node() in |
| -// the BookmarkModel follow the policy-defined bookmark tree. |
| +// Tracks either the Managed Bookmarks pref (set by policy) or the Supervised |
| +// Bookmarks pref (set for a supervised user by their custodian) and makes the |
| +// managed_node()/supervised_node() in the BookmarkModel follow the |
| +// policy/custodian-defined bookmark tree. |
| class POLICY_EXPORT ManagedBookmarksTracker { |
| public: |
| typedef base::Callback<std::string()> GetManagementDomainCallback; |
| @@ -37,8 +39,11 @@ class POLICY_EXPORT ManagedBookmarksTracker { |
| static const char kUrl[]; |
| static const char kChildren[]; |
| + // If |is_supervised| is true, this will track supervised bookmarks rather |
| + // than managed bookmarks. |
| ManagedBookmarksTracker(bookmarks::BookmarkModel* model, |
| PrefService* prefs, |
| + bool is_supervised, |
| const GetManagementDomainCallback& callback); |
| ~ManagedBookmarksTracker(); |
| @@ -46,19 +51,28 @@ class POLICY_EXPORT ManagedBookmarksTracker { |
| // LoadInitial() to do the initial load. |
| scoped_ptr<base::ListValue> GetInitialManagedBookmarks(); |
| - // Loads the initial managed bookmarks in |list| into |folder|. New nodes |
| - // will be assigned IDs starting at |next_node_id|. |
| + // Loads the initial managed/supervised bookmarks in |list| into |folder|. |
| + // New nodes will be assigned IDs starting at |next_node_id|. |
| // Returns the next node ID to use. |
| static int64 LoadInitial(BookmarkNode* folder, |
| const base::ListValue* list, |
| int64 next_node_id); |
| - // Starts tracking the policy for updates to the managed bookmarks. Should |
| - // be called after loading the initial bookmarks. |
| + // Starts tracking the policy for updates to the managed/supervised bookmarks. |
|
bartfab (slow)
2015/01/26 15:40:14
Nit: s/policy/pref/
Marc Treib
2015/01/26 16:16:47
Done.
|
| + // Should be called after loading the initial bookmarks. |
| void Init(BookmarkPermanentNode* managed_node); |
| + bool is_supervised() const { return is_supervised_; } |
| + |
| + // Public for testing. |
| + static const char* GetPrefName(bool is_supervised); |
| + |
| private: |
| + const char* GetPrefName() const; |
| + base::string16 GetBookmarksFolderTitle() const; |
|
bartfab (slow)
2015/01/26 15:40:14
Nit: #include "base/strings/string16.h"
Marc Treib
2015/01/26 16:16:47
That's already there.
|
| + |
| void ReloadManagedBookmarks(); |
| + |
| void UpdateBookmarks(const BookmarkNode* folder, const base::ListValue* list); |
| static bool LoadBookmark(const base::ListValue* list, |
| size_t index, |
| @@ -67,6 +81,7 @@ class POLICY_EXPORT ManagedBookmarksTracker { |
| const base::ListValue** children); |
| bookmarks::BookmarkModel* model_; |
| + bool is_supervised_; |
|
bartfab (slow)
2015/01/26 15:40:14
Nit: const.
Marc Treib
2015/01/26 16:16:47
Done.
|
| BookmarkPermanentNode* managed_node_; |
| PrefService* prefs_; |
| PrefChangeRegistrar registrar_; |