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

Unified Diff: components/history/core/browser/history_client.h

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 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
Index: components/history/core/browser/history_client.h
diff --git a/components/history/core/browser/history_client.h b/components/history/core/browser/history_client.h
index cc2da5845823c416361f47b1dabe772afc642c84..370d723392b5b90e232d37ec15fd97eed74956b1 100644
--- a/components/history/core/browser/history_client.h
+++ b/components/history/core/browser/history_client.h
@@ -5,17 +5,45 @@
#ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_
#define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_
+#include <vector>
+
#include "base/macros.h"
+#include "base/strings/string16.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "url/gurl.h"
namespace history {
+struct URLAndTitle {
+ GURL url;
+ base::string16 title;
+};
+
// This class abstracts operations that depend on the embedder's environment,
// e.g. Chrome.
class HistoryClient : public KeyedService {
- protected:
- HistoryClient() {}
+ public:
+ HistoryClient();
+ // Waits until the bookmarks have been loaded.
+ //
+ // Must not be called from the main thread.
+ virtual void BlockUntilBookmarksLoaded();
+
+ // Returns true if the specified URL is bookmarked.
+ //
+ // If not on the main thread, then BlockUntilBookmarksLoaded must be called.
+ virtual bool IsBookmarked(const GURL& url);
+
+ // Returns, by reference in |bookmarks|, the set of bookmarked urls and their
+ // titles. This returns the unique set of URLs. For example, if two bookmarks
+ // reference the same URL only one entry is added even if the title are not
+ // the same.
+ //
+ // If not on the main thread, then BlockUntilBookmarksLoaded must be called.
+ virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks);
+
+ protected:
DISALLOW_COPY_AND_ASSIGN(HistoryClient);
};

Powered by Google App Engine
This is Rietveld 408576698