0

Move ServiceAccessType into //components/keyed_service

The ServiceAccessType is only used when interacting with
KeyedServiceFactories so move it into the keyed_service
components.

Turn the enumeration into a "class enum" so that the value
names don't leak into the global namespace.

Fix client code and add missing #include after changing the
chrome/browser/profiles/profile.h #include into forward
declaration in the KeyedServiceFactories headers.

Usage of the enumeration was fixed using tools/git/mffr.py.

BUG=419366

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

Cr-Commit-Position: refs/heads/master@{#310979}
This commit is contained in:
sdefresne
2015-01-10 02:10:04 -08:00
committed by Commit bot
parent 6fd7d48e8d
commit e9ea3c2ead
132 changed files with 428 additions and 419 deletions
chrome
browser
android
autocomplete
autofill
bookmarks
browsing_data
custom_home_pages_table_model.cc
download
extensions
favicon
history
importer
jumplist_win.cc
notifications
password_manager
predictors
prerender
profile_resetter
profiles
safe_browsing
search_engines
signin
ssl
supervised_user
sync
ui
webdata
test
components

@@ -116,7 +116,7 @@ jboolean FaviconHelper::GetLocalFaviconImageForURL(
return false; return false;
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(favicon_service); DCHECK(favicon_service);
if (!favicon_service) if (!favicon_service)
return false; return false;
@@ -152,7 +152,7 @@ void FaviconHelper::GetLargestRawFaviconForUrl(
return; return;
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(favicon_service); DCHECK(favicon_service);
if (!favicon_service) if (!favicon_service)
return; return;

@@ -1168,13 +1168,13 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj)
bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_);
top_sites_ = profile_->GetTopSites(); top_sites_ = profile_->GetTopSites();
favicon_service_ = FaviconServiceFactory::GetForProfile( favicon_service_ = FaviconServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS), profile_, ServiceAccessType::EXPLICIT_ACCESS),
service_.reset(new AndroidHistoryProviderService(profile_)); service_.reset(new AndroidHistoryProviderService(profile_));
// Registers the notifications we are interested. // Registers the notifications we are interested.
bookmark_model_->AddObserver(this); bookmark_model_->AddObserver(this);
history_service_observer_.Add( history_service_observer_.Add(HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)); profile_, ServiceAccessType::EXPLICIT_ACCESS));
notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
notification_registrar_.Add(this, notification_registrar_.Add(this,

@@ -18,6 +18,7 @@
#include "chrome/browser/android/tab_android.h" #include "chrome/browser/android/tab_android.h"
#include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/render_messages.h" #include "chrome/common/render_messages.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
@@ -385,7 +386,7 @@ void ShortcutHelper::AddShortcutUsingFavicon() {
icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON |
favicon_base::TOUCH_ICON); favicon_base::TOUCH_ICON);
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
// Using favicon if its size is not smaller than platform required size, // Using favicon if its size is not smaller than platform required size,
// otherwise using the largest icon among all avaliable icons. // otherwise using the largest icon among all avaliable icons.

@@ -129,9 +129,8 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) {
WaitForTemplateURLServiceToLoad(); WaitForTemplateURLServiceToLoad();
// The results depend on the history backend being loaded. Make sure it is // The results depend on the history backend being loaded. Make sure it is
// loaded so that the autocomplete results are consistent. // loaded so that the autocomplete results are consistent.
ui_test_utils::WaitForHistoryToLoad( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(browser()->profile(), browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS));
Profile::EXPLICIT_ACCESS));
LocationBar* location_bar = GetLocationBar(); LocationBar* location_bar = GetLocationBar();
OmniboxView* omnibox_view = location_bar->GetOmniboxView(); OmniboxView* omnibox_view = location_bar->GetOmniboxView();

@@ -66,15 +66,16 @@ void ChromeAutocompleteProviderClient::Classify(
} }
history::URLDatabase* ChromeAutocompleteProviderClient::InMemoryDatabase() { history::URLDatabase* ChromeAutocompleteProviderClient::InMemoryDatabase() {
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
return history_service ? history_service->InMemoryDatabase() : NULL; return history_service ? history_service->InMemoryDatabase() : NULL;
} }
void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory( void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory(
history::KeywordID keyword_id, history::KeywordID keyword_id,
const base::string16& term) { const base::string16& term) {
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) HistoryServiceFactory::GetForProfile(profile_,
ServiceAccessType::EXPLICIT_ACCESS)
->DeleteMatchingURLsForKeyword(keyword_id, term); ->DeleteMatchingURLsForKeyword(keyword_id, term);
} }

