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

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: Address comments 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
new file mode 100644
index 0000000000000000000000000000000000000000..1756fb6c1c517da513bfd49ed5443fa13df632f0
--- /dev/null
+++ b/components/history/core/browser/history_client.h
@@ -0,0 +1,52 @@
+// 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_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 "url/gurl.h"
+
+namespace history {
+
+struct URLAndTitle {
+ GURL url;
+ base::string16 title;
+};
+
+// This class abstracts operations that depends on the embedder's environment,
blundell 2014/05/26 07:16:58 s/depends/depend
sdefresne 2014/05/26 16:34:02 Done.
+// e.g. Chrome.
+class HistoryClient {
+ public:
+ // Waits until the bookmarks have been loaded.
+ //
+ // Must not be called from the main thread.
+ virtual void BlockTillBookmarksLoaded();
blundell 2014/05/26 07:16:58 s/Till/Until
sdefresne 2014/05/26 16:34:02 Done.
+
+ // Returns true if the specified URL is bookmarked.
+ //
+ // If not on the main thread, then you must call BlockTillLoaded first.
blundell 2014/05/26 07:16:58 s/you must call BlockTillLoaded/BlockTillLoaded mu
sdefresne 2014/05/26 16:34:02 Done.
+ 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 you must call BlockTillLoaded first.
+ virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks);
+
+ protected:
+ HistoryClient() {}
+ virtual ~HistoryClient() {}
+
+ DISALLOW_COPY_AND_ASSIGN(HistoryClient);
+};
+
+} // namespace history
+
+#endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698