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/keyed_service/core/keyed_service.h" |
16 | 17 |
17 class BookmarkNode; | 18 class BookmarkNode; |
18 class BookmarkPermanentNode; | 19 class BookmarkPermanentNode; |
19 class GURL; | 20 class GURL; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 struct UserMetricsAction; | 23 struct UserMetricsAction; |
23 } | 24 } |
24 | 25 |
25 // This class abstracts operations that depends on the embedder's environment, | 26 // This class abstracts operations that depends on the embedder's environment, |
26 // e.g. Chrome. | 27 // e.g. Chrome. |
27 class BookmarkClient { | 28 class BookmarkClient : public KeyedService { |
28 public: | 29 public: |
29 // Types representing a set of BookmarkNode and a mapping from BookmarkNode | 30 // Types representing a set of BookmarkNode and a mapping from BookmarkNode |
30 // to the number of time the corresponding URL has been typed by the user in | 31 // to the number of time the corresponding URL has been typed by the user in |
31 // the Omnibox. | 32 // the Omnibox. |
32 typedef std::set<const BookmarkNode*> NodeSet; | 33 typedef std::set<const BookmarkNode*> NodeSet; |
33 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair; | 34 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair; |
34 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; | 35 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; |
35 | 36 |
36 // Returns true if the embedder favors touch icons over favicons. | 37 // Returns true if the embedder favors touch icons over favicons. |
37 virtual bool PreferTouchIcon(); | 38 virtual bool PreferTouchIcon(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // TODO(joaodasilva): the model should check this more aggressively, and | 80 // TODO(joaodasilva): the model should check this more aggressively, and |
80 // should give the client a means to temporarily disable those checks. | 81 // should give the client a means to temporarily disable those checks. |
81 // http://crbug.com/49598 | 82 // http://crbug.com/49598 |
82 virtual bool CanBeEditedByUser(const BookmarkNode* node) = 0; | 83 virtual bool CanBeEditedByUser(const BookmarkNode* node) = 0; |
83 | 84 |
84 protected: | 85 protected: |
85 virtual ~BookmarkClient() {} | 86 virtual ~BookmarkClient() {} |
86 }; | 87 }; |
87 | 88 |
88 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 89 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
OLD | NEW |