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

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

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: chrome/browser/history/history_service.h
diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h
index aaedce4214428b40d91f4926ddd8f2134abf986e..4066a6f9e05994c85ea6fe97266e8b65f8e28181 100644
--- a/chrome/browser/history/history_service.h
+++ b/chrome/browser/history/history_service.h
@@ -28,7 +28,7 @@
#include "chrome/browser/history/typed_url_syncable_service.h"
#include "chrome/browser/search_engines/template_url_id.h"
#include "chrome/common/ref_counted_util.h"
-#include "components/keyed_service/core/keyed_service.h"
+#include "components/history/core/browser/history_client.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
#include "content/public/browser/download_manager_delegate.h"
#include "content/public/browser/notification_observer.h"
@@ -42,7 +42,6 @@
#include "chrome/browser/history/android/android_history_provider_service.h"
#endif
-class BookmarkService;
class GURL;
class HistoryURLProvider;
class PageUsageData;
@@ -85,14 +84,13 @@ struct HistoryDetails;
class HistoryService : public CancelableRequestProvider,
public content::NotificationObserver,
public syncer::SyncableService,
- public KeyedService,
public visitedlink::VisitedLinkDelegate {
public:
// Miscellaneous commonly-used types.
typedef std::vector<PageUsageData*> PageUsageDataList;
// Must call Init after construction.
- explicit HistoryService(Profile* profile);
+ explicit HistoryService(history::HistoryClient* client, Profile* profile);
// The empty constructor is provided only for testing.
HistoryService();
@@ -100,10 +98,9 @@ class HistoryService : public CancelableRequestProvider,
// Initializes the history service, returning true on success. On false, do
// not call any other functions. The given directory will be used for storing
- // the history files. The BookmarkService is used when deleting URLs to
- // test if a URL is bookmarked; it may be NULL during testing.
- bool Init(const base::FilePath& history_dir, BookmarkService* bookmark_service) {
- return Init(history_dir, bookmark_service, false);
+ // the history files.
+ bool Init(const base::FilePath& history_dir) {
+ return Init(history_dir, false);
}
// Triggers the backend to load if it hasn't already, and then returns whether
@@ -164,9 +161,6 @@ class HistoryService : public CancelableRequestProvider,
return in_memory_url_index_.get();
}
- // KeyedService:
- virtual void Shutdown() OVERRIDE;
-
// Navigation ----------------------------------------------------------------
// Adds the given canonical URL to history with the given time as the visit
@@ -562,6 +556,9 @@ class HistoryService : public CancelableRequestProvider,
// history. We filter out some URLs such as JavaScript.
static bool CanAddURL(const GURL& url);
+ // Returns the HistoryClient.
+ history::HistoryClient* history_client() { return history_client_; }
Jiang Jiang 2014/05/19 21:51:50 Should be a const?
sdefresne 2014/05/23 10:02:49 Done.
+
base::WeakPtr<HistoryService> AsWeakPtr();
// syncer::SyncableService implementation.
@@ -617,9 +614,7 @@ class HistoryService : public CancelableRequestProvider,
// Low-level Init(). Same as the public version, but adds a |no_db| parameter
// that is only set by unittests which causes the backend to not init its DB.
- bool Init(const base::FilePath& history_dir,
- BookmarkService* bookmark_service,
- bool no_db);
+ bool Init(const base::FilePath& history_dir, bool no_db);
// Called by the HistoryURLProvider class to schedule an autocomplete, it
// will be called back on the internal history thread with the history
@@ -1019,6 +1014,9 @@ class HistoryService : public CancelableRequestProvider,
// TODO(mrossetti): Consider changing ownership. See http://crbug.com/138321
scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_;
+ // The HistoryClient; may be NULL in tests.
+ history::HistoryClient* history_client_;
+
// The profile, may be null when testing.
Profile* profile_;
@@ -1032,7 +1030,6 @@ class HistoryService : public CancelableRequestProvider,
// Cached values from Init(), used whenever we need to reload the backend.
base::FilePath history_dir_;
- BookmarkService* bookmark_service_;
bool no_db_;
// The index used for quick history lookups.

Powered by Google App Engine
This is Rietveld 408576698