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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/bookmarks.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/core/browser/bookmark_client.h
diff --git a/components/bookmarks/core/browser/bookmark_client.h b/components/bookmarks/core/browser/bookmark_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..24932788d188767f82c390e42b00b31c72bdb32c
--- /dev/null
+++ b/components/bookmarks/core/browser/bookmark_client.h
@@ -0,0 +1,73 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
+#define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
+
+#include <set>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/task/cancelable_task_tracker.h"
+
+class GURL;
+class BookmarkNode;
+
+namespace base {
+struct UserMetricsAction;
+}
+
+namespace favicon_base {
+struct FaviconImageResult;
+}
+
+namespace tracked_objects {
+class Location;
+}
+
+// This class abstracts operations that depends on the embedder's environment,
+// e.g. Chrome.
+class BookmarkClient {
+ public:
+ virtual ~BookmarkClient() {};
sky 2014/04/18 14:21:56 nit: no ';'
sdefresne 2014/04/18 15:05:32 Done.
+
+ // Callback for GetFaviconImageForURL().
+ typedef base::Callback<void(const favicon_base::FaviconImageResult&)>
+ FaviconImageCallback;
+
+ // Requests the favicon of any of |icon_types| whose pixel sizes most
+ // closely match |desired_size_in_dip| (if value is 0, the largest favicon
+ // is returned) and desired scale factor for |page_url|. |callback| is run
+ // when the bits have been fetched. |icon_types| can be any combination of
+ // IconType value, but only one icon will be returned.
+ virtual base::CancelableTaskTracker::TaskId GetFaviconImageForURL(
+ const GURL& page_url,
+ int icon_types,
+ int desired_size_in_dip,
+ const FaviconImageCallback& callback,
+ base::CancelableTaskTracker* tracker) = 0;
+
+ // Types representing a set of BookmarkNode and a mapping from BookmarkNode
+ // to the number of time the corresponding URL has been typed by the user in
+ // the Omnibox.
+ 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.
+ typedef std::pair<const BookmarkNode*, int> NodeTypedCountPair;
+ typedef std::vector<NodeTypedCountPair> NodeTypedCountPairs;
+
+ // Retrieves the number of time each BookmarkNode URL has been typed in
+ // the Omnibox by the user.
+ 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.
+ const NodeSet& nodes,
+ NodeTypedCountPairs* node_typed_count_pairs) = 0;
+
+ // Wrapper around RecordAction defined in base/metrics/user_metrics.h
+ // that ensure that the action is posted from the correct thread.
+ virtual void RecordAction(const base::UserMetricsAction& action) = 0;
+
+ // 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.
+ virtual bool PostTask(const tracked_objects::Location& from_here,
+ const base::Closure& task) = 0;
+};
+
+#endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_CLIENT_H_
« 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