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 @@ ...@@ -22,6 +22,7 @@
#include "chrome/browser/download/download_service_factory.h" #include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.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/io_thread.h"
#include "chrome/browser/media/media_device_id_salt.h" #include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/net/predictor.h" #include "chrome/browser/net/predictor.h"
...@@ -308,6 +309,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, ...@@ -308,6 +309,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
waiting_for_clear_history_ = true; waiting_for_clear_history_ = true;
history_service->ExpireLocalAndRemoteHistoryBetween( history_service->ExpireLocalAndRemoteHistoryBetween(
WebHistoryServiceFactory::GetForProfile(profile_),
restrict_urls, delete_begin_, delete_end_, restrict_urls, delete_begin_, delete_end_,
base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone, base::Bind(&BrowsingDataRemover::OnHistoryDeletionDone,
base::Unretained(this)), base::Unretained(this)),
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "chrome/browser/history/in_memory_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/in_memory_url_index.h"
#include "chrome/browser/history/web_history_service.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/browser/profiles/profile.h"
#include "chrome/common/importer/imported_favicon_usage.h" #include "chrome/common/importer/imported_favicon_usage.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -217,7 +216,6 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate { ...@@ -217,7 +216,6 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
HistoryService::HistoryService() HistoryService::HistoryService()
: thread_(new base::Thread(kHistoryThreadName)), : thread_(new base::Thread(kHistoryThreadName)),
history_client_(NULL), history_client_(NULL),
profile_(NULL),
backend_loaded_(false), backend_loaded_(false),
no_db_(false), no_db_(false),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
...@@ -227,7 +225,6 @@ HistoryService::HistoryService( ...@@ -227,7 +225,6 @@ HistoryService::HistoryService(
history::HistoryClient* history_client, Profile* profile) history::HistoryClient* history_client, Profile* profile)
: thread_(new base::Thread(kHistoryThreadName)), : thread_(new base::Thread(kHistoryThreadName)),
history_client_(history_client), history_client_(history_client),
profile_(profile),
visitedlink_master_(new visitedlink::VisitedLinkMaster( visitedlink_master_(new visitedlink::VisitedLinkMaster(
profile, this, true)), profile, this, true)),
backend_loaded_(false), backend_loaded_(false),
...@@ -1154,6 +1151,7 @@ void HistoryService::ExpireHistory( ...@@ -1154,6 +1151,7 @@ void HistoryService::ExpireHistory(
} }
void HistoryService::ExpireLocalAndRemoteHistoryBetween( void HistoryService::ExpireLocalAndRemoteHistoryBetween(
history::WebHistoryService* web_history,
const std::set<GURL>& restrict_urls, const std::set<GURL>& restrict_urls,
Time begin_time, Time begin_time,
Time end_time, Time end_time,
...@@ -1161,9 +1159,6 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween( ...@@ -1161,9 +1159,6 @@ void HistoryService::ExpireLocalAndRemoteHistoryBetween(
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
// TODO(dubroy): This should be factored out into a separate class that // TODO(dubroy): This should be factored out into a separate class that
// dispatches deletions to the proper places. // dispatches deletions to the proper places.
history::WebHistoryService* web_history =
WebHistoryServiceFactory::GetForProfile(profile_);
if (web_history) { if (web_history) {
// TODO(dubroy): This API does not yet support deletion of specific URLs. // TODO(dubroy): This API does not yet support deletion of specific URLs.
DCHECK(restrict_urls.empty()); DCHECK(restrict_urls.empty());
......
...@@ -39,9 +39,10 @@ class AndroidHistoryProviderService; ...@@ -39,9 +39,10 @@ class AndroidHistoryProviderService;
#endif #endif
class GURL; class GURL;
class HistoryService;
struct ImportedFaviconUsage;
class PageUsageRequest; class PageUsageRequest;
class Profile; class Profile;
struct ImportedFaviconUsage;
class SkBitmap; class SkBitmap;
namespace base { namespace base {
...@@ -72,6 +73,7 @@ struct KeywordSearchTermVisit; ...@@ -72,6 +73,7 @@ struct KeywordSearchTermVisit;
class PageUsageData; class PageUsageData;
class URLDatabase; class URLDatabase;
class VisitFilter; class VisitFilter;
class WebHistoryService;
} // namespace history } // namespace history
...@@ -354,7 +356,9 @@ class HistoryService : public syncer::SyncableService, ...@@ -354,7 +356,9 @@ class HistoryService : public syncer::SyncableService,
// Removes all visits to the given URLs in the specified time range. Calls // Removes all visits to the given URLs in the specified time range. Calls
// ExpireHistoryBetween() to delete local visits, and handles deletion of // ExpireHistoryBetween() to delete local visits, and handles deletion of
// synced visits if appropriate. // 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 begin_time,
base::Time end_time, base::Time end_time,
const base::Closure& callback, const base::Closure& callback,
...@@ -816,9 +820,6 @@ class HistoryService : public syncer::SyncableService, ...@@ -816,9 +820,6 @@ class HistoryService : public syncer::SyncableService,
// outlive |HistoryService|. // outlive |HistoryService|.
history::HistoryClient* history_client_; history::HistoryClient* history_client_;
// The profile, may be null when testing.
Profile* profile_;
// Used for propagating link highlighting data across renderers. May be null // Used for propagating link highlighting data across renderers. May be null
// in tests. // in tests.
scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_; 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