 Chromium Code Reviews
 Chromium Code Reviews Issue 769153007:
  Managed bookmarks for supervised users  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 769153007:
  Managed bookmarks for supervised users  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 Loading... | |
| 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. | |
| 39 const BookmarkNode* managed_node() { return managed_node_; } | 38 const BookmarkNode* managed_node() { return managed_node_; } | 
| 39 const BookmarkNode* supervised_node() { return supervised_node_; } | |
| 40 | 40 | 
| 41 // Returns true if the given node belongs to the managed bookmarks tree. | 41 // Returns true if the given node belongs to the managed bookmarks tree. | 
| 42 bool IsDescendantOfManagedNode(const BookmarkNode* node); | 42 bool IsDescendantOfManagedNode(const BookmarkNode* node); | 
| 43 | |
| 44 // Returns true if there is at least one managed node in the |list|. | 43 // Returns true if there is at least one managed node in the |list|. | 
| 45 bool HasDescendantsOfManagedNode( | 44 bool HasDescendantsOfManagedNode( | 
| 46 const std::vector<const BookmarkNode*>& list); | 45 const std::vector<const BookmarkNode*>& list); | 
| 47 | 46 | 
| 47 // Returns true if the given node belongs to the supervised bookmarks tree. | |
| 48 bool IsDescendantOfSupervisedNode(const BookmarkNode* node); | |
| 49 // Returns true if there is at least one supervised node in the |list|. | |
| 50 bool HasDescendantsOfSupervisedNode( | |
| 51 const std::vector<const BookmarkNode*>& list); | |
| 52 | |
| 53 // Returns true if the given node belongs to either the managed or the | |
| 54 // supervised bookmarks tree. | |
| 55 bool IsDescendantOfManagedOrSupervisedNode(const BookmarkNode* node); | |
| 56 // Returns true if there is at least one managed or supervised node in the | |
| 57 // |list|. | |
| 58 bool HasDescendantsOfManagedOrSupervisedNode( | |
| 59 const std::vector<const BookmarkNode*>& list); | |
| 60 | |
| 48 // bookmarks::BookmarkClient: | 61 // bookmarks::BookmarkClient: | 
| 49 bool PreferTouchIcon() override; | 62 bool PreferTouchIcon() override; | 
| 50 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( | 63 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( | 
| 51 const GURL& page_url, | 64 const GURL& page_url, | 
| 52 favicon_base::IconType type, | 65 favicon_base::IconType type, | 
| 53 const favicon_base::FaviconImageCallback& callback, | 66 const favicon_base::FaviconImageCallback& callback, | 
| 54 base::CancelableTaskTracker* tracker) override; | 67 base::CancelableTaskTracker* tracker) override; | 
| 55 bool SupportsTypedCountForNodes() override; | 68 bool SupportsTypedCountForNodes() override; | 
| 56 void GetTypedCountForNodes( | 69 void GetTypedCountForNodes( | 
| 57 const NodeSet& nodes, | 70 const NodeSet& nodes, | 
| (...skipping 18 matching lines...) Expand all Loading... | |
| 76 const std::set<GURL>& removed_urls) override; | 89 const std::set<GURL>& removed_urls) override; | 
| 77 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, | 90 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, | 
| 78 const std::set<GURL>& removed_urls) override; | 91 const std::set<GURL>& removed_urls) override; | 
| 79 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, | 92 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, | 
| 80 bool ids_reassigned) override; | 93 bool ids_reassigned) override; | 
| 81 | 94 | 
| 82 // Helper for GetLoadExtraNodesCallback(). | 95 // Helper for GetLoadExtraNodesCallback(). | 
| 83 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes( | 96 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes( | 
| 84 scoped_ptr<BookmarkPermanentNode> managed_node, | 97 scoped_ptr<BookmarkPermanentNode> managed_node, | 
| 85 scoped_ptr<base::ListValue> initial_managed_bookmarks, | 98 scoped_ptr<base::ListValue> initial_managed_bookmarks, | 
| 99 scoped_ptr<BookmarkPermanentNode> supervised_node, | |
| 100 scoped_ptr<base::ListValue> initial_supervised_bookmarks, | |
| 86 int64* next_node_id); | 101 int64* next_node_id); | 
| 87 | 102 | 
| 88 // Returns the management domain that configured the managed bookmarks, | 103 // Returns the management domain that configured the managed bookmarks, | 
| 89 // or an empty string. | 104 // or an empty string. | 
| 90 std::string GetManagedBookmarksDomain(); | 105 std::string GetManagedBookmarksDomain(); | 
| 91 | 106 | 
| 92 Profile* profile_; | 107 Profile* profile_; | 
| 93 | 108 | 
| 94 // HistoryService associated to the Profile. Due to circular dependency, this | 109 // HistoryService associated to the Profile. Due to circular dependency, this | 
| 95 // cannot be passed to the constructor, nor lazily fetched. Instead the value | 110 // cannot be passed to the constructor, nor lazily fetched. Instead the value | 
| 96 // is initialized from HistoryServiceFactory. | 111 // is initialized from HistoryServiceFactory. | 
| 97 HistoryService* history_service_; | 112 HistoryService* history_service_; | 
| 98 | 113 | 
| 99 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 114 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 
| 100 favicon_changed_subscription_; | 115 favicon_changed_subscription_; | 
| 101 | 116 | 
| 102 // Pointer to the BookmarkModel. Will be non-NULL from the call to Init to | 117 // 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. | 118 // the call to Shutdown. Must be valid for the whole interval. | 
| 104 bookmarks::BookmarkModel* model_; | 119 bookmarks::BookmarkModel* model_; | 
| 105 | 120 | 
| 121 // Managed bookmarks are defined by an enterprise policy. | |
| 106 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_; | 122 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_; | 
| 107 BookmarkPermanentNode* managed_node_; | 123 BookmarkPermanentNode* managed_node_; | 
| 
Pam (message me for reviews)
2015/01/15 11:37:04
Something like "// The top-level managed bookmarks
 
Marc Treib
2015/01/15 12:30:09
Done.
 | |
| 108 | 124 | 
| 125 // Supervised bookmarks are defined by the custodian of a supervised user. | |
| 126 scoped_ptr<policy::ManagedBookmarksTracker> supervised_bookmarks_tracker_; | |
| 127 BookmarkPermanentNode* supervised_node_; | |
| 128 | |
| 109 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient); | 129 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient); | 
| 110 }; | 130 }; | 
| 111 | 131 | 
| 112 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ | 132 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ | 
| OLD | NEW |