Commit 173da821 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
R=droger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#314152}
parent 241e6870
......@@ -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"
......@@ -45,6 +46,7 @@
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/domain_reliability/service.h"
#include "components/history/core/browser/web_history_service.h"
#include "components/nacl/browser/nacl_browser.h"
#include "components/nacl/browser/pnacl_host.h"
#include "components/password_manager/core/browser/password_store.h"
......@@ -308,7 +310,8 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
waiting_for_clear_history_ = true;
history_service->ExpireLocalAndRemoteHistoryBetween(
restrict_urls, delete_begin_, delete_end_,
WebHistoryServiceFactory::GetForProfile(profile_), restrict_urls,
delete_begin_, delete_end_,
base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone,
base::Unretained(this)),
&history_task_tracker_);
......
......@@ -33,7 +33,6 @@
#include "chrome/browser/history/history_backend.h"
#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_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
......@@ -1166,6 +1165,7 @@ void HistoryService::ExpireHistory(
}
void HistoryService::ExpireLocalAndRemoteHistoryBetween(
history::WebHistoryService* web_history,
const std::set<GURL>& restrict_urls,
Time begin_time,
Time end_time,
......@@ -1174,8 +1174,6 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween(
// 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());
......@@ -1188,8 +1186,7 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween(
//
// TODO(davidben): |callback| should not run until this operation completes
// too.
web_history->ExpireHistoryBetween(
restrict_urls, begin_time, end_time,
web_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time,
base::Bind(&ExpireWebHistoryComplete));
}
ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker);
......
......@@ -73,6 +73,7 @@ class VisitFilter;
struct DownloadRow;
struct HistoryAddPageArgs;
struct KeywordSearchTermVisit;
class WebHistoryService;
} // namespace history
......@@ -353,7 +354,9 @@ 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,
void ExpireLocalAndRemoteHistoryBetween(
history::WebHistoryService* web_history,
const std::set<GURL>& restrict_urls,
base::Time begin_time,
base::Time end_time,
const base::Closure& callback,
......
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