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

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

Issue 769153007: Managed bookmarks for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android fix; rebase Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_CHROME_BOOKMARK_CLIENT_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_
6 #define CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ 6 #define CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 public bookmarks::BaseBookmarkModelObserver { 28 public bookmarks::BaseBookmarkModelObserver {
29 public: 29 public:
30 explicit ChromeBookmarkClient(Profile* profile); 30 explicit ChromeBookmarkClient(Profile* profile);
31 ~ChromeBookmarkClient() override; 31 ~ChromeBookmarkClient() override;
32 32
33 void Init(bookmarks::BookmarkModel* model); 33 void Init(bookmarks::BookmarkModel* model);
34 34
35 // KeyedService: 35 // KeyedService:
36 void Shutdown() override; 36 void Shutdown() override;
37 37
38 // Returns the managed_node. 38 // The top-level managed bookmarks folder, defined by an enterprise policy.
39 const BookmarkNode* managed_node() { return managed_node_; } 39 const BookmarkNode* managed_node() { return managed_node_; }
40 // The top-level supervised bookmarks folder, defined by the custodian of a
41 // supervised user.
42 const BookmarkNode* supervised_node() { return supervised_node_; }
40 43
41 // Returns true if the given node belongs to the managed bookmarks tree. 44 // Returns true if the given node belongs to the managed bookmarks tree.
42 bool IsDescendantOfManagedNode(const BookmarkNode* node); 45 bool IsDescendantOfManagedNode(const BookmarkNode* node);
43
44 // Returns true if there is at least one managed node in the |list|. 46 // Returns true if there is at least one managed node in the |list|.
45 bool HasDescendantsOfManagedNode( 47 bool HasDescendantsOfManagedNode(
46 const std::vector<const BookmarkNode*>& list); 48 const std::vector<const BookmarkNode*>& list);
47 49
50 // Returns true if the given node belongs to the supervised bookmarks tree.
51 bool IsDescendantOfSupervisedNode(const BookmarkNode* node);
sky 2015/02/04 18:36:58 Can these new functions (and the two above it) be
Marc Treib 2015/02/05 12:57:06 They can indeed be const, and now are. Thanks! Wh
sky 2015/02/05 17:57:11 What I meant is that these functions should move t
Marc Treib 2015/02/06 13:40:37 Ah, I see now, thanks! Done.
52 // Returns true if there is at least one supervised node in the |list|.
53 bool HasDescendantsOfSupervisedNode(
54 const std::vector<const BookmarkNode*>& list);
55
56 // Returns true if the given node belongs to either the managed or the
57 // supervised bookmarks tree.
58 bool IsDescendantOfManagedOrSupervisedNode(const BookmarkNode* node);
59 // Returns true if there is at least one managed or supervised node in the
60 // |list|.
61 bool HasDescendantsOfManagedOrSupervisedNode(
62 const std::vector<const BookmarkNode*>& list);
63
48 // bookmarks::BookmarkClient: 64 // bookmarks::BookmarkClient:
49 bool PreferTouchIcon() override; 65 bool PreferTouchIcon() override;
50 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( 66 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL(
51 const GURL& page_url, 67 const GURL& page_url,
52 favicon_base::IconType type, 68 favicon_base::IconType type,
53 const favicon_base::FaviconImageCallback& callback, 69 const favicon_base::FaviconImageCallback& callback,
54 base::CancelableTaskTracker* tracker) override; 70 base::CancelableTaskTracker* tracker) override;
55 bool SupportsTypedCountForNodes() override; 71 bool SupportsTypedCountForNodes() override;
56 void GetTypedCountForNodes( 72 void GetTypedCountForNodes(
57 const NodeSet& nodes, 73 const NodeSet& nodes,
(...skipping 18 matching lines...) Expand all
76 const std::set<GURL>& removed_urls) override; 92 const std::set<GURL>& removed_urls) override;
77 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, 93 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model,
78 const std::set<GURL>& removed_urls) override; 94 const std::set<GURL>& removed_urls) override;
79 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, 95 void BookmarkModelLoaded(bookmarks::BookmarkModel* model,
80 bool ids_reassigned) override; 96 bool ids_reassigned) override;
81 97
82 // Helper for GetLoadExtraNodesCallback(). 98 // Helper for GetLoadExtraNodesCallback().
83 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes( 99 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes(
84 scoped_ptr<BookmarkPermanentNode> managed_node, 100 scoped_ptr<BookmarkPermanentNode> managed_node,
85 scoped_ptr<base::ListValue> initial_managed_bookmarks, 101 scoped_ptr<base::ListValue> initial_managed_bookmarks,
102 scoped_ptr<BookmarkPermanentNode> supervised_node,
103 scoped_ptr<base::ListValue> initial_supervised_bookmarks,
86 int64* next_node_id); 104 int64* next_node_id);
87 105
88 // Returns the management domain that configured the managed bookmarks, 106 // Returns the management domain that configured the managed bookmarks,
89 // or an empty string. 107 // or an empty string.
90 std::string GetManagedBookmarksDomain(); 108 std::string GetManagedBookmarksDomain();
91 109
92 Profile* profile_; 110 Profile* profile_;
93 111
94 // HistoryService associated to the Profile. Due to circular dependency, this 112 // HistoryService associated to the Profile. Due to circular dependency, this
95 // cannot be passed to the constructor, nor lazily fetched. Instead the value 113 // cannot be passed to the constructor, nor lazily fetched. Instead the value
96 // is initialized from HistoryServiceFactory. 114 // is initialized from HistoryServiceFactory.
97 HistoryService* history_service_; 115 HistoryService* history_service_;
98 116
99 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> 117 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
100 favicon_changed_subscription_; 118 favicon_changed_subscription_;
101 119
102 // Pointer to the BookmarkModel. Will be non-NULL from the call to Init to 120 // Pointer to the BookmarkModel. Will be non-NULL from the call to Init to
103 // the call to Shutdown. Must be valid for the whole interval. 121 // the call to Shutdown. Must be valid for the whole interval.
104 bookmarks::BookmarkModel* model_; 122 bookmarks::BookmarkModel* model_;
105 123
124 // Managed bookmarks are defined by an enterprise policy.
106 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_; 125 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_;
126 // The top-level managed bookmarks folder.
107 BookmarkPermanentNode* managed_node_; 127 BookmarkPermanentNode* managed_node_;
108 128
129 // Supervised bookmarks are defined by the custodian of a supervised user.
130 scoped_ptr<policy::ManagedBookmarksTracker> supervised_bookmarks_tracker_;
131 // The top-level supervised bookmarks folder.
132 BookmarkPermanentNode* supervised_node_;
133
109 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient); 134 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient);
110 }; 135 };
111 136
112 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ 137 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698