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

Unified Diff: chrome/browser/history/chrome_history_client.h

Issue 1205603002: Remove dependency of HistoryServiceFactory on ChromeBookmarkClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_history_client
Patch Set: Fix unit_tests on android (only register as BookmarkModelObserver if HistoryService is initialized) Created 5 years, 6 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 | « chrome/browser/bookmarks/chrome_bookmark_client.cc ('k') | chrome/browser/history/chrome_history_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/chrome_history_client.h
diff --git a/chrome/browser/history/chrome_history_client.h b/chrome/browser/history/chrome_history_client.h
index 41f823d7cfdd36e187ee12472ce7cf02c11d780a..acb516b8ccafb85b58db38c4f84bc9cad08af09e 100644
--- a/chrome/browser/history/chrome_history_client.h
+++ b/chrome/browser/history/chrome_history_client.h
@@ -5,30 +5,62 @@
#ifndef CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
#define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_
+#include <set>
+
+#include "base/callback_forward.h"
+#include "base/callback_list.h"
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/history/core/browser/history_client.h"
+class GURL;
+
namespace bookmarks {
class BookmarkModel;
+class BookmarkNode;
}
// This class implements history::HistoryClient to abstract operations that
// depend on Chrome environment.
-class ChromeHistoryClient : public history::HistoryClient {
+class ChromeHistoryClient : public history::HistoryClient,
+ public bookmarks::BaseBookmarkModelObserver {
public:
explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model);
~ChromeHistoryClient() override;
// history::HistoryClient implementation.
+ void OnHistoryServiceCreated(
+ history::HistoryService* history_service) override;
void Shutdown() override;
bool CanAddURL(const GURL& url) override;
void NotifyProfileError(sql::InitStatus init_status) override;
scoped_ptr<history::HistoryBackendClient> CreateBackendClient() override;
private:
+ // bookmarks::BaseBookmarkModelObserver implementation.
+ void BookmarkModelChanged() override;
+
+ // bookmarks::BookmarkModelObserver implementation.
+ void BookmarkNodeRemoved(bookmarks::BookmarkModel* bookmark_model,
+ const bookmarks::BookmarkNode* parent,
+ int old_index,
+ const bookmarks::BookmarkNode* node,
+ const std::set<GURL>& removed_url) override;
+ void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* bookmark_model,
+ const std::set<GURL>& removed_urls) override;
+
// BookmarkModel instance providing access to bookmarks. May be null during
// testing but must outlive ChromeHistoryClient if non-null.
bookmarks::BookmarkModel* bookmark_model_;
+ bool is_bookmark_model_observer_;
+
+ // Callback invoked when URLs are removed from BookmarkModel.
+ base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
+
+ // Subscription for notifications of changes to favicons.
+ scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
+ favicon_changed_subscription_;
DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient);
};
« no previous file with comments | « chrome/browser/bookmarks/chrome_bookmark_client.cc ('k') | chrome/browser/history/chrome_history_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698