@@ -24,8 +24,8 @@ void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) {
DCHECK(profile_); DCHECK(profile_);
DCHECK(match.deletable); DCHECK(match.deletable);
HistoryService* const history_service = HistoryService* const history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
// Delete the underlying URL along with all its visits from the history DB. // Delete the underlying URL along with all its visits from the history DB.
// The resulting HISTORY_URLS_DELETED notification will also cause all caches // The resulting HISTORY_URLS_DELETED notification will also cause all caches

@@ -116,8 +116,8 @@ void HistoryQuickProvider::DoAutocomplete() {
autocomplete_input_.parts().path.is_nonempty()); autocomplete_input_.parts().path.is_nonempty());
if (can_have_url_what_you_typed_match_first) { if (can_have_url_what_you_typed_match_first) {
HistoryService* const history_service = HistoryService* const history_service =
HistoryServiceFactory::GetForProfile(profile_, HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
// We expect HistoryService to be available. In case it's not, // We expect HistoryService to be available. In case it's not,
// (e.g., due to Profile corruption) we let HistoryQuick provider // (e.g., due to Profile corruption) we let HistoryQuick provider
// completions (which may be available because it's a different // completions (which may be available because it's a different
@@ -292,8 +292,8 @@ history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() {
if (index_for_testing_.get()) if (index_for_testing_.get())
return index_for_testing_.get(); return index_for_testing_.get();
HistoryService* const history_service = HistoryService* const history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history_service) if (!history_service)
return NULL; return NULL;

@@ -129,10 +129,9 @@ class HistoryQuickProviderTest : public testing::Test {
Profile* profile = static_cast<Profile*>(context); Profile* profile = static_cast<Profile*>(context);
return new TemplateURLService( return new TemplateURLService(
profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL,
scoped_ptr<TemplateURLServiceClient>( scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
new ChromeTemplateURLServiceClient( HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS))),
profile, Profile::EXPLICIT_ACCESS))),
NULL, NULL, base::Closure()); NULL, NULL, base::Closure());
} }
@@ -186,9 +185,8 @@ void HistoryQuickProviderTest::SetUp() {
bookmarks::test::WaitForBookmarkModelToLoad( bookmarks::test::WaitForBookmarkModelToLoad(
BookmarkModelFactory::GetForProfile(profile_.get())); BookmarkModelFactory::GetForProfile(profile_.get()));
profile_->BlockUntilHistoryIndexIsRefreshed(); profile_->BlockUntilHistoryIndexIsRefreshed();
history_service_ = history_service_ = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_.get(), profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
EXPECT_TRUE(history_service_); EXPECT_TRUE(history_service_);
provider_ = new HistoryQuickProvider(profile_.get()); provider_ = new HistoryQuickProvider(profile_.get());
TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(

@@ -528,8 +528,8 @@ void HistoryURLProvider::Start(const AutocompleteInput& input,
// We'll need the history service to run both passes, so try to obtain it. // We'll need the history service to run both passes, so try to obtain it.
if (!profile_) if (!profile_)
return; return;
HistoryService* const history_service = HistoryService* const history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history_service) if (!history_service)
return; return;

@@ -175,10 +175,9 @@ class HistoryURLProviderTest : public testing::Test,
Profile* profile = static_cast<Profile*>(context); Profile* profile = static_cast<Profile*>(context);
return new TemplateURLService( return new TemplateURLService(
profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL,
scoped_ptr<TemplateURLServiceClient>( scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
new ChromeTemplateURLServiceClient( HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS))),
profile, Profile::EXPLICIT_ACCESS))),
NULL, NULL, base::Closure()); NULL, NULL, base::Closure());
} }
@@ -259,7 +258,7 @@ bool HistoryURLProviderTest::SetUpImpl(bool no_db) {
} }
profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko"); profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko");
history_service_ = HistoryServiceFactory::GetForProfile( history_service_ = HistoryServiceFactory::GetForProfile(
profile_.get(), Profile::EXPLICIT_ACCESS); profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
autocomplete_ = new HistoryURLProvider(this, profile_.get()); autocomplete_ = new HistoryURLProvider(this, profile_.get());
TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(

@@ -441,9 +441,8 @@ void SearchProviderTest::QueryForInputAndWaitForFetcherResponses(
GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url,
base::string16 term, base::string16 term,
int visit_count) { int visit_count) {
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(&profile_, &profile_, ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
GURL search(t_url->url_ref().ReplaceSearchTerms( GURL search(t_url->url_ref().ReplaceSearchTerms(
TemplateURLRef::SearchTermsArgs(term), TemplateURLRef::SearchTermsArgs(term),
TemplateURLServiceFactory::GetForProfile( TemplateURLServiceFactory::GetForProfile(
@@ -739,9 +738,11 @@ TEST_F(SearchProviderTest, DontAutocompleteURLLikeTerms) {
ASCIIToUTF16("docs.google.com"), 1); ASCIIToUTF16("docs.google.com"), 1);
// Add the term as a url. // Add the term as a url.
HistoryServiceFactory::GetForProfile(&profile_, Profile::EXPLICIT_ACCESS)-> HistoryServiceFactory::GetForProfile(&profile_,
AddPageWithDetails(GURL("http://docs.google.com"), base::string16(), 1, 1, ServiceAccessType::EXPLICIT_ACCESS)
base::Time::Now(), false, history::SOURCE_BROWSED); ->AddPageWithDetails(GURL("http://docs.google.com"), base::string16(), 1,
1, base::Time::Now(), false,
history::SOURCE_BROWSED);
profile_.BlockUntilHistoryProcessesPendingRequests(); profile_.BlockUntilHistoryProcessesPendingRequests();
AutocompleteMatch wyt_match; AutocompleteMatch wyt_match;

@@ -109,8 +109,8 @@ void ShortcutsProvider::DeleteMatch(const AutocompleteMatch& match) {
// Delete the match from the history DB. This will eventually result in a // Delete the match from the history DB. This will eventually result in a
// second call to DeleteShortcutsWithURL(), which is harmless. // second call to DeleteShortcutsWithURL(), which is harmless.
HistoryService* const history_service = HistoryService* const history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(history_service); DCHECK(history_service);
history_service->DeleteURL(url); history_service->DeleteURL(url);
} }

@@ -44,7 +44,7 @@ KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor(
PersonalDataManager* service = PersonalDataManager* service =
new PersonalDataManager(g_browser_process->GetApplicationLocale()); new PersonalDataManager(g_browser_process->GetApplicationLocale());
service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile( service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS), profile, ServiceAccessType::EXPLICIT_ACCESS),
profile->GetPrefs(), profile->GetPrefs(),
profile->IsOffTheRecord()); profile->IsOffTheRecord());
return service; return service;

@@ -458,7 +458,7 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() {
URLFaviconMap::const_iterator iter = favicons_map_->find(url); URLFaviconMap::const_iterator iter = favicons_map_->find(url);
if (favicons_map_->end() == iter) { if (favicons_map_->end() == iter) {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
favicon_service->GetRawFaviconForPageURL( favicon_service->GetRawFaviconForPageURL(
GURL(url), GURL(url),
favicon_base::FAVICON, favicon_base::FAVICON,

@@ -196,12 +196,12 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
const BookmarkNode* f1 = model->AddFolder( const BookmarkNode* f1 = model->AddFolder(
model->bookmark_bar_node(), 0, f1_title); model->bookmark_bar_node(), 0, f1_title);
model->AddURLWithCreationTimeAndMetaInfo(f1, 0, url1_title, url1, t1, NULL); model->AddURLWithCreationTimeAndMetaInfo(f1, 0, url1_title, url1, t1, NULL);
HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS)-> HistoryServiceFactory::GetForProfile(&profile,
AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED); ServiceAccessType::EXPLICIT_ACCESS)
FaviconServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) ->AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED);
->SetFavicons(url1, FaviconServiceFactory::GetForProfile(&profile,
url1_favicon, ServiceAccessType::EXPLICIT_ACCESS)
favicon_base::FAVICON, ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON,
gfx::Image::CreateFrom1xBitmap(bitmap)); gfx::Image::CreateFrom1xBitmap(bitmap));
const BookmarkNode* f2 = model->AddFolder(f1, 1, f2_title); const BookmarkNode* f2 = model->AddFolder(f1, 1, f2_title);
model->AddURLWithCreationTimeAndMetaInfo(f2, 0, url2_title, url2, t2, NULL); model->AddURLWithCreationTimeAndMetaInfo(f2, 0, url2_title, url2, t2, NULL);
@@ -234,7 +234,8 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
run_loop.Run(); run_loop.Run();
// Clear favicon so that it would be read from file. // Clear favicon so that it would be read from file.
FaviconServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) FaviconServiceFactory::GetForProfile(&profile,
ServiceAccessType::EXPLICIT_ACCESS)
->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image()); ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image());
// Read the bookmarks back in. // Read the bookmarks back in.

@@ -102,8 +102,8 @@ ChromeBookmarkClient::GetFaviconImageForPageURL(
favicon_base::IconType type, favicon_base::IconType type,
const favicon_base::FaviconImageCallback& callback, const favicon_base::FaviconImageCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!favicon_service) if (!favicon_service)
return base::CancelableTaskTracker::kBadTaskId; return base::CancelableTaskTracker::kBadTaskId;
if (type == favicon_base::FAVICON) { if (type == favicon_base::FAVICON) {

@@ -281,7 +281,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { if ((remove_mask & REMOVE_HISTORY) && may_delete_history) {
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
std::set<GURL> restrict_urls; std::set<GURL> restrict_urls;
if (!remove_origin_.is_empty()) if (!remove_origin_.is_empty())
@@ -383,7 +383,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
// history, so clear them as well. // history, so clear them as well.
scoped_refptr<autofill::AutofillWebDataService> web_data_service = scoped_refptr<autofill::AutofillWebDataService> web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (web_data_service.get()) { if (web_data_service.get()) {
waiting_for_clear_autofill_origin_urls_ = true; waiting_for_clear_autofill_origin_urls_ = true;
web_data_service->RemoveOriginURLsModifiedBetween( web_data_service->RemoveOriginURLsModifiedBetween(
@@ -544,8 +544,8 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
if (remove_mask & REMOVE_PASSWORDS) { if (remove_mask & REMOVE_PASSWORDS) {
content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords"));
password_manager::PasswordStore* password_store = password_manager::PasswordStore* password_store =
PasswordStoreFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) PasswordStoreFactory::GetForProfile(
.get(); profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
if (password_store) if (password_store)
password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_);
@@ -555,7 +555,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill"));
scoped_refptr<autofill::AutofillWebDataService> web_data_service = scoped_refptr<autofill::AutofillWebDataService> web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (web_data_service.get()) { if (web_data_service.get()) {
waiting_for_clear_form_ = true; waiting_for_clear_form_ = true;

@@ -383,7 +383,7 @@ class RemoveHistoryTester {
if (!profile->CreateHistoryService(true, false)) if (!profile->CreateHistoryService(true, false))
return false; return false;
history_service_ = HistoryServiceFactory::GetForProfile( history_service_ = HistoryServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
return true; return true;
} }

@@ -220,8 +220,8 @@ void CustomHomePagesTableModel::SetObserver(ui::TableModelObserver* observer) {
} }
void CustomHomePagesTableModel::LoadTitle(Entry* entry) { void CustomHomePagesTableModel::LoadTitle(Entry* entry) {
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
entry->task_id = history_service->QueryURL( entry->task_id = history_service->QueryURL(
entry->url, entry->url,

@@ -251,7 +251,7 @@ class DownloadsHistoryDataCollector {
bool WaitForDownloadInfo( bool WaitForDownloadInfo(
scoped_ptr<std::vector<history::DownloadRow> >* results) { scoped_ptr<std::vector<history::DownloadRow> >* results) {
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(hs); DCHECK(hs);
hs->QueryDownloads( hs->QueryDownloads(
base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete,
@@ -1894,10 +1894,11 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PRE_DownloadTest_History) {
HistoryObserver observer(browser()->profile()); HistoryObserver observer(browser()->profile());
DownloadAndWait(browser(), download_url); DownloadAndWait(browser(), download_url);
observer.WaitForStored(); observer.WaitForStored();
HistoryServiceFactory::GetForProfile( HistoryServiceFactory::GetForProfile(browser()->profile(),
browser()->profile(), Profile::IMPLICIT_ACCESS)->FlushForTest( ServiceAccessType::IMPLICIT_ACCESS)
base::Bind(&base::MessageLoop::Quit, ->FlushForTest(base::Bind(
base::Unretained(base::MessageLoop::current()->current()))); &base::MessageLoop::Quit,
base::Unretained(base::MessageLoop::current()->current())));
content::RunMessageLoop(); content::RunMessageLoop();
} }

@@ -57,7 +57,7 @@ ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() {
if (!profile_->IsOffTheRecord()) { if (!profile_->IsOffTheRecord()) {
HistoryService* history = HistoryServiceFactory::GetForProfile( HistoryService* history = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
history->GetNextDownloadId( history->GetNextDownloadId(
manager_delegate_->GetDownloadIdReceiverCallback()); manager_delegate_->GetDownloadIdReceiverCallback());
download_history_.reset(new DownloadHistory( download_history_.reset(new DownloadHistory(

@@ -7,6 +7,7 @@
#include "chrome/browser/download/download_service.h" #include "chrome/browser/download/download_service.h"
#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
// static // static

@@ -592,7 +592,7 @@ DownloadTargetDeterminer::Result
// HistoryServiceFactory redirects incognito profiles to on-record // HistoryServiceFactory redirects incognito profiles to on-record
// profiles. There's no history for on-record profiles in unit_tests. // profiles. There's no history for on-record profiles in unit_tests.
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
if (history_service && download_->GetReferrerUrl().is_valid()) { if (history_service && download_->GetReferrerUrl().is_valid()) {
history_service->GetVisibleVisitCountToHost( history_service->GetVisibleVisitCountToHost(

@@ -1088,8 +1088,8 @@ TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_VisitedReferrer) {
// midnight. // midnight.
base::Time time_of_visit( base::Time time_of_visit(
base::Time::Now().LocalMidnight() - base::TimeDelta::FromSeconds(10)); base::Time::Now().LocalMidnight() - base::TimeDelta::FromSeconds(10));
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); profile(), ServiceAccessType::EXPLICIT_ACCESS);
ASSERT_TRUE(history_service); ASSERT_TRUE(history_service);
history_service->AddPage(url, time_of_visit, history::SOURCE_BROWSED); history_service->AddPage(url, time_of_visit, history::SOURCE_BROWSED);

@@ -226,8 +226,8 @@ void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() {
void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) {
Profile* profile = Profile::FromBrowserContext(browser_context_); Profile* profile = Profile::FromBrowserContext(browser_context_);
history_event_router_.reset(new HistoryEventRouter( history_event_router_.reset(new HistoryEventRouter(
profile, profile, HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS))); profile, ServiceAccessType::EXPLICIT_ACCESS)));
EventRouter::Get(browser_context_)->UnregisterObserver(this); EventRouter::Get(browser_context_)->UnregisterObserver(this);
} }
@@ -294,7 +294,7 @@ bool HistoryGetVisitsFunction::RunAsyncImpl() {
return false; return false;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->QueryURL(url, hs->QueryURL(url,
true, // Retrieve full history of a URL. true, // Retrieve full history of a URL.
base::Bind(&HistoryGetVisitsFunction::QueryComplete, base::Bind(&HistoryGetVisitsFunction::QueryComplete,
@@ -339,7 +339,7 @@ bool HistorySearchFunction::RunAsyncImpl() {
options.max_count = *params->query.max_results; options.max_count = *params->query.max_results;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->QueryHistory(search_text, hs->QueryHistory(search_text,
options, options,
base::Bind(&HistorySearchFunction::SearchComplete, base::Bind(&HistorySearchFunction::SearchComplete,
@@ -373,7 +373,7 @@ bool HistoryAddUrlFunction::RunAsync() {
return false; return false;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION); hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION);
SendResponse(true); SendResponse(true);
@@ -392,7 +392,7 @@ bool HistoryDeleteUrlFunction::RunAsync() {
return false; return false;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->DeleteURL(url); hs->DeleteURL(url);
// Also clean out from the activity log. If the activity log testing flag is // Also clean out from the activity log. If the activity log testing flag is
@@ -421,7 +421,7 @@ bool HistoryDeleteRangeFunction::RunAsyncImpl() {
std::set<GURL> restrict_urls; std::set<GURL> restrict_urls;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->ExpireHistoryBetween( hs->ExpireHistoryBetween(
restrict_urls, restrict_urls,
start_time, start_time,
@@ -451,7 +451,7 @@ bool HistoryDeleteAllFunction::RunAsyncImpl() {
std::set<GURL> restrict_urls; std::set<GURL> restrict_urls;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
hs->ExpireHistoryBetween( hs->ExpireHistoryBetween(
restrict_urls, restrict_urls,
base::Time(), // Unbounded beginning... base::Time(), // Unbounded beginning...

@@ -246,7 +246,7 @@ ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate(
const std::string& title, const std::string& title,
const GURL& launch_url) const { const GURL& launch_url) const {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
Profile::FromBrowserContext(context), Profile::EXPLICIT_ACCESS); Profile::FromBrowserContext(context), ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(favicon_service); DCHECK(favicon_service);
ChromeAppForLinkDelegate* delegate = new ChromeAppForLinkDelegate; ChromeAppForLinkDelegate* delegate = new ChromeAppForLinkDelegate;

@@ -17,8 +17,8 @@ ChromeFaviconClient::~ChromeFaviconClient() {
} }
FaviconService* ChromeFaviconClient::GetFaviconService() { FaviconService* ChromeFaviconClient::GetFaviconService() {
return FaviconServiceFactory::GetForProfile(profile_, return FaviconServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
} }
bool ChromeFaviconClient::IsBookmarked(const GURL& url) { bool ChromeFaviconClient::IsBookmarked(const GURL& url) {

@@ -1517,7 +1517,7 @@ TEST_F(FaviconHandlerTest, UnableToDownloadFavicon) {
profile, BuildHistoryService); profile, BuildHistoryService);
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
FaviconTabHelper::CreateForWebContents(web_contents()); FaviconTabHelper::CreateForWebContents(web_contents());
FaviconTabHelper* favicon_tab_helper = FaviconTabHelper* favicon_tab_helper =

@@ -78,9 +78,9 @@ std::vector<int> GetPixelSizesForFaviconScales(int size_in_dip) {
} // namespace } // namespace
FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client)
: history_service_( : history_service_(HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, profile,
Profile::EXPLICIT_ACCESS)), ServiceAccessType::EXPLICIT_ACCESS)),
profile_(profile), profile_(profile),
favicon_client_(favicon_client) { favicon_client_(favicon_client) {
} }

@@ -10,15 +10,16 @@
#include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/favicon/favicon_service.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/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
// static // static
FaviconService* FaviconServiceFactory::GetForProfile( FaviconService* FaviconServiceFactory::GetForProfile(Profile* profile,
Profile* profile, Profile::ServiceAccessType sat) { ServiceAccessType sat) {
if (!profile->IsOffTheRecord()) { if (!profile->IsOffTheRecord()) {
return static_cast<FaviconService*>( return static_cast<FaviconService*>(
GetInstance()->GetServiceForBrowserContext(profile, true)); GetInstance()->GetServiceForBrowserContext(profile, true));
} else if (sat == Profile::EXPLICIT_ACCESS) { } else if (sat == ServiceAccessType::EXPLICIT_ACCESS) {
// Profile must be OffTheRecord in this case. // Profile must be OffTheRecord in this case.
return static_cast<FaviconService*>( return static_cast<FaviconService*>(
GetInstance()->GetServiceForBrowserContext( GetInstance()->GetServiceForBrowserContext(

@@ -6,13 +6,13 @@
#define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/service_access_type.h"
template <typename T> struct DefaultSingletonTraits; template <typename T> struct DefaultSingletonTraits;
class Profile;
class FaviconService; class FaviconService;
class Profile;
// Singleton that owns all FaviconService and associates them with // Singleton that owns all FaviconService and associates them with
// Profiles. // Profiles.
@@ -20,8 +20,7 @@ class FaviconServiceFactory : public BrowserContextKeyedServiceFactory {
public: public:
// |access| defines what the caller plans to do with the service. See // |access| defines what the caller plans to do with the service. See
// the ServiceAccessType definition in profile.h. // the ServiceAccessType definition in profile.h.
static FaviconService* GetForProfile(Profile* profile, static FaviconService* GetForProfile(Profile* profile, ServiceAccessType sat);
Profile::ServiceAccessType sat);
static FaviconServiceFactory* GetInstance(); static FaviconServiceFactory* GetInstance();

@@ -119,13 +119,13 @@ void FaviconTabHelper::SaveFavicon() {
// Make sure the page is in history, otherwise adding the favicon does // Make sure the page is in history, otherwise adding the favicon does
// nothing. // nothing.
HistoryService* history = HistoryServiceFactory::GetForProfile( HistoryService* history = HistoryServiceFactory::GetForProfile(
profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS);
if (!history) if (!history)
return; return;
history->AddPageNoVisitForBookmark(entry->GetURL(), entry->GetTitle()); history->AddPageNoVisitForBookmark(entry->GetURL(), entry->GetTitle());
FaviconService* service = FaviconServiceFactory::GetForProfile( FaviconService* service = FaviconServiceFactory::GetForProfile(
profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS);
if (!service) if (!service)
return; return;
const FaviconStatus& favicon(entry->GetFavicon()); const FaviconStatus& favicon(entry->GetFavicon());
@@ -147,7 +147,7 @@ void FaviconTabHelper::RemoveObserver(FaviconTabHelperObserver* observer) {
int FaviconTabHelper::StartDownload(const GURL& url, int max_image_size) { int FaviconTabHelper::StartDownload(const GURL& url, int max_image_size) {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS);
if (favicon_service && favicon_service->WasUnableToDownloadFavicon(url)) { if (favicon_service && favicon_service->WasUnableToDownloadFavicon(url)) {
DVLOG(1) << "Skip Failed FavIcon: " << url; DVLOG(1) << "Skip Failed FavIcon: " << url;
return 0; return 0;
@@ -231,7 +231,7 @@ void FaviconTabHelper::DidStartNavigationToPendingEntry(
if (reload_type != NavigationController::NO_RELOAD && if (reload_type != NavigationController::NO_RELOAD &&
!profile_->IsOffTheRecord()) { !profile_->IsOffTheRecord()) {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_, Profile::IMPLICIT_ACCESS); profile_, ServiceAccessType::IMPLICIT_ACCESS);
if (favicon_service) { if (favicon_service) {
favicon_service->SetFaviconOutOfDateForPage(url); favicon_service->SetFaviconOutOfDateForPage(url);
if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) if (reload_type == NavigationController::RELOAD_IGNORING_CACHE)
@@ -294,7 +294,7 @@ void FaviconTabHelper::DidDownloadFavicon(
if (bitmaps.empty() && http_status_code == 404) { if (bitmaps.empty() && http_status_code == 404) {
DVLOG(1) << "Failed to Download Favicon:" << image_url; DVLOG(1) << "Failed to Download Favicon:" << image_url;
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS);
if (favicon_service) if (favicon_service)
favicon_service->UnableToDownloadFavicon(image_url); favicon_service->UnableToDownloadFavicon(image_url);
} }

@@ -28,8 +28,8 @@ AndroidHistoryProviderService::QueryHistoryAndBookmarks(
const std::string& sort_order, const std::string& sort_order,
const QueryCallback& callback, const QueryCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -56,8 +56,8 @@ AndroidHistoryProviderService::UpdateHistoryAndBookmarks(
const std::vector<base::string16>& selection_args, const std::vector<base::string16>& selection_args,
const UpdateCallback& callback, const UpdateCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -82,8 +82,8 @@ AndroidHistoryProviderService::DeleteHistoryAndBookmarks(
const std::vector<base::string16>& selection_args, const std::vector<base::string16>& selection_args,
const DeleteCallback& callback, const DeleteCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -106,8 +106,8 @@ AndroidHistoryProviderService::InsertHistoryAndBookmark(
const history::HistoryAndBookmarkRow& values, const history::HistoryAndBookmarkRow& values,
const InsertCallback& callback, const InsertCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -130,8 +130,8 @@ AndroidHistoryProviderService::DeleteHistory(
const std::vector<base::string16>& selection_args, const std::vector<base::string16>& selection_args,
const DeleteCallback& callback, const DeleteCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -156,8 +156,8 @@ AndroidHistoryProviderService::MoveStatement(
int destination, int destination,
const MoveStatementCallback& callback, const MoveStatementCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -178,8 +178,8 @@ AndroidHistoryProviderService::MoveStatement(
void AndroidHistoryProviderService::CloseStatement( void AndroidHistoryProviderService::CloseStatement(
history::AndroidStatement* statement) { history::AndroidStatement* statement) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
hs->ScheduleAndForget(HistoryService::PRIORITY_NORMAL, hs->ScheduleAndForget(HistoryService::PRIORITY_NORMAL,
&HistoryBackend::CloseStatement, statement); &HistoryBackend::CloseStatement, statement);
@@ -193,8 +193,8 @@ AndroidHistoryProviderService::InsertSearchTerm(
const history::SearchRow& row, const history::SearchRow& row,
const InsertCallback& callback, const InsertCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -217,8 +217,8 @@ AndroidHistoryProviderService::UpdateSearchTerms(
const std::vector<base::string16>& selection_args, const std::vector<base::string16>& selection_args,
const UpdateCallback& callback, const UpdateCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -243,8 +243,8 @@ AndroidHistoryProviderService::DeleteSearchTerms(
const std::vector<base::string16>& selection_args, const std::vector<base::string16>& selection_args,
const DeleteCallback& callback, const DeleteCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -270,8 +270,8 @@ AndroidHistoryProviderService::QuerySearchTerms(
const std::string& sort_order, const std::string& sort_order,
const QueryCallback& callback, const QueryCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_) << "History service being called after cleanup";
DCHECK(hs->thread_checker_.CalledOnValidThread()); DCHECK(hs->thread_checker_.CalledOnValidThread());
@@ -296,8 +296,8 @@ AndroidHistoryProviderService::GetLargestRawFaviconForID(
favicon_base::FaviconID favicon_id, favicon_base::FaviconID favicon_id,
const favicon_base::FaviconRawBitmapCallback& callback, const favicon_base::FaviconRawBitmapCallback& callback,
base::CancelableTaskTracker* tracker) { base::CancelableTaskTracker* tracker) {
FaviconService* fs = FaviconService* fs = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(fs); DCHECK(fs);
return fs->GetLargestRawFaviconForID(favicon_id, callback, tracker); return fs->GetLargestRawFaviconForID(favicon_id, callback, tracker);
} }

@@ -68,8 +68,8 @@ class SQLiteCursorTest : public testing::Test,
testing_profile_->CreateFaviconService(); testing_profile_->CreateFaviconService();
ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false));
service_.reset(new AndroidHistoryProviderService(testing_profile_)); service_.reset(new AndroidHistoryProviderService(testing_profile_));
hs_ = HistoryServiceFactory::GetForProfile(testing_profile_, hs_ = HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); testing_profile_, ServiceAccessType::EXPLICIT_ACCESS);
} }
virtual void TearDown() override { virtual void TearDown() override {

@@ -86,9 +86,8 @@ class HistoryBrowserTest : public InProcessBrowserTest {
void WaitForHistoryBackendToRun() { void WaitForHistoryBackendToRun() {
base::CancelableTaskTracker task_tracker; base::CancelableTaskTracker task_tracker;
scoped_ptr<history::HistoryDBTask> task(new WaitForHistoryTask()); scoped_ptr<history::HistoryDBTask> task(new WaitForHistoryTask());
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(GetProfile(), GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
history->HistoryService::ScheduleDBTask(task.Pass(), &task_tracker); history->HistoryService::ScheduleDBTask(task.Pass(), &task_tracker);
content::RunMessageLoop(); content::RunMessageLoop();
} }
@@ -120,12 +119,12 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabled) {
EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled));
EXPECT_TRUE(HistoryServiceFactory::GetForProfile( EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS)); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS));
EXPECT_TRUE(HistoryServiceFactory::GetForProfile( EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::IMPLICIT_ACCESS)); GetProfile(), ServiceAccessType::IMPLICIT_ACCESS));
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
browser()->profile(), Profile::EXPLICIT_ACCESS)); browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS));
ExpectEmptyHistory(); ExpectEmptyHistory();
ui_test_utils::NavigateToURL(browser(), GetTestUrl()); ui_test_utils::NavigateToURL(browser(), GetTestUrl());
@@ -143,12 +142,12 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) {
GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true);
EXPECT_TRUE(HistoryServiceFactory::GetForProfile( EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::EXPLICIT_ACCESS)); GetProfile(), ServiceAccessType::EXPLICIT_ACCESS));
EXPECT_FALSE(HistoryServiceFactory::GetForProfile( EXPECT_FALSE(HistoryServiceFactory::GetForProfile(
GetProfile(), Profile::IMPLICIT_ACCESS)); GetProfile(), ServiceAccessType::IMPLICIT_ACCESS));
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
browser()->profile(), Profile::EXPLICIT_ACCESS)); browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS));
ExpectEmptyHistory(); ExpectEmptyHistory();
ui_test_utils::NavigateToURL(browser(), GetTestUrl()); ui_test_utils::NavigateToURL(browser(), GetTestUrl());
@@ -162,7 +161,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) {
EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled));
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
browser()->profile(), Profile::EXPLICIT_ACCESS)); browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS));
ui_test_utils::NavigateToURL(browser(), GetTestUrl()); ui_test_utils::NavigateToURL(browser(), GetTestUrl());
WaitForHistoryBackendToRun(); WaitForHistoryBackendToRun();
@@ -192,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabledThenEnabled) {
GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true);
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
browser()->profile(), Profile::EXPLICIT_ACCESS)); browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS));
ExpectEmptyHistory(); ExpectEmptyHistory();
ui_test_utils::NavigateToURL(browser(), GetTestUrl()); ui_test_utils::NavigateToURL(browser(), GetTestUrl());

@@ -12,16 +12,18 @@
#include "chrome/browser/history/chrome_history_client_factory.h" #include "chrome/browser/history/chrome_history_client_factory.h"
#include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_model.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/core/service_access_type.h"
// static // static
HistoryService* HistoryServiceFactory::GetForProfile( HistoryService* HistoryServiceFactory::GetForProfile(Profile* profile,
Profile* profile, Profile::ServiceAccessType sat) { ServiceAccessType sat) {
// If saving history is disabled, only allow explicit access. // If saving history is disabled, only allow explicit access.
if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) && if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
sat != Profile::EXPLICIT_ACCESS) sat != ServiceAccessType::EXPLICIT_ACCESS)
return NULL; return NULL;
return static_cast<HistoryService*>( return static_cast<HistoryService*>(
@@ -29,12 +31,12 @@ HistoryService* HistoryServiceFactory::GetForProfile(
} }
// static // static
HistoryService* HistoryService* HistoryServiceFactory::GetForProfileIfExists(
HistoryServiceFactory::GetForProfileIfExists( Profile* profile,
Profile* profile, Profile::ServiceAccessType sat) { ServiceAccessType sat) {
// If saving history is disabled, only allow explicit access. // If saving history is disabled, only allow explicit access.
if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) && if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
sat != Profile::EXPLICIT_ACCESS) sat != ServiceAccessType::EXPLICIT_ACCESS)
return NULL; return NULL;
return static_cast<HistoryService*>( return static_cast<HistoryService*>(

@@ -6,20 +6,20 @@
#define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_ #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/service_access_type.h"
class HistoryService; class HistoryService;
class Profile;
// Singleton that owns all HistoryService and associates them with // Singleton that owns all HistoryService and associates them with
// Profiles. // Profiles.
class HistoryServiceFactory : public BrowserContextKeyedServiceFactory { class HistoryServiceFactory : public BrowserContextKeyedServiceFactory {
public: public:
static HistoryService* GetForProfile( static HistoryService* GetForProfile(Profile* profile, ServiceAccessType sat);
Profile* profile, Profile::ServiceAccessType sat);
static HistoryService* GetForProfileIfExists( static HistoryService* GetForProfileIfExists(Profile* profile,
Profile* profile, Profile::ServiceAccessType sat); ServiceAccessType sat);
static HistoryService* GetForProfileWithoutCreating( static HistoryService* GetForProfileWithoutCreating(
Profile* profile); Profile* profile);

@@ -142,8 +142,8 @@ HistoryService* HistoryTabHelper::GetHistoryService() {
if (profile->IsOffTheRecord()) if (profile->IsOffTheRecord())
return NULL; return NULL;
return HistoryServiceFactory::GetForProfile(profile, return HistoryServiceFactory::GetForProfile(
Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
} }
void HistoryTabHelper::WebContentsDestroyed() { void HistoryTabHelper::WebContentsDestroyed() {
@@ -153,8 +153,8 @@ void HistoryTabHelper::WebContentsDestroyed() {
if (profile->IsOffTheRecord()) if (profile->IsOffTheRecord())
return; return;
HistoryService* hs = HistoryService* hs = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
if (hs) { if (hs) {
NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
if (entry) { if (entry) {

@@ -310,9 +310,8 @@ void InMemoryURLIndex::OnCacheLoadDone(
// Restoring from the History DB ----------------------------------------------- // Restoring from the History DB -----------------------------------------------
void InMemoryURLIndex::ScheduleRebuildFromHistory() { void InMemoryURLIndex::ScheduleRebuildFromHistory() {
HistoryService* service = HistoryService* service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, profile_, ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
service->ScheduleDBTask( service->ScheduleDBTask(
scoped_ptr<history::HistoryDBTask>( scoped_ptr<history::HistoryDBTask>(
new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask( new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask(

@@ -208,7 +208,7 @@ void InMemoryURLIndexTest::SetUp() {
profile_.BlockUntilHistoryProcessesPendingRequests(); profile_.BlockUntilHistoryProcessesPendingRequests();
profile_.BlockUntilHistoryIndexIsRefreshed(); profile_.BlockUntilHistoryIndexIsRefreshed();
history_service_ = HistoryServiceFactory::GetForProfile( history_service_ = HistoryServiceFactory::GetForProfile(
&profile_, Profile::EXPLICIT_ACCESS); &profile_, ServiceAccessType::EXPLICIT_ACCESS);
ASSERT_TRUE(history_service_); ASSERT_TRUE(history_service_);
HistoryBackend* backend = history_service_->history_backend_.get(); HistoryBackend* backend = history_service_->history_backend_.get();
history_database_ = backend->db(); history_database_ = backend->db();

@@ -38,9 +38,8 @@ class RedirectTest : public InProcessBrowserTest {
RedirectTest() {} RedirectTest() {}
std::vector<GURL> GetRedirects(const GURL& url) { std::vector<GURL> GetRedirects(const GURL& url) {
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(browser()->profile(), browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
// Schedule a history query for redirects. The response will be sent // Schedule a history query for redirects. The response will be sent
// asynchronously from the callback the history system uses to notify us // asynchronously from the callback the history system uses to notify us

@@ -450,7 +450,7 @@ base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() {
return base::CancelableTaskTracker::kBadTaskId; return base::CancelableTaskTracker::kBadTaskId;
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
// |hs| may be null during unit tests. // |hs| may be null during unit tests.
if (hs) { if (hs) {
return hs->QueryMostVisitedURLs( return hs->QueryMostVisitedURLs(

@@ -240,8 +240,8 @@ class TopSitesImplTest : public HistoryUnitTestBase {
} }
TestingProfile* profile() {return profile_.get();} TestingProfile* profile() {return profile_.get();}
HistoryService* history_service() { HistoryService* history_service() {
return HistoryServiceFactory::GetForProfile(profile_.get(), return HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
} }
MostVisitedURLList GetPrepopulatePages() { MostVisitedURLList GetPrepopulatePages() {

@@ -87,20 +87,21 @@ bool ProfileWriter::TemplateURLServiceIsLoaded() const {
void ProfileWriter::AddPasswordForm(const autofill::PasswordForm& form) { void ProfileWriter::AddPasswordForm(const autofill::PasswordForm& form) {
PasswordStoreFactory::GetForProfile( PasswordStoreFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddLogin(form);
} }
#if defined(OS_WIN) #if defined(OS_WIN)
void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) {
WebDataServiceFactory::GetPasswordWebDataForProfile( WebDataServiceFactory::GetPasswordWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS)->AddIE7Login(info); profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddIE7Login(info);
} }
#endif #endif
void ProfileWriter::AddHistoryPage(const history::URLRows& page, void ProfileWriter::AddHistoryPage(const history::URLRows& page,
history::VisitSource visit_source) { history::VisitSource visit_source) {
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> HistoryServiceFactory::GetForProfile(profile_,
AddPagesWithDetails(page, visit_source); ServiceAccessType::EXPLICIT_ACCESS)
->AddPagesWithDetails(page, visit_source);
} }
void ProfileWriter::AddHomepage(const GURL& home_page) { void ProfileWriter::AddHomepage(const GURL& home_page) {
@@ -233,8 +234,9 @@ void ProfileWriter::AddBookmarks(
void ProfileWriter::AddFavicons( void ProfileWriter::AddFavicons(
const std::vector<ImportedFaviconUsage>& favicons) { const std::vector<ImportedFaviconUsage>& favicons) {
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> FaviconServiceFactory::GetForProfile(profile_,
SetImportedFavicons(favicons); ServiceAccessType::EXPLICIT_ACCESS)
->SetImportedFavicons(favicons);
} }
typedef std::map<std::string, TemplateURL*> HostPathMap; typedef std::map<std::string, TemplateURL*> HostPathMap;
@@ -335,7 +337,7 @@ void ProfileWriter::AddAutofillFormDataEntries(
const std::vector<autofill::AutofillEntry>& autofill_entries) { const std::vector<autofill::AutofillEntry>& autofill_entries) {
scoped_refptr<autofill::AutofillWebDataService> web_data_service = scoped_refptr<autofill::AutofillWebDataService> web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (web_data_service.get()) if (web_data_service.get())
web_data_service->UpdateAutofillEntries(autofill_entries); web_data_service->UpdateAutofillEntries(autofill_entries);
} }

@@ -91,9 +91,8 @@ class ProfileWriterTest : public testing::Test {
} }
void VerifyHistoryCount(Profile* profile) { void VerifyHistoryCount(Profile* profile) {
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, profile, ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
history::QueryOptions options; history::QueryOptions options;
base::CancelableTaskTracker history_task_tracker; base::CancelableTaskTracker history_task_tracker;
history_service->QueryHistory( history_service->QueryHistory(

@@ -468,8 +468,8 @@ void JumpList::StartLoadingFavicon() {
return; return;
} }
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
task_id_ = favicon_service->GetFaviconImageForPageURL( task_id_ = favicon_service->GetFaviconImageForPageURL(
url, url,
base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)), base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)),

@@ -243,8 +243,8 @@ void MessageCenterSettingsController::GetNotifierList(
ContentSettingsForOneType settings; ContentSettingsForOneType settings;
DesktopNotificationProfileUtil::GetNotificationsSettings(profile, &settings); DesktopNotificationProfileUtil::GetNotificationsSettings(profile, &settings);
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
favicon_tracker_.reset(new base::CancelableTaskTracker()); favicon_tracker_.reset(new base::CancelableTaskTracker());
patterns_.clear(); patterns_.clear();
for (ContentSettingsForOneType::const_iterator iter = settings.begin(); for (ContentSettingsForOneType::const_iterator iter = settings.begin();

@@ -266,9 +266,10 @@ password_manager::PasswordStore*
ChromePasswordManagerClient::GetPasswordStore() { ChromePasswordManagerClient::GetPasswordStore() {
// Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord // Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord
// itself when it shouldn't access the PasswordStore. // itself when it shouldn't access the PasswordStore.
// TODO(gcasto): Is is safe to change this to Profile::IMPLICIT_ACCESS? // TODO(gcasto): Is is safe to change this to
return PasswordStoreFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) // ServiceAccessType::IMPLICIT_ACCESS?
.get(); return PasswordStoreFactory::GetForProfile(
profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
} }
base::FieldTrial::Probability base::FieldTrial::Probability

@@ -17,6 +17,7 @@
#include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h"
#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/password_manager/test_password_store_service.h" #include "chrome/browser/password_manager/test_password_store_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/login/login_prompt.h" #include "chrome/browser/ui/login/login_prompt.h"
#include "chrome/browser/ui/login/login_prompt_test_utils.h" #include "chrome/browser/ui/login/login_prompt_test_utils.h"
@@ -1071,8 +1072,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
DontPromptWhenEnableAutomaticPasswordSavingSwitchIsSet) { DontPromptWhenEnableAutomaticPasswordSavingSwitchIsSet) {
password_manager::TestPasswordStore* password_store = password_manager::TestPasswordStore* password_store =
static_cast<password_manager::TestPasswordStore*>( static_cast<password_manager::TestPasswordStore*>(
PasswordStoreFactory::GetForProfile(browser()->profile(), PasswordStoreFactory::GetForProfile(
Profile::IMPLICIT_ACCESS).get()); browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
EXPECT_TRUE(password_store->IsEmpty()); EXPECT_TRUE(password_store->IsEmpty());
@@ -1162,8 +1163,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoLastLoadGoodLastLoad) {
password_manager::TestPasswordStore* password_store = password_manager::TestPasswordStore* password_store =
static_cast<password_manager::TestPasswordStore*>( static_cast<password_manager::TestPasswordStore*>(
PasswordStoreFactory::GetForProfile(browser()->profile(), PasswordStoreFactory::GetForProfile(
Profile::IMPLICIT_ACCESS).get()); browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
EXPECT_TRUE(password_store->IsEmpty()); EXPECT_TRUE(password_store->IsEmpty());
// Navigate to a page requiring HTTP auth. Wait for the tab to get the correct // Navigate to a page requiring HTTP auth. Wait for the tab to get the correct
@@ -1288,8 +1289,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
PromptWhenPasswordFormWithoutUsernameFieldSubmitted) { PromptWhenPasswordFormWithoutUsernameFieldSubmitted) {
password_manager::TestPasswordStore* password_store = password_manager::TestPasswordStore* password_store =
static_cast<password_manager::TestPasswordStore*>( static_cast<password_manager::TestPasswordStore*>(
PasswordStoreFactory::GetForProfile(browser()->profile(), PasswordStoreFactory::GetForProfile(
Profile::IMPLICIT_ACCESS).get()); browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
EXPECT_TRUE(password_store->IsEmpty()); EXPECT_TRUE(password_store->IsEmpty());
@@ -1318,8 +1319,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
AutofillSuggetionsForPasswordFormWithoutUsernameField) { AutofillSuggetionsForPasswordFormWithoutUsernameField) {
password_manager::TestPasswordStore* password_store = password_manager::TestPasswordStore* password_store =
static_cast<password_manager::TestPasswordStore*>( static_cast<password_manager::TestPasswordStore*>(
PasswordStoreFactory::GetForProfile(browser()->profile(), PasswordStoreFactory::GetForProfile(
Profile::IMPLICIT_ACCESS).get()); browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
EXPECT_TRUE(password_store->IsEmpty()); EXPECT_TRUE(password_store->IsEmpty());

@@ -11,6 +11,7 @@
#include "chrome/browser/password_manager/password_manager_util.h" #include "chrome/browser/password_manager/password_manager_util.h"
#include "chrome/browser/password_manager/sync_metrics.h" #include "chrome/browser/password_manager/sync_metrics.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/sync_start_util.h" #include "chrome/browser/sync/glue/sync_start_util.h"
#include "chrome/browser/webdata/web_data_service_factory.h" #include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
@@ -89,8 +90,8 @@ void PasswordStoreService::Shutdown() {
// static // static
scoped_refptr<PasswordStore> PasswordStoreFactory::GetForProfile( scoped_refptr<PasswordStore> PasswordStoreFactory::GetForProfile(
Profile* profile, Profile* profile,
Profile::ServiceAccessType sat) { ServiceAccessType sat) {
if (sat == Profile::IMPLICIT_ACCESS && profile->IsOffTheRecord()) { if (sat == ServiceAccessType::IMPLICIT_ACCESS && profile->IsOffTheRecord()) {
NOTREACHED() << "This profile is OffTheRecord"; NOTREACHED() << "This profile is OffTheRecord";
return NULL; return NULL;
} }
@@ -171,7 +172,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
db_thread_runner, db_thread_runner,
login_db.release(), login_db.release(),
WebDataServiceFactory::GetPasswordWebDataForProfile( WebDataServiceFactory::GetPasswordWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS)); profile, ServiceAccessType::EXPLICIT_ACCESS));
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
crypto::AppleKeychain* keychain = crypto::AppleKeychain* keychain =
base::CommandLine::ForCurrentProcess()->HasSwitch( base::CommandLine::ForCurrentProcess()->HasSwitch(

@@ -7,9 +7,9 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "components/keyed_service/core/service_access_type.h"
class Profile; class Profile;
@@ -50,7 +50,7 @@ class PasswordStoreFactory : public BrowserContextKeyedServiceFactory {
public: public:
static scoped_refptr<password_manager::PasswordStore> GetForProfile( static scoped_refptr<password_manager::PasswordStore> GetForProfile(
Profile* profile, Profile* profile,
Profile::ServiceAccessType set); ServiceAccessType set);
static PasswordStoreFactory* GetInstance(); static PasswordStoreFactory* GetInstance();

@@ -82,7 +82,7 @@ AutocompleteActionPredictor::AutocompleteActionPredictor(Profile* profile)
// Request the in-memory database from the history to force it to load so // Request the in-memory database from the history to force it to load so
// it's available as soon as possible. // it's available as soon as possible.
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) if (history_service)
history_service->InMemoryDatabase(); history_service->InMemoryDatabase();
@@ -463,8 +463,8 @@ void AutocompleteActionPredictor::CreateCaches(
} }
// If the history service is ready, delete any old or invalid entries. // If the history service is ready, delete any old or invalid entries.
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!TryDeleteOldEntries(history_service)) { if (!TryDeleteOldEntries(history_service)) {
// Wait for the notification that the history service is ready and the URL // Wait for the notification that the history service is ready and the URL
// DB is loaded. // DB is loaded.

@@ -127,9 +127,8 @@ class AutocompleteActionPredictorTest : public testing::Test {
} }
history::URLID AddRowToHistory(const TestUrlInfo& test_row) { history::URLID AddRowToHistory(const TestUrlInfo& test_row) {
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_.get(), profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
CHECK(history); CHECK(history);
history::URLDatabase* url_db = history->InMemoryDatabase(); history::URLDatabase* url_db = history->InMemoryDatabase();
CHECK(url_db); CHECK(url_db);
@@ -189,9 +188,8 @@ class AutocompleteActionPredictorTest : public testing::Test {
void DeleteOldIdsFromCaches( void DeleteOldIdsFromCaches(
std::vector<AutocompleteActionPredictorTable::Row::Id>* id_list) { std::vector<AutocompleteActionPredictorTable::Row::Id>* id_list) {
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_.get(), profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
ASSERT_TRUE(history_service); ASSERT_TRUE(history_service);
history::URLDatabase* url_db = history_service->InMemoryDatabase(); history::URLDatabase* url_db = history_service->InMemoryDatabase();

@@ -605,7 +605,7 @@ void ResourcePrefetchPredictor::OnNavigationComplete(
// Kick off history lookup to determine if we should record the URL. // Kick off history lookup to determine if we should record the URL.
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(history_service); DCHECK(history_service);
history_service->ScheduleDBTask( history_service->ScheduleDBTask(
scoped_ptr<history::HistoryDBTask>( scoped_ptr<history::HistoryDBTask>(
@@ -1347,8 +1347,8 @@ void ResourcePrefetchPredictor::OnHistoryServiceLoaded(
void ResourcePrefetchPredictor::ConnectToHistoryService() { void ResourcePrefetchPredictor::ConnectToHistoryService() {
// Register for HistoryServiceLoading if it is not ready. // Register for HistoryServiceLoading if it is not ready.
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history_service) if (!history_service)
return; return;
if (history_service->BackendLoaded()) { if (history_service->BackendLoaded()) {

@@ -79,7 +79,7 @@ class ResourcePrefetchPredictorTest : public testing::Test {
protected: protected:
void AddUrlToHistory(const std::string& url, int visit_count) { void AddUrlToHistory(const std::string& url, int visit_count) {
HistoryServiceFactory::GetForProfile(profile_.get(), HistoryServiceFactory::GetForProfile(profile_.get(),
Profile::EXPLICIT_ACCESS)-> ServiceAccessType::EXPLICIT_ACCESS)->
AddPageWithDetails( AddPageWithDetails(
GURL(url), GURL(url),
base::string16(), base::string16(),
@@ -186,8 +186,8 @@ void ResourcePrefetchPredictorTest::SetUp() {
ASSERT_TRUE(profile_->CreateHistoryService(true, false)); ASSERT_TRUE(profile_->CreateHistoryService(true, false));
profile_->BlockUntilHistoryProcessesPendingRequests(); profile_->BlockUntilHistoryProcessesPendingRequests();
EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(), EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS)); profile_.get(), ServiceAccessType::EXPLICIT_ACCESS));
// Initialize the predictor with empty data. // Initialize the predictor with empty data.
ResetPredictor(); ResetPredictor();
EXPECT_EQ(predictor_->initialization_state_, EXPECT_EQ(predictor_->initialization_state_,

@@ -1357,7 +1357,7 @@ PrerenderHandle* PrerenderManager::AddPrerender(
// Query the history to see if the URL being prerendered has ever been // Query the history to see if the URL being prerendered has ever been
// visited before. // visited before.
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
history_service->QueryURL( history_service->QueryURL(
url, url,

@@ -151,7 +151,7 @@ KeyedService* ProfileResetterTest::CreateTemplateURLService(
profile->GetPrefs(), profile->GetPrefs(),
scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
WebDataServiceFactory::GetKeywordWebDataForProfile( WebDataServiceFactory::GetKeywordWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS), profile, ServiceAccessType::EXPLICIT_ACCESS),
scoped_ptr<TemplateURLServiceClient>(), NULL, NULL, base::Closure()); scoped_ptr<TemplateURLServiceClient>(), NULL, NULL, base::Closure());
} }

@@ -74,31 +74,6 @@ class PrefRegistrySyncable;
// http://dev.chromium.org/developers/design-documents/profile-architecture // http://dev.chromium.org/developers/design-documents/profile-architecture
class Profile : public content::BrowserContext { class Profile : public content::BrowserContext {
public: public:
// Profile services are accessed with the following parameter. This parameter
// defines what the caller plans to do with the service.
// The caller is responsible for not performing any operation that would
// result in persistent implicit records while using an OffTheRecord profile.
// This flag allows the profile to perform an additional check.
//
// It also gives us an opportunity to perform further checks in the future. We
// could, for example, return an history service that only allow some specific
// methods.
enum ServiceAccessType {
// The caller plans to perform a read or write that takes place as a result
// of the user input. Use this flag when the operation you are doing can be
// performed while incognito. (ex: creating a bookmark)
//
// Since EXPLICIT_ACCESS means "as a result of a user action", this request
// always succeeds.
EXPLICIT_ACCESS,
// The caller plans to call a method that will permanently change some data
// in the profile, as part of Chrome's implicit data logging. Use this flag
// when you are about to perform an operation which is incompatible with the
// incognito mode.
IMPLICIT_ACCESS
};
enum CreateStatus { enum CreateStatus {
// Profile services were not created due to a local error (e.g., disk full). // Profile services were not created due to a local error (e.g., disk full).
CREATE_STATUS_LOCAL_FAIL, CREATE_STATUS_LOCAL_FAIL,

@@ -1154,8 +1154,8 @@ void ProfileManager::FinishDeletingProfile(const base::FilePath& profile_dir) {
ProfileMetrics::LogProfileDelete(profile_is_signed_in); ProfileMetrics::LogProfileDelete(profile_is_signed_in);
// Some platforms store passwords in keychains. They should be removed. // Some platforms store passwords in keychains. They should be removed.
scoped_refptr<password_manager::PasswordStore> password_store = scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) PasswordStoreFactory::GetForProfile(
.get(); profile, ServiceAccessType::EXPLICIT_ACCESS).get();
if (password_store.get()) { if (password_store.get()) {
password_store->RemoveLoginsCreatedBetween(base::Time(), password_store->RemoveLoginsCreatedBetween(base::Time(),
base::Time::Max()); base::Time::Max());

@@ -420,8 +420,8 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeletePasswords) {
form.blacklisted_by_user = false; form.blacklisted_by_user = false;
scoped_refptr<password_manager::PasswordStore> password_store = scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) PasswordStoreFactory::GetForProfile(
.get(); profile, ServiceAccessType::EXPLICIT_ACCESS).get();
ASSERT_TRUE(password_store.get()); ASSERT_TRUE(password_store.get());
password_store->AddLogin(form); password_store->AddLogin(form);

@@ -263,15 +263,15 @@ TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) {
// Force lazy-init of some profile services to simulate use. // Force lazy-init of some profile services to simulate use.
ASSERT_TRUE(profile1->CreateHistoryService(true, false)); ASSERT_TRUE(profile1->CreateHistoryService(true, false));
EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS)); profile1, ServiceAccessType::EXPLICIT_ACCESS));
profile1->CreateBookmarkModel(true); profile1->CreateBookmarkModel(true);
EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1));
profile2->CreateBookmarkModel(true); profile2->CreateBookmarkModel(true);
EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2));
ASSERT_TRUE(profile2->CreateHistoryService(true, false)); ASSERT_TRUE(profile2->CreateHistoryService(true, false));
EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, EXPECT_TRUE(HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS)); profile2, ServiceAccessType::EXPLICIT_ACCESS));
// Make sure any pending tasks run before we destroy the profiles. // Make sure any pending tasks run before we destroy the profiles.
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();

@@ -458,8 +458,8 @@ bool BrowserFeatureExtractor::GetHistoryService(HistoryService** history) {
*history = NULL; *history = NULL;
if (tab_ && tab_->GetBrowserContext()) { if (tab_ && tab_->GetBrowserContext()) {
Profile* profile = Profile::FromBrowserContext(tab_->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(tab_->GetBrowserContext());
*history = HistoryServiceFactory::GetForProfile(profile, *history = HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
if (*history) { if (*history) {
return true; return true;
} }

@@ -103,8 +103,8 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness {
} }
HistoryService* history_service() { HistoryService* history_service() {
return HistoryServiceFactory::GetForProfile(profile(), return HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile(), ServiceAccessType::EXPLICIT_ACCESS);
} }
void SetRedirectChain(const std::vector<GURL>& redirect_chain, void SetRedirectChain(const std::vector<GURL>& redirect_chain,

@@ -23,6 +23,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.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/profiles/profile.h"
#include "chrome/browser/safe_browsing/binary_feature_extractor.h" #include "chrome/browser/safe_browsing/binary_feature_extractor.h"
#include "chrome/browser/safe_browsing/download_feedback_service.h" #include "chrome/browser/safe_browsing/download_feedback_service.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h"
@@ -676,8 +677,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
} }
Profile* profile = Profile::FromBrowserContext(item_->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(item_->GetBrowserContext());
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
if (!history) { if (!history) {
SendRequest(); SendRequest();
return; return;

@@ -1549,7 +1549,8 @@ TEST_F(DownloadProtectionServiceTest,
redirects.push_back(GURL("http://tab.com/ref1")); redirects.push_back(GURL("http://tab.com/ref1"));
redirects.push_back(GURL("http://tab.com/ref2")); redirects.push_back(GURL("http://tab.com/ref2"));
redirects.push_back(tab_url); redirects.push_back(tab_url);
HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) HistoryServiceFactory::GetForProfile(&profile,
ServiceAccessType::EXPLICIT_ACCESS)
->AddPage(tab_url, ->AddPage(tab_url,
base::Time::Now(), base::Time::Now(),
reinterpret_cast<history::ContextID>(1), reinterpret_cast<history::ContextID>(1),

@@ -227,8 +227,8 @@ void LastDownloadFinder::OnMetadataQuery(
} else { } else {
// Search history since no metadata was found. // Search history since no metadata was found.
iter->second = WAITING_FOR_HISTORY; iter->second = WAITING_FOR_HISTORY;
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
// No history service is returned for profiles that do not save history. // No history service is returned for profiles that do not save history.
if (!history_service) { if (!history_service) {
RemoveProfileAndReportIfDone(iter); RemoveProfileAndReportIfDone(iter);
@@ -324,7 +324,7 @@ void LastDownloadFinder::OnHistoryServiceLoaded(
HistoryService* history_service) { HistoryService* history_service) {
for (const auto& pair : profile_states_) { for (const auto& pair : profile_states_) {
HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
pair.first, Profile::EXPLICIT_ACCESS); pair.first, ServiceAccessType::EXPLICIT_ACCESS);
if (hs == history_service) { if (hs == history_service) {
// Start the query in the history service if the finder was waiting for // Start the query in the history service if the finder was waiting for
// the service to load. // the service to load.

@@ -74,8 +74,8 @@ class LastDownloadFinderTest : public testing::Test {
// download to its history. // download to its history.
void CreateProfileWithDownload() { void CreateProfileWithDownload() {
TestingProfile* profile = CreateProfile(SAFE_BROWSING_OPT_IN); TestingProfile* profile = CreateProfile(SAFE_BROWSING_OPT_IN);
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload( history_service->CreateDownload(
CreateTestDownloadRow(), CreateTestDownloadRow(),
base::Bind(&LastDownloadFinderTest::OnDownloadCreated, base::Bind(&LastDownloadFinderTest::OnDownloadCreated,
@@ -162,8 +162,8 @@ class LastDownloadFinderTest : public testing::Test {
void AddDownload(Profile* profile, const history::DownloadRow& download) { void AddDownload(Profile* profile, const history::DownloadRow& download) {
base::RunLoop run_loop; base::RunLoop run_loop;
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
history_service->CreateDownload( history_service->CreateDownload(
download, download,
base::Bind(&LastDownloadFinderTest::ContinueOnDownloadCreated, base::Bind(&LastDownloadFinderTest::ContinueOnDownloadCreated,
@@ -183,7 +183,8 @@ class LastDownloadFinderTest : public testing::Test {
// dtor must be run. // dtor must be run.
void FlushHistoryBackend(Profile* profile) { void FlushHistoryBackend(Profile* profile) {
base::RunLoop run_loop; base::RunLoop run_loop;
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) HistoryServiceFactory::GetForProfile(profile,
ServiceAccessType::EXPLICIT_ACCESS)
->FlushForTest(run_loop.QuitClosure()); ->FlushForTest(run_loop.QuitClosure());
run_loop.Run(); run_loop.Run();
// Then make sure anything bounced back to the main thread has been handled. // Then make sure anything bounced back to the main thread has been handled.

@@ -89,7 +89,7 @@ void MalwareDetailsRedirectsCollector::GetRedirects(const GURL& url) {
} }
HistoryService* history = HistoryServiceFactory::GetForProfile( HistoryService* history = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history) { if (!history) {
AllDone(); AllDone();
return; return;

@@ -215,8 +215,8 @@ class MalwareDetailsTest : public ChromeRenderViewHostTestHarness {
} }
HistoryService* history_service() { HistoryService* history_service() {
return HistoryServiceFactory::GetForProfile(profile(), return HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile(), ServiceAccessType::EXPLICIT_ACCESS);
} }
protected: protected:

@@ -192,8 +192,8 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
RecordUserDecision(PROCEEDING_DISABLED); RecordUserDecision(PROCEEDING_DISABLED);
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
Profile::FromBrowserContext(web_contents->GetBrowserContext()), Profile::FromBrowserContext(web_contents->GetBrowserContext()),
Profile::EXPLICIT_ACCESS); ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
history_service->GetVisibleVisitCountToHost( history_service->GetVisibleVisitCountToHost(
request_url(), request_url(),

@@ -12,6 +12,7 @@
#include "chrome/browser/google/google_url_tracker_factory.h" #include "chrome/browser/google/google_url_tracker_factory.h"
#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/rlz/rlz.h" #include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/search_engines/chrome_template_url_service_client.h" #include "chrome/browser/search_engines/chrome_template_url_service_client.h"
#include "chrome/browser/search_engines/ui_thread_search_terms_data.h" #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
@@ -49,10 +50,10 @@ KeyedService* TemplateURLServiceFactory::BuildInstanceFor(
profile->GetPrefs(), profile->GetPrefs(),
scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
WebDataServiceFactory::GetKeywordWebDataForProfile( WebDataServiceFactory::GetKeywordWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS), profile, ServiceAccessType::EXPLICIT_ACCESS),
scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
HistoryServiceFactory::GetForProfile(profile, HistoryServiceFactory::GetForProfile(
Profile::EXPLICIT_ACCESS))), profile, ServiceAccessType::EXPLICIT_ACCESS))),
GoogleURLTrackerFactory::GetForProfile(profile), GoogleURLTrackerFactory::GetForProfile(profile),
g_browser_process->rappor_service(), g_browser_process->rappor_service(),
dsp_change_callback); dsp_change_callback);

@@ -114,11 +114,10 @@ void TemplateURLServiceTestUtil::ResetModel(bool verify_load) {
model_.reset(new TemplateURLService( model_.reset(new TemplateURLService(
profile()->GetPrefs(), scoped_ptr<SearchTermsData>(search_terms_data_), profile()->GetPrefs(), scoped_ptr<SearchTermsData>(search_terms_data_),
web_data_service_.get(), web_data_service_.get(),
scoped_ptr<TemplateURLServiceClient>( scoped_ptr<TemplateURLServiceClient>(new TestingTemplateURLServiceClient(
new TestingTemplateURLServiceClient( HistoryServiceFactory::GetForProfileIfExists(
HistoryServiceFactory::GetForProfileIfExists( profile(), ServiceAccessType::EXPLICIT_ACCESS),
profile(), Profile::EXPLICIT_ACCESS), &search_term_)),
&search_term_)),
NULL, NULL, base::Closure())); NULL, NULL, base::Closure()));
model()->AddObserver(this); model()->AddObserver(this);
changed_count_ = 0; changed_count_ = 0;

@@ -120,7 +120,7 @@ PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); }
scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() {
return WebDataServiceFactory::GetTokenWebDataForProfile( return WebDataServiceFactory::GetTokenWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
} }
bool ChromeSigninClient::CanRevokeCredentials() { bool ChromeSigninClient::CanRevokeCredentials() {

@@ -350,7 +350,7 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
if (internal_) if (internal_)
RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME);
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
history_service->GetVisibleVisitCountToHost( history_service->GetVisibleVisitCountToHost(
request_url, request_url,

@@ -268,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest,
// Query the history entry. // Query the history entry.
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
browser()->profile(), Profile::EXPLICIT_ACCESS); browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS);
history::QueryOptions options; history::QueryOptions options;
history::QueryResults results; history::QueryResults results;
QueryHistory(history_service, "", options, &results); QueryHistory(history_service, "", options, &results);

@@ -235,8 +235,8 @@ void SupervisedUserNavigationObserver::OnRequestBlockedInternal(
// Add the entry to the history database. // Add the entry to the history database.
Profile* profile = Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext()); Profile::FromBrowserContext(web_contents()->GetBrowserContext());
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
// |history_service| is null if saving history is disabled. // |history_service| is null if saving history is disabled.
if (history_service) if (history_service)

@@ -63,7 +63,7 @@ bool AutofillDataTypeController::StartModels() {
autofill::AutofillWebDataService* web_data_service = autofill::AutofillWebDataService* web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS).get(); profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
if (!web_data_service) if (!web_data_service)
return false; return false;

@@ -192,10 +192,9 @@ class SyncAutofillDataTypeControllerTest : public testing::Test {
// immediately try to start association and fail (due to missing DB // immediately try to start association and fail (due to missing DB
// thread). // thread).
TEST_F(SyncAutofillDataTypeControllerTest, StartWDSReady) { TEST_F(SyncAutofillDataTypeControllerTest, StartWDSReady) {
FakeWebDataService* web_db = FakeWebDataService* web_db = static_cast<FakeWebDataService*>(
static_cast<FakeWebDataService*>( WebDataServiceFactory::GetAutofillWebDataForProfile(
WebDataServiceFactory::GetAutofillWebDataForProfile( &profile_, ServiceAccessType::EXPLICIT_ACCESS).get());
&profile_, Profile::EXPLICIT_ACCESS).get());
web_db->LoadDatabase(); web_db->LoadDatabase();
autofill_dtc_->LoadModels( autofill_dtc_->LoadModels(
base::Bind(&SyncAutofillDataTypeControllerTest::OnLoadFinished, base::Bind(&SyncAutofillDataTypeControllerTest::OnLoadFinished,
@@ -228,7 +227,7 @@ TEST_F(SyncAutofillDataTypeControllerTest, StartWDSNotReady) {
FakeWebDataService* web_db = static_cast<FakeWebDataService*>( FakeWebDataService* web_db = static_cast<FakeWebDataService*>(
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
&profile_, Profile::EXPLICIT_ACCESS).get()); &profile_, ServiceAccessType::EXPLICIT_ACCESS).get());
web_db->LoadDatabase(); web_db->LoadDatabase();
autofill_dtc_->StartAssociating( autofill_dtc_->StartAssociating(

@@ -54,7 +54,7 @@ void AutofillProfileDataTypeController::OnPersonalDataChanged() {
personal_data_->RemoveObserver(this); personal_data_->RemoveObserver(this);
autofill::AutofillWebDataService* web_data_service = autofill::AutofillWebDataService* web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS).get(); profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
if (!web_data_service) if (!web_data_service)
return; return;
@@ -92,7 +92,7 @@ bool AutofillProfileDataTypeController::StartModels() {
autofill::AutofillWebDataService* web_data_service = autofill::AutofillWebDataService* web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS).get(); profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
if (!web_data_service) if (!web_data_service)
return false; return false;

@@ -870,10 +870,10 @@ void BookmarkChangeProcessor::ApplyBookmarkFavicon(
Profile* profile, Profile* profile,
const GURL& icon_url, const GURL& icon_url,
const scoped_refptr<base::RefCountedMemory>& bitmap_data) { const scoped_refptr<base::RefCountedMemory>& bitmap_data) {
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
history->AddPageNoVisitForBookmark(bookmark_node->url(), history->AddPageNoVisitForBookmark(bookmark_node->url(),
bookmark_node->GetTitle()); bookmark_node->GetTitle());

@@ -47,7 +47,7 @@ bool BookmarkDataTypeController::StartModels() {
BookmarkModelFactory::GetForProfile(profile_); BookmarkModelFactory::GetForProfile(profile_);
bookmark_model_observer_.Add(bookmark_model); bookmark_model_observer_.Add(bookmark_model);
HistoryService* history_service = HistoryServiceFactory::GetForProfile( HistoryService* history_service = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
history_service_observer_.Add(history_service); history_service_observer_.Add(history_service);
return false; return false;
} }
@@ -95,7 +95,7 @@ bool BookmarkDataTypeController::DependentsLoaded() {
return false; return false;
HistoryService* history = HistoryServiceFactory::GetForProfile( HistoryService* history = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history || !history->BackendLoaded()) if (!history || !history->BackendLoaded())
return false; return false;

@@ -434,8 +434,8 @@ void FaviconCache::OnPageFaviconUpdated(const GURL& page_url) {
page_task_map_[page_url] = 0; // For testing only. page_task_map_[page_url] = 0; // For testing only.
return; return;
} }
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!favicon_service) if (!favicon_service)
return; return;
// TODO(zea): This appears to only fetch one favicon (best match based on // TODO(zea): This appears to only fetch one favicon (best match based on

@@ -51,7 +51,7 @@ bool PasswordDataTypeController::StartModels() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(MODEL_STARTING, state()); DCHECK_EQ(MODEL_STARTING, state());
password_store_ = PasswordStoreFactory::GetForProfile( password_store_ = PasswordStoreFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
return !!password_store_.get(); return !!password_store_.get();
} }

@@ -94,8 +94,8 @@ SyncBackendRegistrar::SyncBackendRegistrar(
// TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed.
tracked_objects::ScopedTracker tracker2(FROM_HERE_WITH_EXPLICIT_FUNCTION( tracked_objects::ScopedTracker tracker2(FROM_HERE_WITH_EXPLICIT_FUNCTION(
"426272 SyncBackendRegistrar::ctor history")); "426272 SyncBackendRegistrar::ctor history"));
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); profile, ServiceAccessType::IMPLICIT_ACCESS);
if (history_service) { if (history_service) {
workers_[syncer::GROUP_HISTORY] = workers_[syncer::GROUP_HISTORY] =
new HistoryModelWorker(history_service->AsWeakPtr(), this); new HistoryModelWorker(history_service->AsWeakPtr(), this);
@@ -107,7 +107,8 @@ SyncBackendRegistrar::SyncBackendRegistrar(
tracked_objects::ScopedTracker tracker3(FROM_HERE_WITH_EXPLICIT_FUNCTION( tracked_objects::ScopedTracker tracker3(FROM_HERE_WITH_EXPLICIT_FUNCTION(
"426272 SyncBackendRegistrar::ctor passwords")); "426272 SyncBackendRegistrar::ctor passwords"));
scoped_refptr<password_manager::PasswordStore> password_store = scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); PasswordStoreFactory::GetForProfile(profile,
ServiceAccessType::IMPLICIT_ACCESS);
if (password_store.get()) { if (password_store.get()) {
workers_[syncer::GROUP_PASSWORD] = workers_[syncer::GROUP_PASSWORD] =
new PasswordModelWorker(password_store, this); new PasswordModelWorker(password_store, this);

@@ -126,7 +126,7 @@ bool TypedUrlDataTypeController::PostTaskOnBackendThread(
const base::Closure& task) { const base::Closure& task) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
HistoryService* history = HistoryServiceFactory::GetForProfile( HistoryService* history = HistoryServiceFactory::GetForProfile(
profile(), Profile::IMPLICIT_ACCESS); profile(), ServiceAccessType::IMPLICIT_ACCESS);
if (history) { if (history) {
history->ScheduleDBTask( history->ScheduleDBTask(
scoped_ptr<history::HistoryDBTask>( scoped_ptr<history::HistoryDBTask>(

@@ -163,7 +163,7 @@ ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl(
command_line_(command_line), command_line_(command_line),
web_data_service_(WebDataServiceFactory::GetAutofillWebDataForProfile( web_data_service_(WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, profile_,
Profile::EXPLICIT_ACCESS)), ServiceAccessType::EXPLICIT_ACCESS)),
sync_service_url_(sync_service_url), sync_service_url_(sync_service_url),
token_service_(token_service), token_service_(token_service),
url_request_context_getter_(url_request_context_getter), url_request_context_getter_(url_request_context_getter),
@@ -502,9 +502,8 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl::
GetThemeSyncableService()->AsWeakPtr(); GetThemeSyncableService()->AsWeakPtr();
#endif #endif
case syncer::HISTORY_DELETE_DIRECTIVES: { case syncer::HISTORY_DELETE_DIRECTIVES: {
HistoryService* history = HistoryService* history = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile( profile_, ServiceAccessType::EXPLICIT_ACCESS);
profile_, Profile::EXPLICIT_ACCESS);
return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>();
} }
#if defined(ENABLE_SPELLCHECK) #if defined(ENABLE_SPELLCHECK)
@@ -550,8 +549,8 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl::
case syncer::PASSWORDS: { case syncer::PASSWORDS: {
#if defined(PASSWORD_MANAGER_ENABLE_SYNC) #if defined(PASSWORD_MANAGER_ENABLE_SYNC)
scoped_refptr<password_manager::PasswordStore> password_store = scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile_, PasswordStoreFactory::GetForProfile(
Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
return password_store.get() ? password_store->GetPasswordSyncableService() return password_store.get() ? password_store->GetPasswordSyncableService()
: base::WeakPtr<syncer::SyncableService>(); : base::WeakPtr<syncer::SyncableService>();
#else #else

@@ -183,7 +183,8 @@ void ClearBrowsingData(BrowsingDataRemover::Observer* observer,
BrowsingDataHelper::ALL); BrowsingDataHelper::ALL);
scoped_refptr<password_manager::PasswordStore> password = scoped_refptr<password_manager::PasswordStore> password =
PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); PasswordStoreFactory::GetForProfile(profile,
ServiceAccessType::EXPLICIT_ACCESS);
password->RemoveLoginsSyncedBetween(start, end); password->RemoveLoginsSyncedBetween(start, end);
} }

@@ -497,7 +497,7 @@ class ProfileSyncServiceAutofillTest
personal_data_manager_->Init( personal_data_manager_->Init(
WebDataServiceFactory::GetAutofillWebDataForProfile( WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, Profile::EXPLICIT_ACCESS), profile_, ServiceAccessType::EXPLICIT_ACCESS),
profile_->GetPrefs(), profile_->GetPrefs(),
profile_->IsOffTheRecord()); profile_->IsOffTheRecord());

@@ -58,8 +58,8 @@ NotificationServiceSessionsRouter::NotificationServiceSessionsRouter(
registrar_.Add(this, registrar_.Add(this,
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllBrowserContextsAndSources()); content::NotificationService::AllBrowserContextsAndSources());
HistoryService* history_service = HistoryService* history_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
if (history_service) { if (history_service) {
favicon_changed_subscription_ = history_service->AddFaviconChangedCallback( favicon_changed_subscription_ = history_service->AddFaviconChangedCallback(
base::Bind(&NotificationServiceSessionsRouter::OnFaviconChanged, base::Bind(&NotificationServiceSessionsRouter::OnFaviconChanged,

@@ -167,7 +167,7 @@ AutofillProfile CreateAutofillProfile(ProfileType type) {
scoped_refptr<AutofillWebDataService> GetWebDataService(int index) { scoped_refptr<AutofillWebDataService> GetWebDataService(int index) {
return WebDataServiceFactory::GetAutofillWebDataForProfile( return WebDataServiceFactory::GetAutofillWebDataForProfile(
test()->GetProfile(index), Profile::EXPLICIT_ACCESS); test()->GetProfile(index), ServiceAccessType::EXPLICIT_ACCESS);
} }
PersonalDataManager* GetPersonalDataManager(int index) { PersonalDataManager* GetPersonalDataManager(int index) {

@@ -230,9 +230,8 @@ void SetFaviconImpl(Profile* profile,
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
FaviconChangeObserver observer(model, node); FaviconChangeObserver observer(model, node);
FaviconService* favicon_service = FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile, profile, ServiceAccessType::EXPLICIT_ACCESS);
Profile::EXPLICIT_ACCESS);
if (favicon_source == bookmarks_helper::FROM_UI) { if (favicon_source == bookmarks_helper::FROM_UI) {
favicon_service->SetFavicons( favicon_service->SetFavicons(
node->url(), icon_url, favicon_base::FAVICON, image); node->url(), icon_url, favicon_base::FAVICON, image);

@@ -134,12 +134,13 @@ bool SetDecryptionPassphrase(int index, const std::string& passphrase) {
PasswordStore* GetPasswordStore(int index) { PasswordStore* GetPasswordStore(int index) {
return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), return PasswordStoreFactory::GetForProfile(test()->GetProfile(index),
Profile::IMPLICIT_ACCESS).get(); ServiceAccessType::IMPLICIT_ACCESS)
.get();
} }
PasswordStore* GetVerifierPasswordStore() { PasswordStore* GetVerifierPasswordStore() {
return PasswordStoreFactory::GetForProfile(test()->verifier(), return PasswordStoreFactory::GetForProfile(
Profile::IMPLICIT_ACCESS).get(); test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS).get();
} }
bool ProfileContainsSamePasswordFormsAsVerifier(int index) { bool ProfileContainsSamePasswordFormsAsVerifier(int index) {

@@ -397,7 +397,7 @@ bool SyncTest::SetupClients() {
bookmarks::test::WaitForBookmarkModelToLoad( bookmarks::test::WaitForBookmarkModelToLoad(
BookmarkModelFactory::GetForProfile(verifier())); BookmarkModelFactory::GetForProfile(verifier()));
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
verifier(), Profile::EXPLICIT_ACCESS)); verifier(), ServiceAccessType::EXPLICIT_ACCESS));
ui_test_utils::WaitForTemplateURLServiceToLoad( ui_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(verifier())); TemplateURLServiceFactory::GetForProfile(verifier()));
return (verifier_ != NULL); return (verifier_ != NULL);
@@ -457,7 +457,7 @@ void SyncTest::InitializeInstance(int index) {
bookmarks::test::WaitForBookmarkModelToLoad( bookmarks::test::WaitForBookmarkModelToLoad(
BookmarkModelFactory::GetForProfile(GetProfile(index))); BookmarkModelFactory::GetForProfile(GetProfile(index)));
ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
GetProfile(index), Profile::EXPLICIT_ACCESS)); GetProfile(index), ServiceAccessType::EXPLICIT_ACCESS));
ui_test_utils::WaitForTemplateURLServiceToLoad( ui_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(GetProfile(index))); TemplateURLServiceFactory::GetForProfile(GetProfile(index)));
} }

@@ -285,13 +285,9 @@ void AddUrlToHistoryWithTimestamp(int index,
source, source,
timestamp); timestamp);
if (test()->use_verifier()) if (test()->use_verifier())
AddToHistory( AddToHistory(HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(test()->verifier(), test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS),
Profile::IMPLICIT_ACCESS), url, transition, source, timestamp);
url,
transition,
source,
timestamp);
// Wait until the AddPage() request has completed so we know the change has // Wait until the AddPage() request has completed so we know the change has
// filtered down to the sync observers (don't need to wait for the // filtered down to the sync observers (don't need to wait for the
@@ -303,9 +299,8 @@ void DeleteUrlFromHistory(int index, const GURL& url) {
HistoryServiceFactory::GetForProfileWithoutCreating( HistoryServiceFactory::GetForProfileWithoutCreating(
test()->GetProfile(index))->DeleteURL(url); test()->GetProfile(index))->DeleteURL(url);
if (test()->use_verifier()) if (test()->use_verifier())
HistoryServiceFactory::GetForProfile(test()->verifier(), HistoryServiceFactory::GetForProfile(
Profile::IMPLICIT_ACCESS)-> test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS)->DeleteURL(url);
DeleteURL(url);
WaitForHistoryDBThread(index); WaitForHistoryDBThread(index);
} }
@@ -314,8 +309,8 @@ void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) {
test()->GetProfile(index))->DeleteURLsForTest(urls); test()->GetProfile(index))->DeleteURLsForTest(urls);
if (test()->use_verifier()) if (test()->use_verifier())
HistoryServiceFactory::GetForProfile(test()->verifier(), HistoryServiceFactory::GetForProfile(test()->verifier(),
Profile::IMPLICIT_ACCESS)-> ServiceAccessType::IMPLICIT_ACCESS)
DeleteURLsForTest(urls); ->DeleteURLsForTest(urls);
WaitForHistoryDBThread(index); WaitForHistoryDBThread(index);
} }
@@ -375,9 +370,8 @@ bool CheckURLRowsAreEqual(
} }
bool CheckAllProfilesHaveSameURLsAsVerifier() { bool CheckAllProfilesHaveSameURLsAsVerifier() {
HistoryService* verifier_service = HistoryService* verifier_service = HistoryServiceFactory::GetForProfile(
HistoryServiceFactory::GetForProfile(test()->verifier(), test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS);
Profile::IMPLICIT_ACCESS);
history::URLRows verifier_urls = history::URLRows verifier_urls =
GetTypedUrlsFromHistoryService(verifier_service); GetTypedUrlsFromHistoryService(verifier_service);
for (int i = 0; i < test()->num_clients(); ++i) { for (int i = 0; i < test()->num_clients(); ++i) {

@@ -41,7 +41,7 @@ void NavigationPopup::FetchFaviconForUrl(JNIEnv* env,
jstring jurl) { jstring jurl) {
Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile();
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
if (!favicon_service) if (!favicon_service)
return; return;
GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); GURL url(base::android::ConvertJavaStringToUTF16(env, jurl));

@@ -276,12 +276,11 @@ class TestAutofillDialogController
} }
void Init(content::BrowserContext* browser_context) { void Init(content::BrowserContext* browser_context) {
test_manager_.Init( test_manager_.Init(WebDataServiceFactory::GetAutofillWebDataForProfile(
WebDataServiceFactory::GetAutofillWebDataForProfile( Profile::FromBrowserContext(browser_context),
Profile::FromBrowserContext(browser_context), ServiceAccessType::EXPLICIT_ACCESS),
Profile::EXPLICIT_ACCESS), user_prefs::UserPrefs::Get(browser_context),
user_prefs::UserPrefs::Get(browser_context), browser_context->IsOffTheRecord());
browser_context->IsOffTheRecord());
} }
TestAutofillDialogView* GetView() { TestAutofillDialogView* GetView() {

@@ -91,7 +91,7 @@ scoped_refptr<AutofillWebDataService> ChromeAutofillClient::GetDatabase() {
Profile* profile = Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext()); Profile::FromBrowserContext(web_contents()->GetBrowserContext());
return WebDataServiceFactory::GetAutofillWebDataForProfile( return WebDataServiceFactory::GetAutofillWebDataForProfile(
profile, Profile::EXPLICIT_ACCESS); profile, ServiceAccessType::EXPLICIT_ACCESS);
} }
PrefService* ChromeAutofillClient::GetPrefs() { PrefService* ChromeAutofillClient::GetPrefs() {

@@ -74,7 +74,7 @@ HistoryMenuBridge::HistoryMenuBridge(Profile* profile)
// may not be ready when the Bridge is created. If this happens, register // may not be ready when the Bridge is created. If this happens, register
// for a notification that tells us the HistoryService is ready. // for a notification that tells us the HistoryService is ready.
HistoryService* hs = HistoryServiceFactory::GetForProfile( HistoryService* hs = HistoryServiceFactory::GetForProfile(
profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (hs) { if (hs) {
history_service_observer_.Add(hs); history_service_observer_.Add(hs);
if (hs->BackendLoaded()) { if (hs->BackendLoaded()) {
@@ -432,8 +432,8 @@ HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForTab(
} }
void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) {
FaviconService* service = FaviconService* service = FaviconServiceFactory::GetForProfile(
FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); profile_, ServiceAccessType::EXPLICIT_ACCESS);
base::CancelableTaskTracker::TaskId task_id = base::CancelableTaskTracker::TaskId task_id =
service->GetFaviconImageForPageURL( service->GetFaviconImageForPageURL(
item->url, item->url,

@@ -63,8 +63,8 @@ class ManagePasswordItemViewControllerTest
password_manager::MockPasswordStore* mockStore() { password_manager::MockPasswordStore* mockStore() {
password_manager::PasswordStore* store = password_manager::PasswordStore* store =
PasswordStoreFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS) PasswordStoreFactory::GetForProfile(
.get(); profile(), ServiceAccessType::EXPLICIT_ACCESS).get();
password_manager::MockPasswordStore* mockStore = password_manager::MockPasswordStore* mockStore =
static_cast<password_manager::MockPasswordStore*>(store); static_cast<password_manager::MockPasswordStore*>(store);
return mockStore; return mockStore;

@@ -187,10 +187,11 @@ class FindInPageControllerTest : public InProcessBrowserTest {
} }
void FlushHistoryService() { void FlushHistoryService() {
HistoryServiceFactory::GetForProfile( HistoryServiceFactory::GetForProfile(browser()->profile(),
browser()->profile(), Profile::IMPLICIT_ACCESS)->FlushForTest( ServiceAccessType::IMPLICIT_ACCESS)
base::Bind(&base::MessageLoop::Quit, ->FlushForTest(base::Bind(
base::Unretained(base::MessageLoop::current()->current()))); &base::MessageLoop::Quit,
base::Unretained(base::MessageLoop::current()->current())));
content::RunMessageLoop(); content::RunMessageLoop();
} }
}; };

Some files were not shown because too many files have changed in this diff Show More