Commit d7f7f753 authored by rlp@chromium.org's avatar rlp@chromium.org

Remove last references to profile->GetHistory() and profile->GetBookmarkModel().

BUG=97804, 112525
TEST=existing unittests

Review URL: https://chromiumcodereview.appspot.com/10795056

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150483 0039d316-1c4b-4281-b951-d872f2087c98
parent 2e41a5fe
...@@ -219,19 +219,6 @@ GAIAInfoUpdateService* OffTheRecordProfileImpl::GetGAIAInfoUpdateService() { ...@@ -219,19 +219,6 @@ GAIAInfoUpdateService* OffTheRecordProfileImpl::GetGAIAInfoUpdateService() {
return NULL; return NULL;
} }
HistoryService* OffTheRecordProfileImpl::GetHistoryService(
ServiceAccessType sat) {
if (sat == EXPLICIT_ACCESS)
return profile_->GetHistoryService(sat);
NOTREACHED() << "This profile is OffTheRecord";
return NULL;
}
HistoryService* OffTheRecordProfileImpl::GetHistoryServiceWithoutCreating() {
return profile_->GetHistoryServiceWithoutCreating();
}
FaviconService* OffTheRecordProfileImpl::GetFaviconService( FaviconService* OffTheRecordProfileImpl::GetFaviconService(
ServiceAccessType sat) { ServiceAccessType sat) {
if (sat == EXPLICIT_ACCESS) if (sat == EXPLICIT_ACCESS)
...@@ -350,10 +337,6 @@ quota::SpecialStoragePolicy* ...@@ -350,10 +337,6 @@ quota::SpecialStoragePolicy*
return GetExtensionSpecialStoragePolicy(); return GetExtensionSpecialStoragePolicy();
} }
BookmarkModel* OffTheRecordProfileImpl::GetBookmarkModel() {
return profile_->GetBookmarkModel();
}
ProtocolHandlerRegistry* OffTheRecordProfileImpl::GetProtocolHandlerRegistry() { ProtocolHandlerRegistry* OffTheRecordProfileImpl::GetProtocolHandlerRegistry() {
return profile_->GetProtocolHandlerRegistry(); return profile_->GetProtocolHandlerRegistry();
} }
......
...@@ -46,8 +46,6 @@ class OffTheRecordProfileImpl : public Profile, ...@@ -46,8 +46,6 @@ class OffTheRecordProfileImpl : public Profile,
virtual ExtensionSpecialStoragePolicy* virtual ExtensionSpecialStoragePolicy*
GetExtensionSpecialStoragePolicy() OVERRIDE; GetExtensionSpecialStoragePolicy() OVERRIDE;
virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE;
virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE;
virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE;
virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE;
virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE; virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE;
virtual policy::PolicyService* GetPolicyService() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE;
...@@ -59,7 +57,6 @@ class OffTheRecordProfileImpl : public Profile, ...@@ -59,7 +57,6 @@ class OffTheRecordProfileImpl : public Profile,
const std::string& app_id) OVERRIDE; const std::string& app_id) OVERRIDE;
virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
virtual bool IsSameProfile(Profile* profile) OVERRIDE; virtual bool IsSameProfile(Profile* profile) OVERRIDE;
virtual Time GetStartTime() const OVERRIDE; virtual Time GetStartTime() const OVERRIDE;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
class BookmarkModel;
class ChromeAppCacheService; class ChromeAppCacheService;
class ChromeURLDataManager; class ChromeURLDataManager;
class ExtensionProcessManager; class ExtensionProcessManager;
...@@ -24,7 +23,6 @@ class ExtensionService; ...@@ -24,7 +23,6 @@ class ExtensionService;
class ExtensionSpecialStoragePolicy; class ExtensionSpecialStoragePolicy;
class FaviconService; class FaviconService;
class GAIAInfoUpdateService; class GAIAInfoUpdateService;
class HistoryService;
class HostContentSettingsMap; class HostContentSettingsMap;
class PasswordStore; class PasswordStore;
class PrefService; class PrefService;
...@@ -233,23 +231,6 @@ class Profile : public content::BrowserContext { ...@@ -233,23 +231,6 @@ class Profile : public content::BrowserContext {
// Accessor. The instance is created upon first access. // Accessor. The instance is created upon first access.
virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() = 0; virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() = 0;
// Retrieves a pointer to the HistoryService associated with this
// profile. The HistoryService is lazily created the first time
// that this method is called.
//
// Although HistoryService is refcounted, this will not addref, and callers
// do not need to do any reference counting as long as they keep the pointer
// only for the local scope (which they should do anyway since the browser
// process may decide to shut down).
//
// |access| defines what the caller plans to do with the service. See
// the ServiceAccessType definition above.
virtual HistoryService* GetHistoryService(ServiceAccessType access) = 0;
// Similar to GetHistoryService(), but won't create the history service if it
// doesn't already exist.
virtual HistoryService* GetHistoryServiceWithoutCreating() = 0;
// Returns the UserCloudPolicyManager (if any) that handles this profile's // Returns the UserCloudPolicyManager (if any) that handles this profile's
// connection to the cloud-based management service. // connection to the cloud-based management service.
virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() = 0; virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() = 0;
...@@ -284,9 +265,6 @@ class Profile : public content::BrowserContext { ...@@ -284,9 +265,6 @@ class Profile : public content::BrowserContext {
// Returns the Hostname <-> Content settings map for this profile. // Returns the Hostname <-> Content settings map for this profile.
virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0;
// Returns the BookmarkModel, creating if not yet created.
virtual BookmarkModel* GetBookmarkModel() = 0;
// Returns the ProtocolHandlerRegistry, creating if not yet created. // Returns the ProtocolHandlerRegistry, creating if not yet created.
// TODO(smckay): replace this with access via ProtocolHandlerRegistryFactory. // TODO(smckay): replace this with access via ProtocolHandlerRegistryFactory.
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() = 0;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/background/background_contents_service_factory.h" #include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_plugin_service_filter.h" #include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/cookie_settings.h"
...@@ -42,8 +41,6 @@ ...@@ -42,8 +41,6 @@
#include "chrome/browser/extensions/user_script_master.h" #include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/shortcuts_backend.h" #include "chrome/browser/history/shortcuts_backend.h"
#include "chrome/browser/history/top_sites.h" #include "chrome/browser/history/top_sites.h"
#include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/instant/instant_controller.h"
...@@ -514,13 +511,6 @@ ProfileImpl::~ProfileImpl() { ...@@ -514,13 +511,6 @@ ProfileImpl::~ProfileImpl() {
ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
// The HistoryService maintains threads for background processing. Its
// possible each thread still has tasks on it that have increased the ref
// count of the service. In such a situation, when we decrement the refcount,
// it won't be 0, and the threads/databases aren't properly shut down. By
// explicitly calling Cleanup/Shutdown we ensure the databases are properly
// closed.
if (top_sites_.get()) if (top_sites_.get())
top_sites_->Shutdown(); top_sites_->Shutdown();
...@@ -781,14 +771,6 @@ GAIAInfoUpdateService* ProfileImpl::GetGAIAInfoUpdateService() { ...@@ -781,14 +771,6 @@ GAIAInfoUpdateService* ProfileImpl::GetGAIAInfoUpdateService() {
return gaia_info_update_service_.get(); return gaia_info_update_service_.get();
} }
HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) {
return HistoryServiceFactory::GetForProfile(this, sat).get();
}
HistoryService* ProfileImpl::GetHistoryServiceWithoutCreating() {
return HistoryServiceFactory::GetForProfileWithoutCreating(this).get();
}
DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() {
return DownloadServiceFactory::GetForProfile(this)-> return DownloadServiceFactory::GetForProfile(this)->
GetDownloadManagerDelegate(); GetDownloadManagerDelegate();
...@@ -805,10 +787,6 @@ quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { ...@@ -805,10 +787,6 @@ quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() {
return GetExtensionSpecialStoragePolicy(); return GetExtensionSpecialStoragePolicy();
} }
BookmarkModel* ProfileImpl::GetBookmarkModel() {
return BookmarkModelFactory::GetForProfile(this);
}
ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() { ProtocolHandlerRegistry* ProfileImpl::GetProtocolHandlerRegistry() {
// TODO(smckay): Update all existing callers to use // TODO(smckay): Update all existing callers to use
// ProtocolHandlerRegistryFactory. Once that's done, this method // ProtocolHandlerRegistryFactory. Once that's done, this method
......
...@@ -85,8 +85,6 @@ class ProfileImpl : public Profile, ...@@ -85,8 +85,6 @@ class ProfileImpl : public Profile,
GetExtensionSpecialStoragePolicy() OVERRIDE; GetExtensionSpecialStoragePolicy() OVERRIDE;
virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE;
virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE;
virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE;
virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE;
virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE; virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE;
virtual policy::PolicyService* GetPolicyService() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE;
virtual PrefService* GetPrefs() OVERRIDE; virtual PrefService* GetPrefs() OVERRIDE;
...@@ -97,7 +95,6 @@ class ProfileImpl : public Profile, ...@@ -97,7 +95,6 @@ class ProfileImpl : public Profile,
const std::string& app_id) OVERRIDE; const std::string& app_id) OVERRIDE;
virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
virtual bool IsSameProfile(Profile* profile) OVERRIDE; virtual bool IsSameProfile(Profile* profile) OVERRIDE;
virtual base::Time GetStartTime() const OVERRIDE; virtual base::Time GetStartTime() const OVERRIDE;
......
...@@ -14,9 +14,6 @@ class ProfileMock : public TestingProfile { ...@@ -14,9 +14,6 @@ class ProfileMock : public TestingProfile {
ProfileMock(); ProfileMock();
virtual ~ProfileMock(); virtual ~ProfileMock();
MOCK_METHOD0(GetBookmarkModel, BookmarkModel*());
MOCK_METHOD1(GetHistoryService, HistoryService*(ServiceAccessType access));
MOCK_METHOD0(GetHistoryServiceWithoutCreating, HistoryService*());
MOCK_METHOD1(GetPasswordStore, PasswordStore* (ServiceAccessType access)); MOCK_METHOD1(GetPasswordStore, PasswordStore* (ServiceAccessType access));
}; };
......
...@@ -420,15 +420,19 @@ void TestingProfile::CreateWebDataService() { ...@@ -420,15 +420,19 @@ void TestingProfile::CreateWebDataService() {
} }
void TestingProfile::BlockUntilBookmarkModelLoaded() { void TestingProfile::BlockUntilBookmarkModelLoaded() {
DCHECK(GetBookmarkModel()); // Only get the bookmark model if it actually exists since the caller of the
if (GetBookmarkModel()->IsLoaded()) // test should explicitly call CreateBookmarkModel to build it.
BookmarkModel* bookmark_model =
BookmarkModelFactory::GetForProfileIfExists(this);
DCHECK(bookmark_model);
if (bookmark_model->IsLoaded())
return; return;
base::RunLoop run_loop; base::RunLoop run_loop;
BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
GetBookmarkModel()->AddObserver(&observer); bookmark_model->AddObserver(&observer);
run_loop.Run(); run_loop.Run();
GetBookmarkModel()->RemoveObserver(&observer); bookmark_model->RemoveObserver(&observer);
DCHECK(GetBookmarkModel()->IsLoaded()); DCHECK(bookmark_model->IsLoaded());
} }
// TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
...@@ -436,7 +440,7 @@ void TestingProfile::BlockUntilTopSitesLoaded() { ...@@ -436,7 +440,7 @@ void TestingProfile::BlockUntilTopSitesLoaded() {
content::WindowedNotificationObserver top_sites_loaded_observer( content::WindowedNotificationObserver top_sites_loaded_observer(
chrome::NOTIFICATION_TOP_SITES_LOADED, chrome::NOTIFICATION_TOP_SITES_LOADED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) if (!HistoryServiceFactory::GetForProfile(this, Profile::EXPLICIT_ACCESS))
GetTopSites()->HistoryLoaded(); GetTopSites()->HistoryLoaded();
top_sites_loaded_observer.Wait(); top_sites_loaded_observer.Wait();
} }
...@@ -520,14 +524,6 @@ FaviconService* TestingProfile::GetFaviconService(ServiceAccessType access) { ...@@ -520,14 +524,6 @@ FaviconService* TestingProfile::GetFaviconService(ServiceAccessType access) {
return favicon_service_.get(); return favicon_service_.get();
} }
HistoryService* TestingProfile::GetHistoryService(ServiceAccessType access) {
return HistoryServiceFactory::GetForProfileIfExists(this, access);
}
HistoryService* TestingProfile::GetHistoryServiceWithoutCreating() {
return HistoryServiceFactory::GetForProfileWithoutCreating(this);
}
net::CookieMonster* TestingProfile::GetCookieMonster() { net::CookieMonster* TestingProfile::GetCookieMonster() {
if (!GetRequestContext()) if (!GetRequestContext())
return NULL; return NULL;
...@@ -706,10 +702,6 @@ bool TestingProfile::DidLastSessionExitCleanly() { ...@@ -706,10 +702,6 @@ bool TestingProfile::DidLastSessionExitCleanly() {
return last_session_exited_cleanly_; return last_session_exited_cleanly_;
} }
BookmarkModel* TestingProfile::GetBookmarkModel() {
return BookmarkModelFactory::GetForProfileIfExists(this);
}
bool TestingProfile::IsSameProfile(Profile *p) { bool TestingProfile::IsSameProfile(Profile *p) {
return this == p; return this == p;
} }
......
...@@ -217,8 +217,6 @@ class TestingProfile : public Profile { ...@@ -217,8 +217,6 @@ class TestingProfile : public Profile {
virtual ExtensionSpecialStoragePolicy* virtual ExtensionSpecialStoragePolicy*
GetExtensionSpecialStoragePolicy() OVERRIDE; GetExtensionSpecialStoragePolicy() OVERRIDE;
virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE;
virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE;
virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE;
// The CookieMonster will only be returned if a Context has been created. Do // The CookieMonster will only be returned if a Context has been created. Do
// this by calling CreateRequestContext(). See the note at GetRequestContext // this by calling CreateRequestContext(). See the note at GetRequestContext
// for more information. // for more information.
...@@ -258,7 +256,6 @@ class TestingProfile : public Profile { ...@@ -258,7 +256,6 @@ class TestingProfile : public Profile {
std::wstring* output_string) {} std::wstring* output_string) {}
virtual void MergeResourceInteger(int message_id, int* output_value) {} virtual void MergeResourceInteger(int message_id, int* output_value) {}
virtual void MergeResourceBoolean(int message_id, bool* output_value) {} virtual void MergeResourceBoolean(int message_id, bool* output_value) {}
virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual bool IsSameProfile(Profile *p) OVERRIDE; virtual bool IsSameProfile(Profile *p) OVERRIDE;
virtual base::Time GetStartTime() const OVERRIDE; virtual base::Time GetStartTime() const OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
......
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