Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Side by Side Diff: components/bookmarks/core/browser/bookmark_client.h

Issue 242693003: Introduce BookmarkClient interface to abstract embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/bookmarks.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
7
8 #include <set>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/task/cancelable_task_tracker.h"
13
14 class GURL;
15 class BookmarkNode;
16
17 namespace base {
18 struct UserMetricsAction;
19 }
20
21 namespace favicon_base {
22 struct FaviconImageResult;
23 }
24
25 namespace tracked_objects {
26 class Location;
27 }
28
29 // This class abstracts operations that depends on the embedder's environment,
30 // e.g. Chrome.
31 class BookmarkClient {
32 public:
33 virtual ~BookmarkClient() {};
sky 2014/04/18 14:21:56 nit: no ';'
sdefresne 2014/04/18 15:05:32 Done.
34
35 // Callback for GetFaviconImageForURL().
36 typedef base::Callback<void(const favicon_base::FaviconImageResult&)>
37 FaviconImageCallback;
38
39 // Requests the favicon of any of |icon_types| whose pixel sizes most
40 // closely match |desired_size_in_dip| (if value is 0, the largest favicon
41 // is returned) and desired scale factor for |page_url|. |callback| is run
42 // when the bits have been fetched. |icon_types| can be any combination of
43 // IconType value, but only one icon will be returned.
44 virtual base::CancelableTaskTracker::TaskId GetFaviconImageForURL(
45 const GURL& page_url,
46 int icon_types,
47 int desired_size_in_dip,
48 const FaviconImageCallback& callback,
49 base::CancelableTaskTracker* tracker) = 0;
50
51 // Types representing a set of BookmarkNode and a mapping from BookmarkNode
52 // to the number of time the corresponding URL has been typed by the user in
53 // the Omnibox.
54 typedef std::set<const BookmarkNode*> NodeSet;
sky 2014/04/18 14:21:56 I would prefer to keep the typedefs at the top of
sdefresne 2014/04/18 15:05:32 Done.
55 typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair;
56 typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs;
57
58 // Retrieves the number of time each BookmarkNode URL has been typed in
59 // the Omnibox by the user.
60 virtual void ExtractBookmarkNodePairs(
sky 2014/04/18 14:21:56 How about a better name for this, maybe GetTypedCo
sdefresne 2014/04/18 15:05:32 Done.
61 const NodeSet& nodes,
62 NodeTypedCountPairs* node_typed_count_pairs) = 0;
63
64 // Wrapper around RecordAction defined in base/metrics/user_metrics.h
65 // that ensure that the action is posted from the correct thread.
66 virtual void RecordAction(const base::UserMetricsAction& action) = 0;
67
68 // Post a task in the UI thread.
sky 2014/04/18 14:21:56 components can't depend upon the ability to get a
sdefresne 2014/04/18 15:05:32 Done.
69 virtual bool PostTask(const tracked_objects::Location& from_here,
70 const base::Closure& task) = 0;
71 };
72
73 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
OLDNEW
« no previous file with comments | « components/bookmarks.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698