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/favicon_base/favicon_callback.h" | 14 #include "components/favicon_base/favicon_callback.h" |
| 15 #include "components/keyed_service/core/keyed_service.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, |
24 // e.g. Chrome. | 25 // e.g. Chrome. |
25 class BookmarkClient { | 26 class BookmarkClient : public KeyedService { |
26 public: | 27 public: |
27 // Types representing a set of BookmarkNode and a mapping from BookmarkNode | 28 // Types representing a set of BookmarkNode and a mapping from BookmarkNode |
28 // to the number of time the corresponding URL has been typed by the user in | 29 // to the number of time the corresponding URL has been typed by the user in |
29 // the Omnibox. | 30 // the Omnibox. |
30 typedef std::set<const BookmarkNode*> NodeSet; | 31 typedef std::set<const BookmarkNode*> NodeSet; |
31 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair; | 32 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair; |
32 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; | 33 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs; |
33 | 34 |
34 // Returns true if the embedder favors touch icons over favicons. | 35 // Returns true if the embedder favors touch icons over favicons. |
35 virtual bool PreferTouchIcon(); | 36 virtual bool PreferTouchIcon(); |
(...skipping 25 matching lines...) Expand all Loading... |
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 |
66 protected: | 67 protected: |
67 virtual ~BookmarkClient() {} | 68 virtual ~BookmarkClient() {} |
68 }; | 69 }; |
69 | 70 |
70 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ | 71 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_CLIENT_H_ |
OLD | NEW |