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

Unified Diff: chrome/browser/android/bookmarks/bookmarks_bridge.cc

Issue 769153007: Managed bookmarks for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build (Android & unit_tests) Created 5 years, 10 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/bookmarks/bookmark_model_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/bookmarks/bookmarks_bridge.cc
diff --git a/chrome/browser/android/bookmarks/bookmarks_bridge.cc b/chrome/browser/android/bookmarks/bookmarks_bridge.cc
index 7712383d28921d2fd3061343ee7e8c2e50076fc2..45f4b9c1aa77e033a99e7860ab8447af953902b2 100644
--- a/chrome/browser/android/bookmarks/bookmarks_bridge.cc
+++ b/chrome/browser/android/bookmarks/bookmarks_bridge.cc
@@ -227,6 +227,10 @@ void BookmarksBridge::GetTopLevelFolderIDs(JNIEnv* env,
client_->managed_node()->child_count() > 0) {
top_level_folders.push_back(client_->managed_node());
}
+ if (client_->supervised_node() &&
+ client_->supervised_node()->child_count() > 0) {
+ top_level_folders.push_back(client_->supervised_node());
+ }
if (partner_bookmarks_shim_->HasPartnerBookmarks()) {
top_level_folders.push_back(
partner_bookmarks_shim_->GetPartnerBookmarksRoot());
@@ -432,8 +436,11 @@ void BookmarksBridge::GetAllBookmarkIDsOrderedByCreationDate(
for (int i = 0; i < (*folder_iter)->child_count(); ++i) {
const BookmarkNode* child = (*folder_iter)->GetChild(i);
- if (!IsReachable(child) || client_->IsDescendantOfManagedNode(child))
+ if (!IsReachable(child) ||
+ bookmarks::IsDescendantOf(child, client_->managed_node()) ||
+ bookmarks::IsDescendantOf(child, client_->supervised_node())) {
continue;
+ }
if (child->is_folder()) {
insert_iter = folders.insert(insert_iter, child);
@@ -799,7 +806,7 @@ bool BookmarksBridge::IsEditable(const BookmarkNode* node) const {
}
bool BookmarksBridge::IsManaged(const BookmarkNode* node) const {
- return client_->IsDescendantOfManagedNode(node);
+ return bookmarks::IsDescendantOf(node, client_->managed_node());
}
const BookmarkNode* BookmarksBridge::GetParentNode(const BookmarkNode* node) {
@@ -834,6 +841,10 @@ bool BookmarksBridge::IsFolderAvailable(
// configured via policy.
if (folder == client_->managed_node() && folder->empty())
return false;
+ // Similarly, the supervised bookmarks folder is not shown if there are no
+ // bookmarks configured by the custodian.
+ if (folder == client_->supervised_node() && folder->empty())
+ return false;
SigninManager* signin = SigninManagerFactory::GetForProfile(
profile_->GetOriginalProfile());
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/bookmarks/bookmark_model_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698