Chromium Code Reviews| 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 COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
| 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "components/bookmarks/browser/bookmark_storage.h" | |
| 14 #include "components/favicon_base/favicon_callback.h" | 15 #include "components/favicon_base/favicon_callback.h" |
| 15 | 16 |
| 16 class BookmarkNode; | 17 class BookmarkNode; |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 struct UserMetricsAction; | 21 struct UserMetricsAction; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // This class abstracts operations that depends on the embedder's environment, | 24 // This class abstracts operations that depends on the embedder's environment, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 48 | 49 |
| 49 // Returns true if the embedder supports typed count for URL. | 50 // Returns true if the embedder supports typed count for URL. |
| 50 virtual bool SupportsTypedCountForNodes(); | 51 virtual bool SupportsTypedCountForNodes(); |
| 51 | 52 |
| 52 // Retrieves the number of time each BookmarkNode URL has been typed in | 53 // Retrieves the number of time each BookmarkNode URL has been typed in |
| 53 // the Omnibox by the user. | 54 // the Omnibox by the user. |
| 54 virtual void GetTypedCountForNodes( | 55 virtual void GetTypedCountForNodes( |
| 55 const NodeSet& nodes, | 56 const NodeSet& nodes, |
| 56 NodeTypedCountPairs* node_typed_count_pairs); | 57 NodeTypedCountPairs* node_typed_count_pairs); |
| 57 | 58 |
| 58 // Returns whether the embedder wants permanent node of type |node_type| | 59 // Returns whether the embedder wants permanent node |node| |
| 59 // to always be visible or to only show them when not empty. | 60 // to always be visible or to only show them when not empty. |
| 60 virtual bool IsPermanentNodeVisible(int node_type) = 0; | 61 virtual bool IsPermanentNodeVisible(const BookmarkNode* node) = 0; |
|
sky
2014/06/04 20:39:52
Shouldn't this continue to take a permanentnode?
Joao da Silva
2014/06/04 22:35:58
Done.
| |
| 61 | 62 |
| 62 // Wrapper around RecordAction defined in base/metrics/user_metrics.h | 63 // Wrapper around RecordAction defined in base/metrics/user_metrics.h |
| 63 // that ensure that the action is posted from the correct thread. | 64 // that ensure that the action is posted from the correct thread. |
| 64 virtual void RecordAction(const base::UserMetricsAction& action) = 0; | 65 virtual void RecordAction(const base::UserMetricsAction& action) = 0; |
| 65 | 66 |
| 67 // Returns a task that will be used to load any additional root nodes. This | |
| 68 // task will be invoked in a background thread. | |
| 69 virtual bookmarks::LoadExtraCallback GetLoadExtraNodesCallback() = 0; | |
| 70 | |
| 71 // Called after the model has loaded the extra nodes created by the callback | |
| 72 // from GetLoadExtraNodesCallback(). These nodes are now children of the | |
| 73 // model's root node, and |extra_nodes| lists them in the same order that | |
| 74 // was returned from the callback. This allows the BookmarkClient to get | |
| 75 // handles to these nodes on the main thread. | |
| 76 virtual void ExtraNodesLoaded( | |
| 77 const std::vector<BookmarkPermanentNode*>& extra_nodes) = 0; | |
| 78 | |
| 79 // Checks if |node| can be removed from the bookmark tree. | |
| 80 virtual bool CanRemoveNode(const BookmarkNode* node) = 0; | |
| 81 | |
| 82 // Checks if the |permanent_node| can have its title updated. | |
| 83 virtual bool CanSetTitle(const BookmarkNode* permanent_node) = 0; | |
| 84 | |
| 85 // Checks if |node| should sync. | |
| 86 virtual bool CanSyncNode(const BookmarkNode* node) = 0; | |
| 87 | |
| 88 // Checks if the children of |parent| can be reordered or sorted. | |
| 89 virtual bool CanReorderChildren(const BookmarkNode* parent) = 0; | |
| 90 | |
| 66 protected: | 91 protected: |
| 67 virtual ~BookmarkClient() {} | 92 virtual ~BookmarkClient() {} |
| 68 }; | 93 }; |
| 69 | 94 |
| 70 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 95 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
| OLD | NEW |