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/bookmarks/browser/bookmark_storage.h" |
| 15 #include "components/favicon_base/favicon_callback.h" | 15 #include "components/favicon_base/favicon_callback.h" |
| 16 #include "components/favicon_base/favicon_types.h" | 16 #include "components/favicon_base/favicon_types.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 struct UserMetricsAction; | 22 struct UserMetricsAction; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace bookmarks { | 25 namespace bookmarks { |
| 26 | 26 |
| 27 class BookmarkModel; | 27 class BookmarkModel; |
| 28 class BookmarkNode; | |
| 29 class BookmarkPermanentNode; | 28 class BookmarkPermanentNode; |
| 29 class TitledUrlNode; | |
| 30 | 30 |
| 31 // This class abstracts operations that depends on the embedder's environment, | 31 // This class abstracts operations that depends on the embedder's environment, |
| 32 // e.g. Chrome. | 32 // e.g. Chrome. |
| 33 class BookmarkClient { | 33 class BookmarkClient { |
|
sky
2016/12/02 00:21:24
Why do you need to touch this class? I was assumin
mattreynolds
2016/12/02 21:02:06
Even if I factor out the sorting logic, at some po
sky
2016/12/02 21:30:29
BookmarkClient should be able to assume it is oper
| |
| 34 public: | 34 public: |
| 35 // Types representing a set of BookmarkNode and a mapping from BookmarkNode | 35 // Types representing a set of TitledUrlNodes and a mapping from TitledUrlNode |
| 36 // to the number of time the corresponding URL has been typed by the user in | 36 // to the number of times the corresponding URL has been typed by the user in |
| 37 // the Omnibox. | 37 // the Omnibox. |
| 38 typedef std::set<const BookmarkNode*> NodeSet; | 38 typedef std::set<const TitledUrlNode*> NodeSet; |
| 39 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair; | 39 typedef std::pair<const TitledUrlNode*, int> NodeTypedCountPair; |
| 40 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; | 40 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; |
| 41 | 41 |
| 42 virtual ~BookmarkClient() {} | 42 virtual ~BookmarkClient() {} |
| 43 | 43 |
| 44 // Called during initialization of BookmarkModel. | 44 // Called during initialization of BookmarkModel. |
| 45 virtual void Init(BookmarkModel* model); | 45 virtual void Init(BookmarkModel* model); |
| 46 | 46 |
| 47 // Returns true if the embedder favors touch icons over favicons. | 47 // Returns true if the embedder favors touch icons over favicons. |
| 48 virtual bool PreferTouchIcon(); | 48 virtual bool PreferTouchIcon(); |
| 49 | 49 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // Returns true if this node can be edited by the user. | 91 // Returns true if this node can be edited by the user. |
| 92 // TODO(joaodasilva): the model should check this more aggressively, and | 92 // TODO(joaodasilva): the model should check this more aggressively, and |
| 93 // should give the client a means to temporarily disable those checks. | 93 // should give the client a means to temporarily disable those checks. |
| 94 // http://crbug.com/49598 | 94 // http://crbug.com/49598 |
| 95 virtual bool CanBeEditedByUser(const BookmarkNode* node) = 0; | 95 virtual bool CanBeEditedByUser(const BookmarkNode* node) = 0; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace bookmarks | 98 } // namespace bookmarks |
| 99 | 99 |
| 100 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 100 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
| OLD | NEW |