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. | 38 // The top-level managed bookmarks folder, defined by an enterprise policy. |
39 const bookmarks::BookmarkNode* managed_node() { return managed_node_; } | 39 const bookmarks::BookmarkNode* managed_node() { return managed_node_; } |
40 | 40 // The top-level supervised bookmarks folder, defined by the custodian of a |
41 // Returns true if the given node belongs to the managed bookmarks tree. | 41 // supervised user. |
42 bool IsDescendantOfManagedNode(const bookmarks::BookmarkNode* node); | 42 const bookmarks::BookmarkNode* supervised_node() { return supervised_node_; } |
43 | |
44 // Returns true if there is at least one managed node in the |list|. | |
45 bool HasDescendantsOfManagedNode( | |
46 const std::vector<const bookmarks::BookmarkNode*>& list); | |
47 | 43 |
48 // bookmarks::BookmarkClient: | 44 // bookmarks::BookmarkClient: |
49 bool PreferTouchIcon() override; | 45 bool PreferTouchIcon() override; |
50 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( | 46 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( |
51 const GURL& page_url, | 47 const GURL& page_url, |
52 favicon_base::IconType type, | 48 favicon_base::IconType type, |
53 const favicon_base::FaviconImageCallback& callback, | 49 const favicon_base::FaviconImageCallback& callback, |
54 base::CancelableTaskTracker* tracker) override; | 50 base::CancelableTaskTracker* tracker) override; |
55 bool SupportsTypedCountForNodes() override; | 51 bool SupportsTypedCountForNodes() override; |
56 void GetTypedCountForNodes( | 52 void GetTypedCountForNodes( |
(...skipping 21 matching lines...) Expand all Loading... |
78 const std::set<GURL>& removed_urls) override; | 74 const std::set<GURL>& removed_urls) override; |
79 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, | 75 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model, |
80 const std::set<GURL>& removed_urls) override; | 76 const std::set<GURL>& removed_urls) override; |
81 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, | 77 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, |
82 bool ids_reassigned) override; | 78 bool ids_reassigned) override; |
83 | 79 |
84 // Helper for GetLoadExtraNodesCallback(). | 80 // Helper for GetLoadExtraNodesCallback(). |
85 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes( | 81 static bookmarks::BookmarkPermanentNodeList LoadExtraNodes( |
86 scoped_ptr<bookmarks::BookmarkPermanentNode> managed_node, | 82 scoped_ptr<bookmarks::BookmarkPermanentNode> managed_node, |
87 scoped_ptr<base::ListValue> initial_managed_bookmarks, | 83 scoped_ptr<base::ListValue> initial_managed_bookmarks, |
| 84 scoped_ptr<bookmarks::BookmarkPermanentNode> supervised_node, |
| 85 scoped_ptr<base::ListValue> initial_supervised_bookmarks, |
88 int64* next_node_id); | 86 int64* next_node_id); |
89 | 87 |
90 // Returns the management domain that configured the managed bookmarks, | 88 // Returns the management domain that configured the managed bookmarks, |
91 // or an empty string. | 89 // or an empty string. |
92 std::string GetManagedBookmarksDomain(); | 90 std::string GetManagedBookmarksDomain(); |
93 | 91 |
94 Profile* profile_; | 92 Profile* profile_; |
95 | 93 |
96 // HistoryService associated to the Profile. Due to circular dependency, this | 94 // HistoryService associated to the Profile. Due to circular dependency, this |
97 // cannot be passed to the constructor, nor lazily fetched. Instead the value | 95 // cannot be passed to the constructor, nor lazily fetched. Instead the value |
98 // is initialized from HistoryServiceFactory. | 96 // is initialized from HistoryServiceFactory. |
99 HistoryService* history_service_; | 97 HistoryService* history_service_; |
100 | 98 |
101 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 99 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> |
102 favicon_changed_subscription_; | 100 favicon_changed_subscription_; |
103 | 101 |
104 // Pointer to the BookmarkModel. Will be non-NULL from the call to Init to | 102 // Pointer to the BookmarkModel. Will be non-NULL from the call to Init to |
105 // the call to Shutdown. Must be valid for the whole interval. | 103 // the call to Shutdown. Must be valid for the whole interval. |
106 bookmarks::BookmarkModel* model_; | 104 bookmarks::BookmarkModel* model_; |
107 | 105 |
| 106 // Managed bookmarks are defined by an enterprise policy. |
108 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_; | 107 scoped_ptr<policy::ManagedBookmarksTracker> managed_bookmarks_tracker_; |
| 108 // The top-level managed bookmarks folder. |
109 bookmarks::BookmarkPermanentNode* managed_node_; | 109 bookmarks::BookmarkPermanentNode* managed_node_; |
110 | 110 |
| 111 // Supervised bookmarks are defined by the custodian of a supervised user. |
| 112 scoped_ptr<policy::ManagedBookmarksTracker> supervised_bookmarks_tracker_; |
| 113 // The top-level supervised bookmarks folder. |
| 114 bookmarks::BookmarkPermanentNode* supervised_node_; |
| 115 |
111 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient); | 116 DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClient); |
112 }; | 117 }; |
113 | 118 |
114 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ | 119 #endif // CHROME_BROWSER_BOOKMARKS_CHROME_BOOKMARK_CLIENT_H_ |
OLD | NEW |