Commit f3b63c0b authored by sdefresne's avatar sdefresne Committed by Commit bot

Remove dependency of HistoryService on WebHistoryServiceFactory

Change HistoryService::ExpireLocalAndRemoteHistoryBetween() to
receive the history::WebHistoryService instance to use in order
to remove a dependency of HistoryService on Profile.

It is not possible to pass the WebHistoryService instance to the
HistoryService constructor and add a dependency between the two
factories due to http://crbug.com/171406 (as WebHistoryService
depends on a KeyedService calling Profile::GetRequestContext()).

BUG=453790

Review URL: https://codereview.chromium.org/901803005

Cr-Commit-Position: refs/heads/master@{#315038}
parent f092ee22
......@@ -22,6 +22,7 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/net/predictor.h"
......@@ -308,6 +309,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
waiting_for_clear_history_ = true;
history_service->ExpireLocalAndRemoteHistoryBetween(
WebHistoryServiceFactory::GetForProfile(profile_),
restrict_urls, delete_begin_, delete_end_,
base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone,
base::Unretained(this)),
......
......@@ -32,7 +32,6 @@
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/web_history_service.h"
#include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/importer/imported_favicon_usage.h"
#include "chrome/common/url_constants.h"
......@@ -217,7 +216,6 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
HistoryService::HistoryService()
: thread_(new base::Thread(kHistoryThreadName)),
history_client_(NULL),
profile_(NULL),
backend_loaded_(false),
no_db_(false),
weak_ptr_factory_(this) {
......@@ -227,7 +225,6 @@ HistoryService::HistoryService(
history::HistoryClient* history_client, Profile* profile)
: thread_(new base::Thread(kHistoryThreadName)),
history_client_(history_client),
profile_(profile),
visitedlink_master_(new visitedlink::VisitedLinkMaster(
profile, this, true)),
backend_loaded_(false),
......@@ -1154,6 +1151,7 @@ void HistoryService::ExpireHistory(
}
void HistoryService::ExpireLocalAndRemoteHistoryBetween(
history::WebHistoryService* web_history,
const std::set<GURL>& restrict_urls,
Time begin_time,
Time end_time,
......@@ -1161,9 +1159,6 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween(
base::CancelableTaskTracker* tracker) {
// TODO(dubroy): This should be factored out into a separate class that
// dispatches deletions to the proper places.
history::WebHistoryService* web_history =
WebHistoryServiceFactory::GetForProfile(profile_);
if (web_history) {
// TODO(dubroy): This API does not yet support deletion of specific URLs.
DCHECK(restrict_urls.empty());
......
......@@ -39,9 +39,10 @@ class AndroidHistoryProviderService;
#endif
class GURL;
class HistoryService;
struct ImportedFaviconUsage;
class PageUsageRequest;
class Profile;
struct ImportedFaviconUsage;
class SkBitmap;
namespace base {
......@@ -72,6 +73,7 @@ struct KeywordSearchTermVisit;
class PageUsageData;
class URLDatabase;
class VisitFilter;
class WebHistoryService;
} // namespace history
......@@ -354,11 +356,13 @@ class HistoryService : public syncer::SyncableService,
// Removes all visits to the given URLs in the specified time range. Calls
// ExpireHistoryBetween() to delete local visits, and handles deletion of
// synced visits if appropriate.
void ExpireLocalAndRemoteHistoryBetween(const std::set<GURL>& restrict_urls,
base::Time begin_time,
base::Time end_time,
const base::Closure& callback,
base::CancelableTaskTracker* tracker);
void ExpireLocalAndRemoteHistoryBetween(
history::WebHistoryService* web_history,
const std::set<GURL>& restrict_urls,
base::Time begin_time,
base::Time end_time,
const base::Closure& callback,
base::CancelableTaskTracker* tracker);
// Processes the given |delete_directive| and sends it to the
// SyncChangeProcessor (if it exists). Returns any error resulting
......@@ -816,9 +820,6 @@ class HistoryService : public syncer::SyncableService,
// outlive |HistoryService|.
history::HistoryClient* history_client_;
// The profile, may be null when testing.
Profile* profile_;
// Used for propagating link highlighting data across renderers. May be null
// in tests.
scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment