From e9ea3c2ead117e0945df3c9d64c202477fffc99c Mon Sep 17 00:00:00 2001 From: sdefresne <sdefresne@chromium.org> Date: Sat, 10 Jan 2015 02:10:04 -0800 Subject: [PATCH] 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} --- chrome/browser/android/favicon_helper.cc | 4 +- .../provider/chrome_browser_provider.cc | 6 +-- chrome/browser/android/shortcut_helper.cc | 3 +- .../autocomplete/autocomplete_browsertest.cc | 5 +- .../chrome_autocomplete_provider_client.cc | 7 +-- .../browser/autocomplete/history_provider.cc | 4 +- .../autocomplete/history_quick_provider.cc | 8 ++-- .../history_quick_provider_unittest.cc | 12 ++--- .../autocomplete/history_url_provider.cc | 4 +- .../history_url_provider_unittest.cc | 9 ++-- .../autocomplete/search_provider_unittest.cc | 13 ++--- .../autocomplete/shortcuts_provider.cc | 4 +- .../autofill/personal_data_manager_factory.cc | 2 +- .../browser/bookmarks/bookmark_html_writer.cc | 2 +- .../bookmark_html_writer_unittest.cc | 15 +++--- .../bookmarks/chrome_bookmark_client.cc | 4 +- .../browsing_data/browsing_data_remover.cc | 10 ++-- .../browsing_data_remover_unittest.cc | 2 +- .../browser/custom_home_pages_table_model.cc | 4 +- .../browser/download/download_browsertest.cc | 11 +++-- chrome/browser/download/download_service.cc | 2 +- .../download/download_service_factory.cc | 1 + .../download/download_target_determiner.cc | 2 +- .../download_target_determiner_unittest.cc | 4 +- .../extensions/api/history/history_api.cc | 16 +++---- .../chrome_management_api_delegate.cc | 2 +- .../browser/favicon/chrome_favicon_client.cc | 4 +- .../favicon/favicon_handler_unittest.cc | 2 +- chrome/browser/favicon/favicon_service.cc | 6 +-- .../favicon/favicon_service_factory.cc | 7 +-- .../browser/favicon/favicon_service_factory.h | 7 ++- chrome/browser/favicon/favicon_tab_helper.cc | 10 ++-- .../android_history_provider_service.cc | 48 +++++++++---------- .../history/android/sqlite_cursor_unittest.cc | 4 +- chrome/browser/history/history_browsertest.cc | 21 ++++---- .../history/history_service_factory.cc | 16 ++++--- .../browser/history/history_service_factory.h | 10 ++-- chrome/browser/history/history_tab_helper.cc | 8 ++-- chrome/browser/history/in_memory_url_index.cc | 5 +- .../history/in_memory_url_index_unittest.cc | 2 +- .../browser/history/redirect_browsertest.cc | 5 +- chrome/browser/history/top_sites_impl.cc | 2 +- .../history/top_sites_impl_unittest.cc | 4 +- chrome/browser/importer/profile_writer.cc | 16 ++++--- .../importer/profile_writer_unittest.cc | 5 +- chrome/browser/jumplist_win.cc | 4 +- .../message_center_settings_controller.cc | 4 +- .../chrome_password_manager_client.cc | 7 +-- .../password_manager_browsertest.cc | 17 +++---- .../password_store_factory.cc | 7 +-- .../password_manager/password_store_factory.h | 4 +- .../autocomplete_action_predictor.cc | 6 +-- .../autocomplete_action_predictor_unittest.cc | 10 ++-- .../predictors/resource_prefetch_predictor.cc | 6 +-- .../resource_prefetch_predictor_unittest.cc | 6 +-- chrome/browser/prerender/prerender_manager.cc | 2 +- .../profile_resetter_unittest.cc | 2 +- chrome/browser/profiles/profile.h | 25 ---------- chrome/browser/profiles/profile_manager.cc | 4 +- .../profiles/profile_manager_browsertest.cc | 4 +- .../profiles/profile_manager_unittest.cc | 8 ++-- .../browser_feature_extractor.cc | 4 +- .../browser_feature_extractor_unittest.cc | 4 +- .../download_protection_service.cc | 5 +- .../download_protection_service_unittest.cc | 3 +- .../last_download_finder.cc | 6 +-- .../last_download_finder_unittest.cc | 11 +++-- .../safe_browsing/malware_details_history.cc | 2 +- .../safe_browsing/malware_details_unittest.cc | 4 +- .../safe_browsing_blocking_page.cc | 4 +- .../template_url_service_factory.cc | 7 +-- .../template_url_service_test_util.cc | 9 ++-- chrome/browser/signin/chrome_signin_client.cc | 2 +- chrome/browser/ssl/ssl_blocking_page.cc | 2 +- .../supervised_user_browsertest.cc | 2 +- .../supervised_user_navigation_observer.cc | 4 +- .../glue/autofill_data_type_controller.cc | 2 +- .../autofill_data_type_controller_unittest.cc | 9 ++-- .../autofill_profile_data_type_controller.cc | 4 +- .../sync/glue/bookmark_change_processor.cc | 8 ++-- .../glue/bookmark_data_type_controller.cc | 4 +- chrome/browser/sync/glue/favicon_cache.cc | 4 +- .../glue/password_data_type_controller.cc | 2 +- .../sync/glue/sync_backend_registrar.cc | 7 +-- .../glue/typed_url_data_type_controller.cc | 2 +- .../profile_sync_components_factory_impl.cc | 11 ++--- chrome/browser/sync/profile_sync_service.cc | 3 +- .../profile_sync_service_autofill_unittest.cc | 2 +- .../notification_service_sessions_router.cc | 4 +- .../sync/test/integration/autofill_helper.cc | 2 +- .../sync/test/integration/bookmarks_helper.cc | 5 +- .../sync/test/integration/passwords_helper.cc | 7 +-- .../sync/test/integration/sync_test.cc | 4 +- .../test/integration/typed_urls_helper.cc | 24 ++++------ chrome/browser/ui/android/navigation_popup.cc | 2 +- .../autofill_dialog_controller_unittest.cc | 11 ++--- .../ui/autofill/chrome_autofill_client.cc | 2 +- .../browser/ui/cocoa/history_menu_bridge.mm | 6 +-- ..._password_item_view_controller_unittest.mm | 4 +- .../ui/find_bar/find_bar_host_browsertest.cc | 9 ++-- .../omnibox/alternate_nav_infobar_delegate.cc | 4 +- .../ui/omnibox/omnibox_view_browsertest.cc | 2 +- .../manage_passwords_bubble_model.cc | 5 +- .../manage_passwords_ui_controller.cc | 2 +- .../passwords/password_manager_presenter.cc | 4 +- .../instant_extended_interactive_uitest.cc | 4 +- .../keyword_editor_controller.cc | 4 +- .../ui/sync/one_click_signin_helper.cc | 2 +- ...ile_signin_confirmation_helper_unittest.cc | 6 +-- .../ui/toolbar/back_forward_menu_model.cc | 2 +- .../back_forward_menu_model_unittest.cc | 13 +++-- .../ui/toolbar/recent_tabs_sub_menu_model.cc | 2 +- .../ui/views/frame/test_with_browser_view.cc | 9 ++-- .../ui/website_settings/website_settings.cc | 2 +- .../ui/webui/bidi_checker_web_ui_test.cc | 2 +- .../webui/extensions/extension_icon_source.cc | 4 +- chrome/browser/ui/webui/favicon_source.cc | 4 +- chrome/browser/ui/webui/history_ui.cc | 6 +-- .../ui/webui/ntp/app_launcher_handler.cc | 4 +- .../ui/webui/ntp/favicon_webui_handler.cc | 2 +- .../webui/ntp/suggestions_source_top_sites.cc | 2 +- .../ui/webui/omnibox/omnibox_ui_handler.cc | 5 +- .../webdata/web_data_service_factory.cc | 19 ++++---- .../webdata/web_data_service_factory.h | 24 +++++----- chrome/test/base/profile_mock.h | 2 +- chrome/test/base/testing_profile.cc | 4 +- chrome/test/base/ui_test_utils.cc | 2 +- .../test/data/webui/history_ui_browsertest.cc | 4 +- components/keyed_service.gypi | 1 + components/keyed_service/core/BUILD.gn | 1 + .../keyed_service/core/service_access_type.h | 34 +++++++++++++ .../template_url_service_unittest.cc | 5 +- 132 files changed, 428 insertions(+), 419 deletions(-) create mode 100644 components/keyed_service/core/service_access_type.h diff --git a/chrome/browser/android/favicon_helper.cc b/chrome/browser/android/favicon_helper.cc index 08c3dcfe1b1d9..50b21d64da5e9 100644 --- a/chrome/browser/android/favicon_helper.cc +++ b/chrome/browser/android/favicon_helper.cc @@ -116,7 +116,7 @@ jboolean FaviconHelper::GetLocalFaviconImageForURL( return false; FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(favicon_service); if (!favicon_service) return false; @@ -152,7 +152,7 @@ void FaviconHelper::GetLargestRawFaviconForUrl( return; FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(favicon_service); if (!favicon_service) return; diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc index f8c2147759451..d37477b9c0a54 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.cc +++ b/chrome/browser/android/provider/chrome_browser_provider.cc @@ -1168,13 +1168,13 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); top_sites_ = profile_->GetTopSites(); favicon_service_ = FaviconServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS), + profile_, ServiceAccessType::EXPLICIT_ACCESS), service_.reset(new AndroidHistoryProviderService(profile_)); // Registers the notifications we are interested. bookmark_model_->AddObserver(this); - history_service_observer_.Add( - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)); + history_service_observer_.Add(HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS)); notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, content::NotificationService::AllSources()); notification_registrar_.Add(this, diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc index 4467bd96a8dd5..7661e84af3c0d 100644 --- a/chrome/browser/android/shortcut_helper.cc +++ b/chrome/browser/android/shortcut_helper.cc @@ -18,6 +18,7 @@ #include "chrome/browser/android/tab_android.h" #include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/favicon/favicon_service_factory.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" #include "chrome/common/web_application_info.h" @@ -385,7 +386,7 @@ void ShortcutHelper::AddShortcutUsingFavicon() { icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | favicon_base::TOUCH_ICON); 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, // otherwise using the largest icon among all avaliable icons. diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index 0f4e6cb120739..996b9d9bd9f8d 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -129,9 +129,8 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { WaitForTemplateURLServiceToLoad(); // The results depend on the history backend being loaded. Make sure it is // loaded so that the autocomplete results are consistent. - ui_test_utils::WaitForHistoryToLoad( - HistoryServiceFactory::GetForProfile(browser()->profile(), - Profile::EXPLICIT_ACCESS)); + ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); LocationBar* location_bar = GetLocationBar(); OmniboxView* omnibox_view = location_bar->GetOmniboxView(); diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc index b548d1ef2c9a6..0310b3c77cf9c 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc @@ -66,15 +66,16 @@ void ChromeAutocompleteProviderClient::Classify( } history::URLDatabase* ChromeAutocompleteProviderClient::InMemoryDatabase() { - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); return history_service ? history_service->InMemoryDatabase() : NULL; } void ChromeAutocompleteProviderClient::DeleteMatchingURLsForKeywordFromHistory( history::KeywordID keyword_id, const base::string16& term) { - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) + HistoryServiceFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS) ->DeleteMatchingURLsForKeyword(keyword_id, term); } diff --git a/chrome/browser/autocomplete/history_provider.cc b/chrome/browser/autocomplete/history_provider.cc index 6f9dc2e382e3c..4a4934c8f8d02 100644 --- a/chrome/browser/autocomplete/history_provider.cc +++ b/chrome/browser/autocomplete/history_provider.cc @@ -24,8 +24,8 @@ void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { DCHECK(profile_); DCHECK(match.deletable); - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); // Delete the underlying URL along with all its visits from the history DB. // The resulting HISTORY_URLS_DELETED notification will also cause all caches diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index 4e6aedbf1dfdb..d2b62e7b15995 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -116,8 +116,8 @@ void HistoryQuickProvider::DoAutocomplete() { autocomplete_input_.parts().path.is_nonempty()); if (can_have_url_what_you_typed_match_first) { HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS); + HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); // We expect HistoryService to be available. In case it's not, // (e.g., due to Profile corruption) we let HistoryQuick provider // completions (which may be available because it's a different @@ -292,8 +292,8 @@ history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() { if (index_for_testing_.get()) return index_for_testing_.get(); - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history_service) return NULL; diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc index fcb5838a1a3e2..8678d6dec62aa 100644 --- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc @@ -129,10 +129,9 @@ class HistoryQuickProviderTest : public testing::Test { Profile* profile = static_cast<Profile*>(context); return new TemplateURLService( profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, - scoped_ptr<TemplateURLServiceClient>( - new ChromeTemplateURLServiceClient( - HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS))), + scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( + HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))), NULL, NULL, base::Closure()); } @@ -186,9 +185,8 @@ void HistoryQuickProviderTest::SetUp() { bookmarks::test::WaitForBookmarkModelToLoad( BookmarkModelFactory::GetForProfile(profile_.get())); profile_->BlockUntilHistoryIndexIsRefreshed(); - history_service_ = - HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS); + history_service_ = HistoryServiceFactory::GetForProfile( + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); EXPECT_TRUE(history_service_); provider_ = new HistoryQuickProvider(profile_.get()); TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index d9084c5954470..0ef1066aa80f6 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -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. if (!profile_) return; - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history_service) return; diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc index 1e91d826fe573..062159cdbb269 100644 --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc @@ -175,10 +175,9 @@ class HistoryURLProviderTest : public testing::Test, Profile* profile = static_cast<Profile*>(context); return new TemplateURLService( profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, - scoped_ptr<TemplateURLServiceClient>( - new ChromeTemplateURLServiceClient( - HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS))), + scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( + HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))), NULL, NULL, base::Closure()); } @@ -259,7 +258,7 @@ bool HistoryURLProviderTest::SetUpImpl(bool no_db) { } profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko"); history_service_ = HistoryServiceFactory::GetForProfile( - profile_.get(), Profile::EXPLICIT_ACCESS); + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); autocomplete_ = new HistoryURLProvider(this, profile_.get()); TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index dcb21bfc7add0..1d6b5bda6c77e 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -441,9 +441,8 @@ void SearchProviderTest::QueryForInputAndWaitForFetcherResponses( GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, base::string16 term, int visit_count) { - HistoryService* history = - HistoryServiceFactory::GetForProfile(&profile_, - Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + &profile_, ServiceAccessType::EXPLICIT_ACCESS); GURL search(t_url->url_ref().ReplaceSearchTerms( TemplateURLRef::SearchTermsArgs(term), TemplateURLServiceFactory::GetForProfile( @@ -739,9 +738,11 @@ TEST_F(SearchProviderTest, DontAutocompleteURLLikeTerms) { ASCIIToUTF16("docs.google.com"), 1); // Add the term as a url. - HistoryServiceFactory::GetForProfile(&profile_, Profile::EXPLICIT_ACCESS)-> - AddPageWithDetails(GURL("http://docs.google.com"), base::string16(), 1, 1, - base::Time::Now(), false, history::SOURCE_BROWSED); + HistoryServiceFactory::GetForProfile(&profile_, + ServiceAccessType::EXPLICIT_ACCESS) + ->AddPageWithDetails(GURL("http://docs.google.com"), base::string16(), 1, + 1, base::Time::Now(), false, + history::SOURCE_BROWSED); profile_.BlockUntilHistoryProcessesPendingRequests(); AutocompleteMatch wyt_match; diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc index 3c1633d83ac85..9f8d91d285d97 100644 --- a/chrome/browser/autocomplete/shortcuts_provider.cc +++ b/chrome/browser/autocomplete/shortcuts_provider.cc @@ -109,8 +109,8 @@ void ShortcutsProvider::DeleteMatch(const AutocompleteMatch& match) { // Delete the match from the history DB. This will eventually result in a // second call to DeleteShortcutsWithURL(), which is harmless. - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(history_service); history_service->DeleteURL(url); } diff --git a/chrome/browser/autofill/personal_data_manager_factory.cc b/chrome/browser/autofill/personal_data_manager_factory.cc index 489d15611e4cc..7550508049760 100644 --- a/chrome/browser/autofill/personal_data_manager_factory.cc +++ b/chrome/browser/autofill/personal_data_manager_factory.cc @@ -44,7 +44,7 @@ KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( PersonalDataManager* service = new PersonalDataManager(g_browser_process->GetApplicationLocale()); service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS), + profile, ServiceAccessType::EXPLICIT_ACCESS), profile->GetPrefs(), profile->IsOffTheRecord()); return service; diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index cdf97470fc1e2..68f9d582ceeda 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -458,7 +458,7 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { URLFaviconMap::const_iterator iter = favicons_map_->find(url); if (favicons_map_->end() == iter) { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); favicon_service->GetRawFaviconForPageURL( GURL(url), favicon_base::FAVICON, diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc index ddaebf307feff..b32c2f58e99e7 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc @@ -196,12 +196,12 @@ TEST_F(BookmarkHTMLWriterTest, Test) { const BookmarkNode* f1 = model->AddFolder( model->bookmark_bar_node(), 0, f1_title); model->AddURLWithCreationTimeAndMetaInfo(f1, 0, url1_title, url1, t1, NULL); - HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS)-> - AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED); - FaviconServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) - ->SetFavicons(url1, - url1_favicon, - favicon_base::FAVICON, + HistoryServiceFactory::GetForProfile(&profile, + ServiceAccessType::EXPLICIT_ACCESS) + ->AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED); + FaviconServiceFactory::GetForProfile(&profile, + ServiceAccessType::EXPLICIT_ACCESS) + ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image::CreateFrom1xBitmap(bitmap)); const BookmarkNode* f2 = model->AddFolder(f1, 1, f2_title); model->AddURLWithCreationTimeAndMetaInfo(f2, 0, url2_title, url2, t2, NULL); @@ -234,7 +234,8 @@ TEST_F(BookmarkHTMLWriterTest, Test) { run_loop.Run(); // 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()); // Read the bookmarks back in. diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.cc b/chrome/browser/bookmarks/chrome_bookmark_client.cc index 1823aafadcd1f..0e8ddf2c4d636 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client.cc +++ b/chrome/browser/bookmarks/chrome_bookmark_client.cc @@ -102,8 +102,8 @@ ChromeBookmarkClient::GetFaviconImageForPageURL( favicon_base::IconType type, const favicon_base::FaviconImageCallback& callback, base::CancelableTaskTracker* tracker) { - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return base::CancelableTaskTracker::kBadTaskId; if (type == favicon_base::FAVICON) { diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc index 1f7254780b104..7987a92b97285 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.cc +++ b/chrome/browser/browsing_data/browsing_data_remover.cc @@ -281,7 +281,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, if ((remove_mask & REMOVE_HISTORY) && may_delete_history) { HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { std::set<GURL> restrict_urls; if (!remove_origin_.is_empty()) @@ -383,7 +383,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, // history, so clear them as well. scoped_refptr<autofill::AutofillWebDataService> web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (web_data_service.get()) { waiting_for_clear_autofill_origin_urls_ = true; web_data_service->RemoveOriginURLsModifiedBetween( @@ -544,8 +544,8 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, if (remove_mask & REMOVE_PASSWORDS) { content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); password_manager::PasswordStore* password_store = - PasswordStoreFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) - .get(); + PasswordStoreFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); if (password_store) password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); @@ -555,7 +555,7 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); scoped_refptr<autofill::AutofillWebDataService> web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (web_data_service.get()) { waiting_for_clear_form_ = true; diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 0f7c4244943de..afdc2d3ec80ba 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -383,7 +383,7 @@ class RemoveHistoryTester { if (!profile->CreateHistoryService(true, false)) return false; history_service_ = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); return true; } diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index 364b82f1e466c..a34084b7081ae 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -220,8 +220,8 @@ void CustomHomePagesTableModel::SetObserver(ui::TableModelObserver* observer) { } void CustomHomePagesTableModel::LoadTitle(Entry* entry) { - HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { entry->task_id = history_service->QueryURL( entry->url, diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 9ffc6d2acd46a..6237ab5ef12db 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -251,7 +251,7 @@ class DownloadsHistoryDataCollector { bool WaitForDownloadInfo( scoped_ptr<std::vector<history::DownloadRow> >* results) { HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(hs); hs->QueryDownloads( base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, @@ -1894,10 +1894,11 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PRE_DownloadTest_History) { HistoryObserver observer(browser()->profile()); DownloadAndWait(browser(), download_url); observer.WaitForStored(); - HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::IMPLICIT_ACCESS)->FlushForTest( - base::Bind(&base::MessageLoop::Quit, - base::Unretained(base::MessageLoop::current()->current()))); + HistoryServiceFactory::GetForProfile(browser()->profile(), + ServiceAccessType::IMPLICIT_ACCESS) + ->FlushForTest(base::Bind( + &base::MessageLoop::Quit, + base::Unretained(base::MessageLoop::current()->current()))); content::RunMessageLoop(); } diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc index f69dcc4eb262a..5970de729e94f 100644 --- a/chrome/browser/download/download_service.cc +++ b/chrome/browser/download/download_service.cc @@ -57,7 +57,7 @@ ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() { if (!profile_->IsOffTheRecord()) { HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); history->GetNextDownloadId( manager_delegate_->GetDownloadIdReceiverCallback()); download_history_.reset(new DownloadHistory( diff --git a/chrome/browser/download/download_service_factory.cc b/chrome/browser/download/download_service_factory.cc index 182bc78152e4f..6828dc72b5c53 100644 --- a/chrome/browser/download/download_service_factory.cc +++ b/chrome/browser/download/download_service_factory.cc @@ -7,6 +7,7 @@ #include "chrome/browser/download/download_service.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" // static diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc index c750432256bbb..ad40bc067a679 100644 --- a/chrome/browser/download/download_target_determiner.cc +++ b/chrome/browser/download/download_target_determiner.cc @@ -592,7 +592,7 @@ DownloadTargetDeterminer::Result // HistoryServiceFactory redirects incognito profiles to on-record // profiles. There's no history for on-record profiles in unit_tests. HistoryService* history_service = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); if (history_service && download_->GetReferrerUrl().is_valid()) { history_service->GetVisibleVisitCountToHost( diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc index 8c09a39b6bdd2..093136edad1dd 100644 --- a/chrome/browser/download/download_target_determiner_unittest.cc +++ b/chrome/browser/download/download_target_determiner_unittest.cc @@ -1088,8 +1088,8 @@ TEST_F(DownloadTargetDeterminerTest, TargetDeterminer_VisitedReferrer) { // midnight. base::Time time_of_visit( base::Time::Now().LocalMidnight() - base::TimeDelta::FromSeconds(10)); - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history_service); history_service->AddPage(url, time_of_visit, history::SOURCE_BROWSED); diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc index 7e2ca2329d56b..37ca08ed639d7 100644 --- a/chrome/browser/extensions/api/history/history_api.cc +++ b/chrome/browser/extensions/api/history/history_api.cc @@ -226,8 +226,8 @@ void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { Profile* profile = Profile::FromBrowserContext(browser_context_); history_event_router_.reset(new HistoryEventRouter( - profile, - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS))); + profile, HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))); EventRouter::Get(browser_context_)->UnregisterObserver(this); } @@ -294,7 +294,7 @@ bool HistoryGetVisitsFunction::RunAsyncImpl() { return false; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->QueryURL(url, true, // Retrieve full history of a URL. base::Bind(&HistoryGetVisitsFunction::QueryComplete, @@ -339,7 +339,7 @@ bool HistorySearchFunction::RunAsyncImpl() { options.max_count = *params->query.max_results; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->QueryHistory(search_text, options, base::Bind(&HistorySearchFunction::SearchComplete, @@ -373,7 +373,7 @@ bool HistoryAddUrlFunction::RunAsync() { return false; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION); SendResponse(true); @@ -392,7 +392,7 @@ bool HistoryDeleteUrlFunction::RunAsync() { return false; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->DeleteURL(url); // 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; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->ExpireHistoryBetween( restrict_urls, start_time, @@ -451,7 +451,7 @@ bool HistoryDeleteAllFunction::RunAsyncImpl() { std::set<GURL> restrict_urls; HistoryService* hs = HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); hs->ExpireHistoryBetween( restrict_urls, base::Time(), // Unbounded beginning... diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index 1cc35c7ab845d..ad32f10239ee7 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc @@ -246,7 +246,7 @@ ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate( const std::string& title, const GURL& launch_url) const { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - Profile::FromBrowserContext(context), Profile::EXPLICIT_ACCESS); + Profile::FromBrowserContext(context), ServiceAccessType::EXPLICIT_ACCESS); DCHECK(favicon_service); ChromeAppForLinkDelegate* delegate = new ChromeAppForLinkDelegate; diff --git a/chrome/browser/favicon/chrome_favicon_client.cc b/chrome/browser/favicon/chrome_favicon_client.cc index 68bc7d9c59611..ca34ae37ceb5c 100644 --- a/chrome/browser/favicon/chrome_favicon_client.cc +++ b/chrome/browser/favicon/chrome_favicon_client.cc @@ -17,8 +17,8 @@ ChromeFaviconClient::~ChromeFaviconClient() { } FaviconService* ChromeFaviconClient::GetFaviconService() { - return FaviconServiceFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS); + return FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); } bool ChromeFaviconClient::IsBookmarked(const GURL& url) { diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index 5649f6f229bfb..9f30374a41eb2 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc @@ -1517,7 +1517,7 @@ TEST_F(FaviconHandlerTest, UnableToDownloadFavicon) { profile, BuildHistoryService); FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, Profile::IMPLICIT_ACCESS); + profile, ServiceAccessType::IMPLICIT_ACCESS); FaviconTabHelper::CreateForWebContents(web_contents()); FaviconTabHelper* favicon_tab_helper = diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc index 829f8be6629d6..064151e925a10 100644 --- a/chrome/browser/favicon/favicon_service.cc +++ b/chrome/browser/favicon/favicon_service.cc @@ -78,9 +78,9 @@ std::vector<int> GetPixelSizesForFaviconScales(int size_in_dip) { } // namespace FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) - : history_service_( - HistoryServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS)), + : history_service_(HistoryServiceFactory::GetForProfile( + profile, + ServiceAccessType::EXPLICIT_ACCESS)), profile_(profile), favicon_client_(favicon_client) { } diff --git a/chrome/browser/favicon/favicon_service_factory.cc b/chrome/browser/favicon/favicon_service_factory.cc index 2b6cb2f9bc1cf..628c7f0d8985b 100644 --- a/chrome/browser/favicon/favicon_service_factory.cc +++ b/chrome/browser/favicon/favicon_service_factory.cc @@ -10,15 +10,16 @@ #include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/history/history_service.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" // static -FaviconService* FaviconServiceFactory::GetForProfile( - Profile* profile, Profile::ServiceAccessType sat) { +FaviconService* FaviconServiceFactory::GetForProfile(Profile* profile, + ServiceAccessType sat) { if (!profile->IsOffTheRecord()) { return static_cast<FaviconService*>( GetInstance()->GetServiceForBrowserContext(profile, true)); - } else if (sat == Profile::EXPLICIT_ACCESS) { + } else if (sat == ServiceAccessType::EXPLICIT_ACCESS) { // Profile must be OffTheRecord in this case. return static_cast<FaviconService*>( GetInstance()->GetServiceForBrowserContext( diff --git a/chrome/browser/favicon/favicon_service_factory.h b/chrome/browser/favicon/favicon_service_factory.h index 674e7e94d6113..36157bbb4f1af 100644 --- a/chrome/browser/favicon/favicon_service_factory.h +++ b/chrome/browser/favicon/favicon_service_factory.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_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/core/service_access_type.h" template <typename T> struct DefaultSingletonTraits; -class Profile; class FaviconService; +class Profile; // Singleton that owns all FaviconService and associates them with // Profiles. @@ -20,8 +20,7 @@ class FaviconServiceFactory : public BrowserContextKeyedServiceFactory { public: // |access| defines what the caller plans to do with the service. See // the ServiceAccessType definition in profile.h. - static FaviconService* GetForProfile(Profile* profile, - Profile::ServiceAccessType sat); + static FaviconService* GetForProfile(Profile* profile, ServiceAccessType sat); static FaviconServiceFactory* GetInstance(); diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index f94bc991dec3e..053cdfc20a923 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -119,13 +119,13 @@ void FaviconTabHelper::SaveFavicon() { // Make sure the page is in history, otherwise adding the favicon does // nothing. HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); + profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (!history) return; history->AddPageNoVisitForBookmark(entry->GetURL(), entry->GetTitle()); FaviconService* service = FaviconServiceFactory::GetForProfile( - profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); + profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (!service) return; const FaviconStatus& favicon(entry->GetFavicon()); @@ -147,7 +147,7 @@ void FaviconTabHelper::RemoveObserver(FaviconTabHelperObserver* observer) { int FaviconTabHelper::StartDownload(const GURL& url, int max_image_size) { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); + profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service && favicon_service->WasUnableToDownloadFavicon(url)) { DVLOG(1) << "Skip Failed FavIcon: " << url; return 0; @@ -231,7 +231,7 @@ void FaviconTabHelper::DidStartNavigationToPendingEntry( if (reload_type != NavigationController::NO_RELOAD && !profile_->IsOffTheRecord()) { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, Profile::IMPLICIT_ACCESS); + profile_, ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service) { favicon_service->SetFaviconOutOfDateForPage(url); if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) @@ -294,7 +294,7 @@ void FaviconTabHelper::DidDownloadFavicon( if (bitmaps.empty() && http_status_code == 404) { DVLOG(1) << "Failed to Download Favicon:" << image_url; FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); + profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service) favicon_service->UnableToDownloadFavicon(image_url); } diff --git a/chrome/browser/history/android/android_history_provider_service.cc b/chrome/browser/history/android/android_history_provider_service.cc index 2420c5b800fe1..4bd1f2a8868f6 100644 --- a/chrome/browser/history/android/android_history_provider_service.cc +++ b/chrome/browser/history/android/android_history_provider_service.cc @@ -28,8 +28,8 @@ AndroidHistoryProviderService::QueryHistoryAndBookmarks( const std::string& sort_order, const QueryCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -56,8 +56,8 @@ AndroidHistoryProviderService::UpdateHistoryAndBookmarks( const std::vector<base::string16>& selection_args, const UpdateCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -82,8 +82,8 @@ AndroidHistoryProviderService::DeleteHistoryAndBookmarks( const std::vector<base::string16>& selection_args, const DeleteCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -106,8 +106,8 @@ AndroidHistoryProviderService::InsertHistoryAndBookmark( const history::HistoryAndBookmarkRow& values, const InsertCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -130,8 +130,8 @@ AndroidHistoryProviderService::DeleteHistory( const std::vector<base::string16>& selection_args, const DeleteCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -156,8 +156,8 @@ AndroidHistoryProviderService::MoveStatement( int destination, const MoveStatementCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -178,8 +178,8 @@ AndroidHistoryProviderService::MoveStatement( void AndroidHistoryProviderService::CloseStatement( history::AndroidStatement* statement) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { hs->ScheduleAndForget(HistoryService::PRIORITY_NORMAL, &HistoryBackend::CloseStatement, statement); @@ -193,8 +193,8 @@ AndroidHistoryProviderService::InsertSearchTerm( const history::SearchRow& row, const InsertCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -217,8 +217,8 @@ AndroidHistoryProviderService::UpdateSearchTerms( const std::vector<base::string16>& selection_args, const UpdateCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -243,8 +243,8 @@ AndroidHistoryProviderService::DeleteSearchTerms( const std::vector<base::string16>& selection_args, const DeleteCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -270,8 +270,8 @@ AndroidHistoryProviderService::QuerySearchTerms( const std::string& sort_order, const QueryCallback& callback, base::CancelableTaskTracker* tracker) { - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { DCHECK(hs->thread_) << "History service being called after cleanup"; DCHECK(hs->thread_checker_.CalledOnValidThread()); @@ -296,8 +296,8 @@ AndroidHistoryProviderService::GetLargestRawFaviconForID( favicon_base::FaviconID favicon_id, const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { - FaviconService* fs = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* fs = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(fs); return fs->GetLargestRawFaviconForID(favicon_id, callback, tracker); } diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc index bc7032b54a257..126415504bd22 100644 --- a/chrome/browser/history/android/sqlite_cursor_unittest.cc +++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc @@ -68,8 +68,8 @@ class SQLiteCursorTest : public testing::Test, testing_profile_->CreateFaviconService(); ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); service_.reset(new AndroidHistoryProviderService(testing_profile_)); - hs_ = HistoryServiceFactory::GetForProfile(testing_profile_, - Profile::EXPLICIT_ACCESS); + hs_ = HistoryServiceFactory::GetForProfile( + testing_profile_, ServiceAccessType::EXPLICIT_ACCESS); } virtual void TearDown() override { diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index 655558020ef80..fdefed2c4722a 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc @@ -86,9 +86,8 @@ class HistoryBrowserTest : public InProcessBrowserTest { void WaitForHistoryBackendToRun() { base::CancelableTaskTracker task_tracker; scoped_ptr<history::HistoryDBTask> task(new WaitForHistoryTask()); - HistoryService* history = - HistoryServiceFactory::GetForProfile(GetProfile(), - Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS); history->HistoryService::ScheduleDBTask(task.Pass(), &task_tracker); content::RunMessageLoop(); } @@ -120,12 +119,12 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabled) { EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); EXPECT_TRUE(HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS)); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS)); EXPECT_TRUE(HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::IMPLICIT_ACCESS)); + GetProfile(), ServiceAccessType::IMPLICIT_ACCESS)); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS)); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); @@ -143,12 +142,12 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) { GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); EXPECT_TRUE(HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::EXPLICIT_ACCESS)); + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS)); EXPECT_FALSE(HistoryServiceFactory::GetForProfile( - GetProfile(), Profile::IMPLICIT_ACCESS)); + GetProfile(), ServiceAccessType::IMPLICIT_ACCESS)); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS)); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); @@ -162,7 +161,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) { EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS)); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); WaitForHistoryBackendToRun(); @@ -192,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabledThenEnabled) { GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS)); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); ExpectEmptyHistory(); ui_test_utils::NavigateToURL(browser(), GetTestUrl()); diff --git a/chrome/browser/history/history_service_factory.cc b/chrome/browser/history/history_service_factory.cc index 52d2826baab98..8955bdc6024ef 100644 --- a/chrome/browser/history/history_service_factory.cc +++ b/chrome/browser/history/history_service_factory.cc @@ -12,16 +12,18 @@ #include "chrome/browser/history/chrome_history_client_factory.h" #include "chrome/browser/history/history_service.h" #include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/keyed_service/core/service_access_type.h" // static -HistoryService* HistoryServiceFactory::GetForProfile( - Profile* profile, Profile::ServiceAccessType sat) { +HistoryService* HistoryServiceFactory::GetForProfile(Profile* profile, + ServiceAccessType sat) { // If saving history is disabled, only allow explicit access. if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) && - sat != Profile::EXPLICIT_ACCESS) + sat != ServiceAccessType::EXPLICIT_ACCESS) return NULL; return static_cast<HistoryService*>( @@ -29,12 +31,12 @@ HistoryService* HistoryServiceFactory::GetForProfile( } // static -HistoryService* -HistoryServiceFactory::GetForProfileIfExists( - Profile* profile, Profile::ServiceAccessType sat) { +HistoryService* HistoryServiceFactory::GetForProfileIfExists( + Profile* profile, + ServiceAccessType sat) { // If saving history is disabled, only allow explicit access. if (profile->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) && - sat != Profile::EXPLICIT_ACCESS) + sat != ServiceAccessType::EXPLICIT_ACCESS) return NULL; return static_cast<HistoryService*>( diff --git a/chrome/browser/history/history_service_factory.h b/chrome/browser/history/history_service_factory.h index 06fcc2464833c..01044d6b0d8c5 100644 --- a/chrome/browser/history/history_service_factory.h +++ b/chrome/browser/history/history_service_factory.h @@ -6,20 +6,20 @@ #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_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/core/service_access_type.h" class HistoryService; +class Profile; // Singleton that owns all HistoryService and associates them with // Profiles. class HistoryServiceFactory : public BrowserContextKeyedServiceFactory { public: - static HistoryService* GetForProfile( - Profile* profile, Profile::ServiceAccessType sat); + static HistoryService* GetForProfile(Profile* profile, ServiceAccessType sat); - static HistoryService* GetForProfileIfExists( - Profile* profile, Profile::ServiceAccessType sat); + static HistoryService* GetForProfileIfExists(Profile* profile, + ServiceAccessType sat); static HistoryService* GetForProfileWithoutCreating( Profile* profile); diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index 6eeb49ed710b4..7b59352eccc29 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -142,8 +142,8 @@ HistoryService* HistoryTabHelper::GetHistoryService() { if (profile->IsOffTheRecord()) return NULL; - return HistoryServiceFactory::GetForProfile(profile, - Profile::IMPLICIT_ACCESS); + return HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::IMPLICIT_ACCESS); } void HistoryTabHelper::WebContentsDestroyed() { @@ -153,8 +153,8 @@ void HistoryTabHelper::WebContentsDestroyed() { if (profile->IsOffTheRecord()) return; - HistoryService* hs = - HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::IMPLICIT_ACCESS); if (hs) { NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); if (entry) { diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index b14a19e67048d..7a8ec01361c01 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -310,9 +310,8 @@ void InMemoryURLIndex::OnCacheLoadDone( // Restoring from the History DB ----------------------------------------------- void InMemoryURLIndex::ScheduleRebuildFromHistory() { - HistoryService* service = - HistoryServiceFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS); + HistoryService* service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); service->ScheduleDBTask( scoped_ptr<history::HistoryDBTask>( new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask( diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc index 318e8c9c4ca61..aefe849409bc5 100644 --- a/chrome/browser/history/in_memory_url_index_unittest.cc +++ b/chrome/browser/history/in_memory_url_index_unittest.cc @@ -208,7 +208,7 @@ void InMemoryURLIndexTest::SetUp() { profile_.BlockUntilHistoryProcessesPendingRequests(); profile_.BlockUntilHistoryIndexIsRefreshed(); history_service_ = HistoryServiceFactory::GetForProfile( - &profile_, Profile::EXPLICIT_ACCESS); + &profile_, ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history_service_); HistoryBackend* backend = history_service_->history_backend_.get(); history_database_ = backend->db(); diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 111ddffe25979..713cac78ac122 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -38,9 +38,8 @@ class RedirectTest : public InProcessBrowserTest { RedirectTest() {} std::vector<GURL> GetRedirects(const GURL& url) { - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(browser()->profile(), - Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); // Schedule a history query for redirects. The response will be sent // asynchronously from the callback the history system uses to notify us diff --git a/chrome/browser/history/top_sites_impl.cc b/chrome/browser/history/top_sites_impl.cc index 853e8dac6a30c..5d1a78d1ffce9 100644 --- a/chrome/browser/history/top_sites_impl.cc +++ b/chrome/browser/history/top_sites_impl.cc @@ -450,7 +450,7 @@ base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() { return base::CancelableTaskTracker::kBadTaskId; HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); // |hs| may be null during unit tests. if (hs) { return hs->QueryMostVisitedURLs( diff --git a/chrome/browser/history/top_sites_impl_unittest.cc b/chrome/browser/history/top_sites_impl_unittest.cc index 381c8fbdc4d4b..fa8340a1f7e5a 100644 --- a/chrome/browser/history/top_sites_impl_unittest.cc +++ b/chrome/browser/history/top_sites_impl_unittest.cc @@ -240,8 +240,8 @@ class TopSitesImplTest : public HistoryUnitTestBase { } TestingProfile* profile() {return profile_.get();} HistoryService* history_service() { - return HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS); + return HistoryServiceFactory::GetForProfile( + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); } MostVisitedURLList GetPrepopulatePages() { diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index e94344a099529..4894875accb9e 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -87,20 +87,21 @@ bool ProfileWriter::TemplateURLServiceIsLoaded() const { void ProfileWriter::AddPasswordForm(const autofill::PasswordForm& form) { PasswordStoreFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); + profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddLogin(form); } #if defined(OS_WIN) void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { WebDataServiceFactory::GetPasswordWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS)->AddIE7Login(info); + profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddIE7Login(info); } #endif void ProfileWriter::AddHistoryPage(const history::URLRows& page, history::VisitSource visit_source) { - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> - AddPagesWithDetails(page, visit_source); + HistoryServiceFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS) + ->AddPagesWithDetails(page, visit_source); } void ProfileWriter::AddHomepage(const GURL& home_page) { @@ -233,8 +234,9 @@ void ProfileWriter::AddBookmarks( void ProfileWriter::AddFavicons( const std::vector<ImportedFaviconUsage>& favicons) { - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> - SetImportedFavicons(favicons); + FaviconServiceFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS) + ->SetImportedFavicons(favicons); } typedef std::map<std::string, TemplateURL*> HostPathMap; @@ -335,7 +337,7 @@ void ProfileWriter::AddAutofillFormDataEntries( const std::vector<autofill::AutofillEntry>& autofill_entries) { scoped_refptr<autofill::AutofillWebDataService> web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (web_data_service.get()) web_data_service->UpdateAutofillEntries(autofill_entries); } diff --git a/chrome/browser/importer/profile_writer_unittest.cc b/chrome/browser/importer/profile_writer_unittest.cc index 5dc372cfd6223..8f30d593d8ddc 100644 --- a/chrome/browser/importer/profile_writer_unittest.cc +++ b/chrome/browser/importer/profile_writer_unittest.cc @@ -91,9 +91,8 @@ class ProfileWriterTest : public testing::Test { } void VerifyHistoryCount(Profile* profile) { - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); history::QueryOptions options; base::CancelableTaskTracker history_task_tracker; history_service->QueryHistory( diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index b94bea8684354..10eb183eee5f2 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -468,8 +468,8 @@ void JumpList::StartLoadingFavicon() { return; } - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); task_id_ = favicon_service->GetFaviconImageForPageURL( url, base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)), diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index 055c48bf57939..8dae64bbd7859 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -243,8 +243,8 @@ void MessageCenterSettingsController::GetNotifierList( ContentSettingsForOneType settings; DesktopNotificationProfileUtil::GetNotificationsSettings(profile, &settings); - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); favicon_tracker_.reset(new base::CancelableTaskTracker()); patterns_.clear(); for (ContentSettingsForOneType::const_iterator iter = settings.begin(); diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index f5604c40af73a..a69d75cc400ba 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc @@ -266,9 +266,10 @@ password_manager::PasswordStore* ChromePasswordManagerClient::GetPasswordStore() { // Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord // itself when it shouldn't access the PasswordStore. - // TODO(gcasto): Is is safe to change this to Profile::IMPLICIT_ACCESS? - return PasswordStoreFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS) - .get(); + // TODO(gcasto): Is is safe to change this to + // ServiceAccessType::IMPLICIT_ACCESS? + return PasswordStoreFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); } base::FieldTrial::Probability diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 517dbc5ef5285..c6645e1157df3 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/password_manager/password_store_factory.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/login/login_prompt.h" #include "chrome/browser/ui/login/login_prompt_test_utils.h" @@ -1071,8 +1072,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DontPromptWhenEnableAutomaticPasswordSavingSwitchIsSet) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( - PasswordStoreFactory::GetForProfile(browser()->profile(), - Profile::IMPLICIT_ACCESS).get()); + PasswordStoreFactory::GetForProfile( + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); EXPECT_TRUE(password_store->IsEmpty()); @@ -1162,8 +1163,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoLastLoadGoodLastLoad) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( - PasswordStoreFactory::GetForProfile(browser()->profile(), - Profile::IMPLICIT_ACCESS).get()); + PasswordStoreFactory::GetForProfile( + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); EXPECT_TRUE(password_store->IsEmpty()); // 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) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( - PasswordStoreFactory::GetForProfile(browser()->profile(), - Profile::IMPLICIT_ACCESS).get()); + PasswordStoreFactory::GetForProfile( + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); EXPECT_TRUE(password_store->IsEmpty()); @@ -1318,8 +1319,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, AutofillSuggetionsForPasswordFormWithoutUsernameField) { password_manager::TestPasswordStore* password_store = static_cast<password_manager::TestPasswordStore*>( - PasswordStoreFactory::GetForProfile(browser()->profile(), - Profile::IMPLICIT_ACCESS).get()); + PasswordStoreFactory::GetForProfile( + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); EXPECT_TRUE(password_store->IsEmpty()); diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index cc2fa43c2985c..a23c2354530a4 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc @@ -11,6 +11,7 @@ #include "chrome/browser/password_manager/password_manager_util.h" #include "chrome/browser/password_manager/sync_metrics.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/webdata/web_data_service_factory.h" #include "chrome/common/chrome_constants.h" @@ -89,8 +90,8 @@ void PasswordStoreService::Shutdown() { // static scoped_refptr<PasswordStore> PasswordStoreFactory::GetForProfile( Profile* profile, - Profile::ServiceAccessType sat) { - if (sat == Profile::IMPLICIT_ACCESS && profile->IsOffTheRecord()) { + ServiceAccessType sat) { + if (sat == ServiceAccessType::IMPLICIT_ACCESS && profile->IsOffTheRecord()) { NOTREACHED() << "This profile is OffTheRecord"; return NULL; } @@ -171,7 +172,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor( db_thread_runner, login_db.release(), WebDataServiceFactory::GetPasswordWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS)); + profile, ServiceAccessType::EXPLICIT_ACCESS)); #elif defined(OS_MACOSX) crypto::AppleKeychain* keychain = base::CommandLine::ForCurrentProcess()->HasSwitch( diff --git a/chrome/browser/password_manager/password_store_factory.h b/chrome/browser/password_manager/password_store_factory.h index 60141401ac4b8..6a13e67a994af 100644 --- a/chrome/browser/password_manager/password_store_factory.h +++ b/chrome/browser/password_manager/password_store_factory.h @@ -7,9 +7,9 @@ #include "base/basictypes.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/core/keyed_service.h" +#include "components/keyed_service/core/service_access_type.h" class Profile; @@ -50,7 +50,7 @@ class PasswordStoreFactory : public BrowserContextKeyedServiceFactory { public: static scoped_refptr<password_manager::PasswordStore> GetForProfile( Profile* profile, - Profile::ServiceAccessType set); + ServiceAccessType set); static PasswordStoreFactory* GetInstance(); diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index b5e3aa81876d5..bb1a19ca2ddaf 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -82,7 +82,7 @@ AutocompleteActionPredictor::AutocompleteActionPredictor(Profile* profile) // Request the in-memory database from the history to force it to load so // it's available as soon as possible. HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) history_service->InMemoryDatabase(); @@ -463,8 +463,8 @@ void AutocompleteActionPredictor::CreateCaches( } // If the history service is ready, delete any old or invalid entries. - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!TryDeleteOldEntries(history_service)) { // Wait for the notification that the history service is ready and the URL // DB is loaded. diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc index 024279e9b3556..3a27a30654cc5 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc @@ -127,9 +127,8 @@ class AutocompleteActionPredictorTest : public testing::Test { } history::URLID AddRowToHistory(const TestUrlInfo& test_row) { - HistoryService* history = - HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); CHECK(history); history::URLDatabase* url_db = history->InMemoryDatabase(); CHECK(url_db); @@ -189,9 +188,8 @@ class AutocompleteActionPredictorTest : public testing::Test { void DeleteOldIdsFromCaches( std::vector<AutocompleteActionPredictorTable::Row::Id>* id_list) { - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history_service); history::URLDatabase* url_db = history_service->InMemoryDatabase(); diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index a2d96b756dc2d..fe20d099bfa78 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc @@ -605,7 +605,7 @@ void ResourcePrefetchPredictor::OnNavigationComplete( // Kick off history lookup to determine if we should record the URL. HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(history_service); history_service->ScheduleDBTask( scoped_ptr<history::HistoryDBTask>( @@ -1347,8 +1347,8 @@ void ResourcePrefetchPredictor::OnHistoryServiceLoaded( void ResourcePrefetchPredictor::ConnectToHistoryService() { // Register for HistoryServiceLoading if it is not ready. - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history_service) return; if (history_service->BackendLoaded()) { diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index fba54cacb4efe..4087050e9fb61 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc @@ -79,7 +79,7 @@ class ResourcePrefetchPredictorTest : public testing::Test { protected: void AddUrlToHistory(const std::string& url, int visit_count) { HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS)-> + ServiceAccessType::EXPLICIT_ACCESS)-> AddPageWithDetails( GURL(url), base::string16(), @@ -186,8 +186,8 @@ void ResourcePrefetchPredictorTest::SetUp() { ASSERT_TRUE(profile_->CreateHistoryService(true, false)); profile_->BlockUntilHistoryProcessesPendingRequests(); - EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(), - Profile::EXPLICIT_ACCESS)); + EXPECT_TRUE(HistoryServiceFactory::GetForProfile( + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS)); // Initialize the predictor with empty data. ResetPredictor(); EXPECT_EQ(predictor_->initialization_state_, diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index f3d3e245b29da..66950d12a22cd 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -1357,7 +1357,7 @@ PrerenderHandle* PrerenderManager::AddPrerender( // Query the history to see if the URL being prerendered has ever been // visited before. HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { history_service->QueryURL( url, diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc index b3af5aa0a6e18..7baa510aff070 100644 --- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc +++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc @@ -151,7 +151,7 @@ KeyedService* ProfileResetterTest::CreateTemplateURLService( profile->GetPrefs(), scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), WebDataServiceFactory::GetKeywordWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS), + profile, ServiceAccessType::EXPLICIT_ACCESS), scoped_ptr<TemplateURLServiceClient>(), NULL, NULL, base::Closure()); } diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index f76f30e1b0a9a..90fcb93bf4c9c 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -74,31 +74,6 @@ class PrefRegistrySyncable; // http://dev.chromium.org/developers/design-documents/profile-architecture class Profile : public content::BrowserContext { 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 { // Profile services were not created due to a local error (e.g., disk full). CREATE_STATUS_LOCAL_FAIL, diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index eb7df5240a359..adff57b742d45 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -1154,8 +1154,8 @@ void ProfileManager::FinishDeletingProfile(const base::FilePath& profile_dir) { ProfileMetrics::LogProfileDelete(profile_is_signed_in); // Some platforms store passwords in keychains. They should be removed. scoped_refptr<password_manager::PasswordStore> password_store = - PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) - .get(); + PasswordStoreFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS).get(); if (password_store.get()) { password_store->RemoveLoginsCreatedBetween(base::Time(), base::Time::Max()); diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc index 1a89c12982020..e917c26ca2c7a 100644 --- a/chrome/browser/profiles/profile_manager_browsertest.cc +++ b/chrome/browser/profiles/profile_manager_browsertest.cc @@ -420,8 +420,8 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeletePasswords) { form.blacklisted_by_user = false; scoped_refptr<password_manager::PasswordStore> password_store = - PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) - .get(); + PasswordStoreFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS).get(); ASSERT_TRUE(password_store.get()); password_store->AddLogin(form); diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index c3ffe9e19df34..c05da3b9a20af 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -263,15 +263,15 @@ TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) { // Force lazy-init of some profile services to simulate use. ASSERT_TRUE(profile1->CreateHistoryService(true, false)); - EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, - Profile::EXPLICIT_ACCESS)); + EXPECT_TRUE(HistoryServiceFactory::GetForProfile( + profile1, ServiceAccessType::EXPLICIT_ACCESS)); profile1->CreateBookmarkModel(true); EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); profile2->CreateBookmarkModel(true); EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); ASSERT_TRUE(profile2->CreateHistoryService(true, false)); - EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, - Profile::EXPLICIT_ACCESS)); + EXPECT_TRUE(HistoryServiceFactory::GetForProfile( + profile2, ServiceAccessType::EXPLICIT_ACCESS)); // Make sure any pending tasks run before we destroy the profiles. base::RunLoop().RunUntilIdle(); diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc index 02458dad88a7f..d57ade8dffa9a 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -458,8 +458,8 @@ bool BrowserFeatureExtractor::GetHistoryService(HistoryService** history) { *history = NULL; if (tab_ && tab_->GetBrowserContext()) { Profile* profile = Profile::FromBrowserContext(tab_->GetBrowserContext()); - *history = HistoryServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS); + *history = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); if (*history) { return true; } diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc index 98492331db59c..18c7cfeacd2e4 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc @@ -103,8 +103,8 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness { } HistoryService* history_service() { - return HistoryServiceFactory::GetForProfile(profile(), - Profile::EXPLICIT_ACCESS); + return HistoryServiceFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS); } void SetRedirectChain(const std::vector<GURL>& redirect_chain, diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc index a529d68db4f59..84983f71f7510 100644 --- a/chrome/browser/safe_browsing/download_protection_service.cc +++ b/chrome/browser/safe_browsing/download_protection_service.cc @@ -23,6 +23,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_service.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/download_feedback_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" @@ -676,8 +677,8 @@ class DownloadProtectionService::CheckClientDownloadRequest } Profile* profile = Profile::FromBrowserContext(item_->GetBrowserContext()); - HistoryService* history = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); if (!history) { SendRequest(); return; diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index 1d663680f3253..628211f4dd1cc 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -1549,7 +1549,8 @@ TEST_F(DownloadProtectionServiceTest, redirects.push_back(GURL("http://tab.com/ref1")); redirects.push_back(GURL("http://tab.com/ref2")); redirects.push_back(tab_url); - HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) + HistoryServiceFactory::GetForProfile(&profile, + ServiceAccessType::EXPLICIT_ACCESS) ->AddPage(tab_url, base::Time::Now(), reinterpret_cast<history::ContextID>(1), diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc index cda5a88c4fc66..7c311c9dc0ecf 100644 --- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc +++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc @@ -227,8 +227,8 @@ void LastDownloadFinder::OnMetadataQuery( } else { // Search history since no metadata was found. iter->second = WAITING_FOR_HISTORY; - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::IMPLICIT_ACCESS); // No history service is returned for profiles that do not save history. if (!history_service) { RemoveProfileAndReportIfDone(iter); @@ -324,7 +324,7 @@ void LastDownloadFinder::OnHistoryServiceLoaded( HistoryService* history_service) { for (const auto& pair : profile_states_) { HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( - pair.first, Profile::EXPLICIT_ACCESS); + pair.first, ServiceAccessType::EXPLICIT_ACCESS); if (hs == history_service) { // Start the query in the history service if the finder was waiting for // the service to load. diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc index ced861c154eb7..4897b512982d7 100644 --- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc @@ -74,8 +74,8 @@ class LastDownloadFinderTest : public testing::Test { // download to its history. void CreateProfileWithDownload() { TestingProfile* profile = CreateProfile(SAFE_BROWSING_OPT_IN); - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); history_service->CreateDownload( CreateTestDownloadRow(), base::Bind(&LastDownloadFinderTest::OnDownloadCreated, @@ -162,8 +162,8 @@ class LastDownloadFinderTest : public testing::Test { void AddDownload(Profile* profile, const history::DownloadRow& download) { base::RunLoop run_loop; - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); history_service->CreateDownload( download, base::Bind(&LastDownloadFinderTest::ContinueOnDownloadCreated, @@ -183,7 +183,8 @@ class LastDownloadFinderTest : public testing::Test { // dtor must be run. void FlushHistoryBackend(Profile* profile) { base::RunLoop run_loop; - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) + HistoryServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS) ->FlushForTest(run_loop.QuitClosure()); run_loop.Run(); // Then make sure anything bounced back to the main thread has been handled. diff --git a/chrome/browser/safe_browsing/malware_details_history.cc b/chrome/browser/safe_browsing/malware_details_history.cc index d628a61d785ae..7c04ab9331747 100644 --- a/chrome/browser/safe_browsing/malware_details_history.cc +++ b/chrome/browser/safe_browsing/malware_details_history.cc @@ -89,7 +89,7 @@ void MalwareDetailsRedirectsCollector::GetRedirects(const GURL& url) { } HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history) { AllDone(); return; diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc index 6d0c75d521860..8b4dae492ac01 100644 --- a/chrome/browser/safe_browsing/malware_details_unittest.cc +++ b/chrome/browser/safe_browsing/malware_details_unittest.cc @@ -215,8 +215,8 @@ class MalwareDetailsTest : public ChromeRenderViewHostTestHarness { } HistoryService* history_service() { - return HistoryServiceFactory::GetForProfile(profile(), - Profile::EXPLICIT_ACCESS); + return HistoryServiceFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS); } protected: diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index e3ef8b613d9b6..667e09fe0392a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -192,8 +192,8 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( RecordUserDecision(PROCEEDING_DISABLED); HistoryService* history_service = HistoryServiceFactory::GetForProfile( - Profile::FromBrowserContext(web_contents->GetBrowserContext()), - Profile::EXPLICIT_ACCESS); + Profile::FromBrowserContext(web_contents->GetBrowserContext()), + ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { history_service->GetVisibleVisitCountToHost( request_url(), diff --git a/chrome/browser/search_engines/template_url_service_factory.cc b/chrome/browser/search_engines/template_url_service_factory.cc index 1b745464cd068..ffab5b4692cd0 100644 --- a/chrome/browser/search_engines/template_url_service_factory.cc +++ b/chrome/browser/search_engines/template_url_service_factory.cc @@ -12,6 +12,7 @@ #include "chrome/browser/google/google_url_tracker_factory.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/rlz/rlz.h" #include "chrome/browser/search_engines/chrome_template_url_service_client.h" #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" @@ -49,10 +50,10 @@ KeyedService* TemplateURLServiceFactory::BuildInstanceFor( profile->GetPrefs(), scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), WebDataServiceFactory::GetKeywordWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS), + profile, ServiceAccessType::EXPLICIT_ACCESS), scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( - HistoryServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS))), + HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))), GoogleURLTrackerFactory::GetForProfile(profile), g_browser_process->rappor_service(), dsp_change_callback); diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc index 1d3748c1fde07..940f714548703 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.cc +++ b/chrome/browser/search_engines/template_url_service_test_util.cc @@ -114,11 +114,10 @@ void TemplateURLServiceTestUtil::ResetModel(bool verify_load) { model_.reset(new TemplateURLService( profile()->GetPrefs(), scoped_ptr<SearchTermsData>(search_terms_data_), web_data_service_.get(), - scoped_ptr<TemplateURLServiceClient>( - new TestingTemplateURLServiceClient( - HistoryServiceFactory::GetForProfileIfExists( - profile(), Profile::EXPLICIT_ACCESS), - &search_term_)), + scoped_ptr<TemplateURLServiceClient>(new TestingTemplateURLServiceClient( + HistoryServiceFactory::GetForProfileIfExists( + profile(), ServiceAccessType::EXPLICIT_ACCESS), + &search_term_)), NULL, NULL, base::Closure())); model()->AddObserver(this); changed_count_ = 0; diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc index a4aaf79d51c85..ba6ab6196707b 100644 --- a/chrome/browser/signin/chrome_signin_client.cc +++ b/chrome/browser/signin/chrome_signin_client.cc @@ -120,7 +120,7 @@ PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); } scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { return WebDataServiceFactory::GetTokenWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); } bool ChromeSigninClient::CanRevokeCredentials() { diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 1f70870eec29e..1f052e0d716e0 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -350,7 +350,7 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, if (internal_) RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { history_service->GetVisibleVisitCountToHost( request_url, diff --git a/chrome/browser/supervised_user/supervised_user_browsertest.cc b/chrome/browser/supervised_user/supervised_user_browsertest.cc index 8997176eb94d3..c98d875a320dd 100644 --- a/chrome/browser/supervised_user/supervised_user_browsertest.cc +++ b/chrome/browser/supervised_user/supervised_user_browsertest.cc @@ -268,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, // Query the history entry. HistoryService* history_service = HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); history::QueryOptions options; history::QueryResults results; QueryHistory(history_service, "", options, &results); diff --git a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc index 163081e4204fc..0d55232bd7125 100644 --- a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc +++ b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc @@ -235,8 +235,8 @@ void SupervisedUserNavigationObserver::OnRequestBlockedInternal( // Add the entry to the history database. Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::IMPLICIT_ACCESS); // |history_service| is null if saving history is disabled. if (history_service) diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index 70115691e57f3..87d713292977a 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -63,7 +63,7 @@ bool AutofillDataTypeController::StartModels() { autofill::AutofillWebDataService* web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS).get(); + profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); if (!web_data_service) return false; diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index b476dc472a234..972d169b60c40 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -192,10 +192,9 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { // immediately try to start association and fail (due to missing DB // thread). TEST_F(SyncAutofillDataTypeControllerTest, StartWDSReady) { - FakeWebDataService* web_db = - static_cast<FakeWebDataService*>( - WebDataServiceFactory::GetAutofillWebDataForProfile( - &profile_, Profile::EXPLICIT_ACCESS).get()); + FakeWebDataService* web_db = static_cast<FakeWebDataService*>( + WebDataServiceFactory::GetAutofillWebDataForProfile( + &profile_, ServiceAccessType::EXPLICIT_ACCESS).get()); web_db->LoadDatabase(); autofill_dtc_->LoadModels( base::Bind(&SyncAutofillDataTypeControllerTest::OnLoadFinished, @@ -228,7 +227,7 @@ TEST_F(SyncAutofillDataTypeControllerTest, StartWDSNotReady) { FakeWebDataService* web_db = static_cast<FakeWebDataService*>( WebDataServiceFactory::GetAutofillWebDataForProfile( - &profile_, Profile::EXPLICIT_ACCESS).get()); + &profile_, ServiceAccessType::EXPLICIT_ACCESS).get()); web_db->LoadDatabase(); autofill_dtc_->StartAssociating( diff --git a/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc b/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc index 990738684da9e..ad0ec69f16a7f 100644 --- a/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc @@ -54,7 +54,7 @@ void AutofillProfileDataTypeController::OnPersonalDataChanged() { personal_data_->RemoveObserver(this); autofill::AutofillWebDataService* web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS).get(); + profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); if (!web_data_service) return; @@ -92,7 +92,7 @@ bool AutofillProfileDataTypeController::StartModels() { autofill::AutofillWebDataService* web_data_service = WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS).get(); + profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); if (!web_data_service) return false; diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index e706a5aebc16f..50020adf028f5 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -870,10 +870,10 @@ void BookmarkChangeProcessor::ApplyBookmarkFavicon( Profile* profile, const GURL& icon_url, const scoped_refptr<base::RefCountedMemory>& bitmap_data) { - HistoryService* history = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); history->AddPageNoVisitForBookmark(bookmark_node->url(), bookmark_node->GetTitle()); diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc index c36b94a088e23..6374a5db45074 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc @@ -47,7 +47,7 @@ bool BookmarkDataTypeController::StartModels() { BookmarkModelFactory::GetForProfile(profile_); bookmark_model_observer_.Add(bookmark_model); HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); history_service_observer_.Add(history_service); return false; } @@ -95,7 +95,7 @@ bool BookmarkDataTypeController::DependentsLoaded() { return false; HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history || !history->BackendLoaded()) return false; diff --git a/chrome/browser/sync/glue/favicon_cache.cc b/chrome/browser/sync/glue/favicon_cache.cc index f591fe4fa24ba..342a049a3f680 100644 --- a/chrome/browser/sync/glue/favicon_cache.cc +++ b/chrome/browser/sync/glue/favicon_cache.cc @@ -434,8 +434,8 @@ void FaviconCache::OnPageFaviconUpdated(const GURL& page_url) { page_task_map_[page_url] = 0; // For testing only. return; } - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; // TODO(zea): This appears to only fetch one favicon (best match based on diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc index 683de68f423db..354d8f93a084e 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.cc +++ b/chrome/browser/sync/glue/password_data_type_controller.cc @@ -51,7 +51,7 @@ bool PasswordDataTypeController::StartModels() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(MODEL_STARTING, state()); password_store_ = PasswordStoreFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); return !!password_store_.get(); } diff --git a/chrome/browser/sync/glue/sync_backend_registrar.cc b/chrome/browser/sync/glue/sync_backend_registrar.cc index 97fa4efcba2a0..92984af498a4d 100644 --- a/chrome/browser/sync/glue/sync_backend_registrar.cc +++ b/chrome/browser/sync/glue/sync_backend_registrar.cc @@ -94,8 +94,8 @@ SyncBackendRegistrar::SyncBackendRegistrar( // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. tracked_objects::ScopedTracker tracker2(FROM_HERE_WITH_EXPLICIT_FUNCTION( "426272 SyncBackendRegistrar::ctor history")); - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::IMPLICIT_ACCESS); if (history_service) { workers_[syncer::GROUP_HISTORY] = new HistoryModelWorker(history_service->AsWeakPtr(), this); @@ -107,7 +107,8 @@ SyncBackendRegistrar::SyncBackendRegistrar( tracked_objects::ScopedTracker tracker3(FROM_HERE_WITH_EXPLICIT_FUNCTION( "426272 SyncBackendRegistrar::ctor passwords")); scoped_refptr<password_manager::PasswordStore> password_store = - PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); + PasswordStoreFactory::GetForProfile(profile, + ServiceAccessType::IMPLICIT_ACCESS); if (password_store.get()) { workers_[syncer::GROUP_PASSWORD] = new PasswordModelWorker(password_store, this); diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc index 38405b8dee92a..cfdc8e7d57c2b 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc @@ -126,7 +126,7 @@ bool TypedUrlDataTypeController::PostTaskOnBackendThread( const base::Closure& task) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); HistoryService* history = HistoryServiceFactory::GetForProfile( - profile(), Profile::IMPLICIT_ACCESS); + profile(), ServiceAccessType::IMPLICIT_ACCESS); if (history) { history->ScheduleDBTask( scoped_ptr<history::HistoryDBTask>( diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index 70113a19b436b..e59d538104bcb 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -163,7 +163,7 @@ ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( command_line_(command_line), web_data_service_(WebDataServiceFactory::GetAutofillWebDataForProfile( profile_, - Profile::EXPLICIT_ACCESS)), + ServiceAccessType::EXPLICIT_ACCESS)), sync_service_url_(sync_service_url), token_service_(token_service), url_request_context_getter_(url_request_context_getter), @@ -502,9 +502,8 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: GetThemeSyncableService()->AsWeakPtr(); #endif case syncer::HISTORY_DELETE_DIRECTIVES: { - HistoryService* history = - HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); } #if defined(ENABLE_SPELLCHECK) @@ -550,8 +549,8 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: case syncer::PASSWORDS: { #if defined(PASSWORD_MANAGER_ENABLE_SYNC) scoped_refptr<password_manager::PasswordStore> password_store = - PasswordStoreFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS); + PasswordStoreFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); return password_store.get() ? password_store->GetPasswordSyncableService() : base::WeakPtr<syncer::SyncableService>(); #else diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 506ebe2af1e66..d5299110d83fc 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -183,7 +183,8 @@ void ClearBrowsingData(BrowsingDataRemover::Observer* observer, BrowsingDataHelper::ALL); scoped_refptr<password_manager::PasswordStore> password = - PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + PasswordStoreFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS); password->RemoveLoginsSyncedBetween(start, end); } diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index a4a9e4483fbba..4931a98746514 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -497,7 +497,7 @@ class ProfileSyncServiceAutofillTest personal_data_manager_->Init( WebDataServiceFactory::GetAutofillWebDataForProfile( - profile_, Profile::EXPLICIT_ACCESS), + profile_, ServiceAccessType::EXPLICIT_ACCESS), profile_->GetPrefs(), profile_->IsOffTheRecord()); diff --git a/chrome/browser/sync/sessions/notification_service_sessions_router.cc b/chrome/browser/sync/sessions/notification_service_sessions_router.cc index 9ae1027f70d16..6c7f74ca913ba 100644 --- a/chrome/browser/sync/sessions/notification_service_sessions_router.cc +++ b/chrome/browser/sync/sessions/notification_service_sessions_router.cc @@ -58,8 +58,8 @@ NotificationServiceSessionsRouter::NotificationServiceSessionsRouter( registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::NotificationService::AllBrowserContextsAndSources()); - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { favicon_changed_subscription_ = history_service->AddFaviconChangedCallback( base::Bind(&NotificationServiceSessionsRouter::OnFaviconChanged, diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc index 7ca66e91939d1..b5877fc5c3692 100644 --- a/chrome/browser/sync/test/integration/autofill_helper.cc +++ b/chrome/browser/sync/test/integration/autofill_helper.cc @@ -167,7 +167,7 @@ AutofillProfile CreateAutofillProfile(ProfileType type) { scoped_refptr<AutofillWebDataService> GetWebDataService(int index) { return WebDataServiceFactory::GetAutofillWebDataForProfile( - test()->GetProfile(index), Profile::EXPLICIT_ACCESS); + test()->GetProfile(index), ServiceAccessType::EXPLICIT_ACCESS); } PersonalDataManager* GetPersonalDataManager(int index) { diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index eb043acde8695..270f57e08866b 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -230,9 +230,8 @@ void SetFaviconImpl(Profile* profile, BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); FaviconChangeObserver observer(model, node); - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); if (favicon_source == bookmarks_helper::FROM_UI) { favicon_service->SetFavicons( node->url(), icon_url, favicon_base::FAVICON, image); diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index ec0272bb6e6a0..1237a9b7e1e33 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc @@ -134,12 +134,13 @@ bool SetDecryptionPassphrase(int index, const std::string& passphrase) { PasswordStore* GetPasswordStore(int index) { return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), - Profile::IMPLICIT_ACCESS).get(); + ServiceAccessType::IMPLICIT_ACCESS) + .get(); } PasswordStore* GetVerifierPasswordStore() { - return PasswordStoreFactory::GetForProfile(test()->verifier(), - Profile::IMPLICIT_ACCESS).get(); + return PasswordStoreFactory::GetForProfile( + test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS).get(); } bool ProfileContainsSamePasswordFormsAsVerifier(int index) { diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 4ebe2361c86eb..7f345faf82423 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -397,7 +397,7 @@ bool SyncTest::SetupClients() { bookmarks::test::WaitForBookmarkModelToLoad( BookmarkModelFactory::GetForProfile(verifier())); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - verifier(), Profile::EXPLICIT_ACCESS)); + verifier(), ServiceAccessType::EXPLICIT_ACCESS)); ui_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(verifier())); return (verifier_ != NULL); @@ -457,7 +457,7 @@ void SyncTest::InitializeInstance(int index) { bookmarks::test::WaitForBookmarkModelToLoad( BookmarkModelFactory::GetForProfile(GetProfile(index))); ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( - GetProfile(index), Profile::EXPLICIT_ACCESS)); + GetProfile(index), ServiceAccessType::EXPLICIT_ACCESS)); ui_test_utils::WaitForTemplateURLServiceToLoad( TemplateURLServiceFactory::GetForProfile(GetProfile(index))); } diff --git a/chrome/browser/sync/test/integration/typed_urls_helper.cc b/chrome/browser/sync/test/integration/typed_urls_helper.cc index 920cb90829620..1ad6970d9f0e0 100644 --- a/chrome/browser/sync/test/integration/typed_urls_helper.cc +++ b/chrome/browser/sync/test/integration/typed_urls_helper.cc @@ -285,13 +285,9 @@ void AddUrlToHistoryWithTimestamp(int index, source, timestamp); if (test()->use_verifier()) - AddToHistory( - HistoryServiceFactory::GetForProfile(test()->verifier(), - Profile::IMPLICIT_ACCESS), - url, - transition, - source, - timestamp); + AddToHistory(HistoryServiceFactory::GetForProfile( + test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS), + url, transition, source, timestamp); // 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 @@ -303,9 +299,8 @@ void DeleteUrlFromHistory(int index, const GURL& url) { HistoryServiceFactory::GetForProfileWithoutCreating( test()->GetProfile(index))->DeleteURL(url); if (test()->use_verifier()) - HistoryServiceFactory::GetForProfile(test()->verifier(), - Profile::IMPLICIT_ACCESS)-> - DeleteURL(url); + HistoryServiceFactory::GetForProfile( + test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS)->DeleteURL(url); WaitForHistoryDBThread(index); } @@ -314,8 +309,8 @@ void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) { test()->GetProfile(index))->DeleteURLsForTest(urls); if (test()->use_verifier()) HistoryServiceFactory::GetForProfile(test()->verifier(), - Profile::IMPLICIT_ACCESS)-> - DeleteURLsForTest(urls); + ServiceAccessType::IMPLICIT_ACCESS) + ->DeleteURLsForTest(urls); WaitForHistoryDBThread(index); } @@ -375,9 +370,8 @@ bool CheckURLRowsAreEqual( } bool CheckAllProfilesHaveSameURLsAsVerifier() { - HistoryService* verifier_service = - HistoryServiceFactory::GetForProfile(test()->verifier(), - Profile::IMPLICIT_ACCESS); + HistoryService* verifier_service = HistoryServiceFactory::GetForProfile( + test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS); history::URLRows verifier_urls = GetTypedUrlsFromHistoryService(verifier_service); for (int i = 0; i < test()->num_clients(); ++i) { diff --git a/chrome/browser/ui/android/navigation_popup.cc b/chrome/browser/ui/android/navigation_popup.cc index 48876a59380fb..d23655ab23d8a 100644 --- a/chrome/browser/ui/android/navigation_popup.cc +++ b/chrome/browser/ui/android/navigation_popup.cc @@ -41,7 +41,7 @@ void NavigationPopup::FetchFaviconForUrl(JNIEnv* env, jstring jurl) { Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc index 7fcf1caae4d5d..b14193aee695d 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc @@ -276,12 +276,11 @@ class TestAutofillDialogController } void Init(content::BrowserContext* browser_context) { - test_manager_.Init( - WebDataServiceFactory::GetAutofillWebDataForProfile( - Profile::FromBrowserContext(browser_context), - Profile::EXPLICIT_ACCESS), - user_prefs::UserPrefs::Get(browser_context), - browser_context->IsOffTheRecord()); + test_manager_.Init(WebDataServiceFactory::GetAutofillWebDataForProfile( + Profile::FromBrowserContext(browser_context), + ServiceAccessType::EXPLICIT_ACCESS), + user_prefs::UserPrefs::Get(browser_context), + browser_context->IsOffTheRecord()); } TestAutofillDialogView* GetView() { diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc index 3c7efd697d43a..4f728efcb86f2 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.cc +++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc @@ -91,7 +91,7 @@ scoped_refptr<AutofillWebDataService> ChromeAutofillClient::GetDatabase() { Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); return WebDataServiceFactory::GetAutofillWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); } PrefService* ChromeAutofillClient::GetPrefs() { diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index 1f43718a276b4..bd9045310e440 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm @@ -74,7 +74,7 @@ HistoryMenuBridge::HistoryMenuBridge(Profile* profile) // may not be ready when the Bridge is created. If this happens, register // for a notification that tells us the HistoryService is ready. HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile_, Profile::EXPLICIT_ACCESS); + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (hs) { history_service_observer_.Add(hs); if (hs->BackendLoaded()) { @@ -432,8 +432,8 @@ HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForTab( } void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { - FaviconService* service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); base::CancelableTaskTracker::TaskId task_id = service->GetFaviconImageForPageURL( item->url, diff --git a/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller_unittest.mm index 176c5fec8b466..29877e13e88b7 100644 --- a/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller_unittest.mm @@ -63,8 +63,8 @@ class ManagePasswordItemViewControllerTest password_manager::MockPasswordStore* mockStore() { password_manager::PasswordStore* store = - PasswordStoreFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS) - .get(); + PasswordStoreFactory::GetForProfile( + profile(), ServiceAccessType::EXPLICIT_ACCESS).get(); password_manager::MockPasswordStore* mockStore = static_cast<password_manager::MockPasswordStore*>(store); return mockStore; diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 07b04aa41e850..7007f872bfc3e 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -187,10 +187,11 @@ class FindInPageControllerTest : public InProcessBrowserTest { } void FlushHistoryService() { - HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::IMPLICIT_ACCESS)->FlushForTest( - base::Bind(&base::MessageLoop::Quit, - base::Unretained(base::MessageLoop::current()->current()))); + HistoryServiceFactory::GetForProfile(browser()->profile(), + ServiceAccessType::IMPLICIT_ACCESS) + ->FlushForTest(base::Bind( + &base::MessageLoop::Quit, + base::Unretained(base::MessageLoop::current()->current()))); content::RunMessageLoop(); } }; diff --git a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc index 5d237ee4b19a6..7b549c4e382fa 100644 --- a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc +++ b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc @@ -75,8 +75,8 @@ bool AlternateNavInfoBarDelegate::LinkClicked( } // Tell the history system to remove any saved search term for the search. - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, Profile::IMPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::IMPLICIT_ACCESS); if (history_service) history_service->DeleteKeywordSearchTermForURL(search_url_); diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 9ab2c6740fe0a..5e1fb6c558402 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -289,7 +289,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) { Profile* profile = browser()->profile(); HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history_service); if (!history_service->BackendLoaded()) { diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc index f0c201d75c0a2..d2473760db142 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" #include "chrome/browser/password_manager/password_store_factory.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" @@ -306,8 +307,8 @@ void ManagePasswordsBubbleModel::OnPasswordAction( Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); password_manager::PasswordStore* password_store = - PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) - .get(); + PasswordStoreFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS).get(); DCHECK(password_store); if (action == REMOVE_PASSWORD) password_store->RemoveLogin(password_form); diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index d897ff63083a4..67787ba8a940e 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc @@ -35,7 +35,7 @@ password_manager::PasswordStore* GetPasswordStore( content::WebContents* web_contents) { return PasswordStoreFactory::GetForProfile( Profile::FromBrowserContext(web_contents->GetBrowserContext()), - Profile::EXPLICIT_ACCESS).get(); + ServiceAccessType::EXPLICIT_ACCESS).get(); } autofill::ConstPasswordFormMap ConstifyMap( diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc index b22aca2f87adb..1e7c1d041e462 100644 --- a/chrome/browser/ui/passwords/password_manager_presenter.cc +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc @@ -14,6 +14,7 @@ #include "chrome/browser/password_manager/password_manager_util.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/password_manager/sync_metrics.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/passwords/password_ui_view.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" @@ -69,7 +70,8 @@ void PasswordManagerPresenter::OnLoginsChanged( PasswordStore* PasswordManagerPresenter::GetPasswordStore() { return PasswordStoreFactory::GetForProfile(password_view_->GetProfile(), - Profile::EXPLICIT_ACCESS).get(); + ServiceAccessType::EXPLICIT_ACCESS) + .get(); } void PasswordManagerPresenter::UpdatePasswordLists() { diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc index dd398dc57f4ff..8b0f37f74391d 100644 --- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc +++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc @@ -202,7 +202,7 @@ class InstantExtendedTest : public InProcessBrowserTest, return false; HistoryService* history = HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); GURL search(template_url->url_ref().ReplaceSearchTerms( TemplateURLRef::SearchTermsArgs(term), TemplateURLServiceFactory::GetForProfile( @@ -217,7 +217,7 @@ class InstantExtendedTest : public InProcessBrowserTest, void BlockUntilHistoryProcessesPendingRequests() { HistoryService* history = HistoryServiceFactory::GetForProfile( - browser()->profile(), Profile::EXPLICIT_ACCESS); + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); DCHECK(history); DCHECK(base::MessageLoop::current()); diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.cc b/chrome/browser/ui/search_engines/keyword_editor_controller.cc index 0087427c9c49a..dae341d1b7e26 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller.cc +++ b/chrome/browser/ui/search_engines/keyword_editor_controller.cc @@ -17,8 +17,8 @@ using base::UserMetricsAction; KeywordEditorController::KeywordEditorController(Profile* profile) : url_model_(TemplateURLServiceFactory::GetForProfile(profile)) { table_model_.reset(new TemplateURLTableModel( - url_model_, - FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS))); + url_model_, FaviconServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))); } KeywordEditorController::~KeywordEditorController() { diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index 6a0428652ddd7..c07b51c3bbb37 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -459,7 +459,7 @@ void CurrentHistoryCleaner::DidCommitProvisionalLoadForFrame( content::NavigationController* nc = &web_contents()->GetController(); HistoryService* hs = HistoryServiceFactory::GetForProfile( Profile::FromBrowserContext(web_contents()->GetBrowserContext()), - Profile::IMPLICIT_ACCESS); + ServiceAccessType::IMPLICIT_ACCESS); // Have to wait until something else gets added to history before removal. if (history_index_to_remove_ < nc->GetLastCommittedEntryIndex()) { diff --git a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc index 3d779ec7188cd..c573776015e99 100644 --- a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc +++ b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc @@ -228,8 +228,7 @@ TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) { TEST_F(ProfileSigninConfirmationHelperTest, DISABLED_PromptForNewProfile_History) { HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_.get(), - Profile::EXPLICIT_ACCESS); + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history); // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) @@ -253,8 +252,7 @@ TEST_F(ProfileSigninConfirmationHelperTest, TEST_F(ProfileSigninConfirmationHelperTest, DISABLED_PromptForNewProfile_TypedURLs) { HistoryService* history = HistoryServiceFactory::GetForProfile( - profile_.get(), - Profile::EXPLICIT_ACCESS); + profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); ASSERT_TRUE(history); // Profile is new but has a typed URL. diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index f5ff399b95da1..762d28dddb3e8 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -249,7 +249,7 @@ void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) { } requested_favicons_.insert(entry->GetUniqueID()); FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - browser_->profile(), Profile::EXPLICIT_ACCESS); + browser_->profile(), ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc index 8f83b67172e03..e5d8746aa0eee 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc @@ -519,13 +519,12 @@ TEST_F(BackFwdMenuModelTest, FaviconLoadTest) { NavigateAndCommit(url2); // Set the desired favicon for url1. - HistoryServiceFactory::GetForProfile( - profile(), Profile::EXPLICIT_ACCESS)->AddPage( - url1, base::Time::Now(), history::SOURCE_BROWSED); - FaviconServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS) - ->SetFavicons(url1, - url1_favicon, - favicon_base::FAVICON, + HistoryServiceFactory::GetForProfile(profile(), + ServiceAccessType::EXPLICIT_ACCESS) + ->AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED); + FaviconServiceFactory::GetForProfile(profile(), + ServiceAccessType::EXPLICIT_ACCESS) + ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image::CreateFrom1xBitmap(new_icon_bitmap)); // Will return the current icon (default) but start an anync call diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc index a42367ee4d18a..775c69f83ed5e 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc @@ -612,7 +612,7 @@ void RecentTabsSubMenuModel::AddTabFavicon(int command_id, const GURL& url) { SetIcon(index_in_menu, default_favicon_); // Start request to fetch actual icon if possible. FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - browser_->profile(), Profile::EXPLICIT_ACCESS); + browser_->profile(), ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; diff --git a/chrome/browser/ui/views/frame/test_with_browser_view.cc b/chrome/browser/ui/views/frame/test_with_browser_view.cc index b5c3dbd38b632..843c172042b5b 100644 --- a/chrome/browser/ui/views/frame/test_with_browser_view.cc +++ b/chrome/browser/ui/views/frame/test_with_browser_view.cc @@ -38,11 +38,10 @@ KeyedService* CreateTemplateURLService(content::BrowserContext* context) { profile->GetPrefs(), scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), WebDataServiceFactory::GetKeywordWebDataForProfile( - profile, Profile::EXPLICIT_ACCESS), - scoped_ptr<TemplateURLServiceClient>( - new ChromeTemplateURLServiceClient( - HistoryServiceFactory::GetForProfile(profile, - Profile::EXPLICIT_ACCESS))), + profile, ServiceAccessType::EXPLICIT_ACCESS), + scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( + HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS))), nullptr, nullptr, base::Closure()); } diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index 8fb22b8f9791a..8bb29e8bea930 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -190,7 +190,7 @@ WebsiteSettings::WebsiteSettings( Init(profile, url, ssl); HistoryService* history_service = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); if (history_service) { history_service->GetVisibleVisitCountToHost( site_url_, diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc index 79bf9197e0646..b2e0f99b54d88 100644 --- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc +++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc @@ -149,7 +149,7 @@ static void SetupHistoryPageTest(Browser* browser, const std::string& page_url, const std::string& page_title) { HistoryService* history_service = HistoryServiceFactory::GetForProfile( - browser->profile(), Profile::IMPLICIT_ACCESS); + browser->profile(), ServiceAccessType::IMPLICIT_ACCESS); const GURL history_url = GURL(page_url); history_service->AddPage( history_url, base::Time::Now(), history::SOURCE_BROWSED); diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index fdcbab2ddb145..aa7ee857867cf 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -210,8 +210,8 @@ void ExtensionIconSource::LoadExtensionImage(const ExtensionResource& icon, } void ExtensionIconSource::LoadFaviconImage(int request_id) { - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); // Fall back to the default icons if the service isn't available. if (favicon_service == NULL) { LoadDefaultImage(request_id); diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 0a78509e1a276..c797799930029 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -64,8 +64,8 @@ void FaviconSource::StartDataRequest( int render_process_id, int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) { SendDefaultResponse(callback); return; diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 2a6d248b6ce08..dce6fdc0583dd 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -482,7 +482,7 @@ void BrowsingHistoryHandler::QueryHistory( results_info_value_.Clear(); HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); hs->QueryHistory(search_text, options, base::Bind(&BrowsingHistoryHandler::QueryComplete, @@ -570,8 +570,8 @@ void BrowsingHistoryHandler::HandleRemoveVisits(const base::ListValue* args) { return; } - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); history::WebHistoryService* web_history = WebHistoryServiceFactory::GetForProfile(profile); diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index c9c973b98dfb1..5e243bf0e3f73 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -691,8 +691,8 @@ void AppLauncherHandler::HandleGenerateAppForLink(const base::ListValue* args) { app_sorting->PageIntegerAsStringOrdinal(static_cast<size_t>(page_index)); Profile* profile = Profile::FromWebUI(web_ui()); - FaviconService* favicon_service = - FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); + FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( + profile, ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) { LOG(ERROR) << "No favicon service"; return; diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc index d0117449c1a63..20cfe1aadcfb1 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc @@ -91,7 +91,7 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor( CHECK(args->GetString(1, &dom_id)); FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - Profile::FromWebUI(web_ui()), Profile::EXPLICIT_ACCESS); + Profile::FromWebUI(web_ui()), ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service || path.empty()) return; diff --git a/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc b/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc index 49fb628fcdc45..b47202622bc3c 100644 --- a/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc +++ b/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc @@ -64,7 +64,7 @@ void SuggestionsSourceTopSites::FetchItems(Profile* profile) { history_tracker_.TryCancelAll(); HistoryService* history = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); // |history| may be null during unit tests. if (history) { history::VisitFilter time_filter; diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc index fd4a1d5caede9..025860d41fc3e 100644 --- a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc @@ -162,9 +162,8 @@ void OmniboxUIHandler::OnResultChanged(bool default_match_changed) { bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, bool* is_typed_host) const { - HistoryService* const history_service = - HistoryServiceFactory::GetForProfile(profile_, - Profile::EXPLICIT_ACCESS); + HistoryService* const history_service = HistoryServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); if (!history_service) return false; history::URLDatabase* url_db = history_service->InMemoryDatabase(); diff --git a/chrome/browser/webdata/web_data_service_factory.cc b/chrome/browser/webdata/web_data_service_factory.cc index 2437dc3ed1fa0..f8728ea6ad471 100644 --- a/chrome/browser/webdata/web_data_service_factory.cc +++ b/chrome/browser/webdata/web_data_service_factory.cc @@ -9,6 +9,7 @@ #include "base/memory/singleton.h" #include "chrome/browser/browser_process.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/ui/profile_error_dialog.h" #include "chrome/grit/chromium_strings.h" @@ -75,11 +76,12 @@ WebDataServiceFactory::~WebDataServiceFactory() { // static WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { // If |access_type| starts being used for anything other than this // DCHECK, we need to start taking it as a parameter to // the *WebDataService::FromBrowserContext() functions (see above). - DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); + DCHECK(access_type != ServiceAccessType::IMPLICIT_ACCESS || + !profile->IsOffTheRecord()); return static_cast<WebDataServiceWrapper*>( GetInstance()->GetServiceForBrowserContext(profile, true)); } @@ -87,11 +89,12 @@ WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( // static WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { // If |access_type| starts being used for anything other than this // DCHECK, we need to start taking it as a parameter to // the *WebDataService::FromBrowserContext() functions (see above). - DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); + DCHECK(access_type != ServiceAccessType::IMPLICIT_ACCESS || + !profile->IsOffTheRecord()); return static_cast<WebDataServiceWrapper*>( GetInstance()->GetServiceForBrowserContext(profile, false)); } @@ -100,7 +103,7 @@ WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists( scoped_refptr<autofill::AutofillWebDataService> WebDataServiceFactory::GetAutofillWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { WebDataServiceWrapper* wrapper = WebDataServiceFactory::GetForProfile(profile, access_type); // |wrapper| can be null in Incognito mode. @@ -113,7 +116,7 @@ WebDataServiceFactory::GetAutofillWebDataForProfile( scoped_refptr<KeywordWebDataService> WebDataServiceFactory::GetKeywordWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { WebDataServiceWrapper* wrapper = WebDataServiceFactory::GetForProfile(profile, access_type); // |wrapper| can be null in Incognito mode. @@ -125,7 +128,7 @@ WebDataServiceFactory::GetKeywordWebDataForProfile( // static scoped_refptr<TokenWebData> WebDataServiceFactory::GetTokenWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { WebDataServiceWrapper* wrapper = WebDataServiceFactory::GetForProfile(profile, access_type); // |wrapper| can be null in Incognito mode. @@ -138,7 +141,7 @@ scoped_refptr<TokenWebData> WebDataServiceFactory::GetTokenWebDataForProfile( scoped_refptr<PasswordWebDataService> WebDataServiceFactory::GetPasswordWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type) { + ServiceAccessType access_type) { WebDataServiceWrapper* wrapper = WebDataServiceFactory::GetForProfile(profile, access_type); // |wrapper| can be null in Incognito mode. diff --git a/chrome/browser/webdata/web_data_service_factory.h b/chrome/browser/webdata/web_data_service_factory.h index 1f0aa76a8761e..5b9c5c0358345 100644 --- a/chrome/browser/webdata/web_data_service_factory.h +++ b/chrome/browser/webdata/web_data_service_factory.h @@ -5,13 +5,14 @@ #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/profiles/profile.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; class KeywordWebDataService; +class Profile; class TokenWebData; class WebDataServiceWrapper; @@ -20,43 +21,40 @@ class PasswordWebDataService; #endif namespace autofill { -class AutofillWebDataBackend; class AutofillWebDataService; -} // namespace autofill +} // Singleton that owns all WebDataServiceWrappers and associates them with // Profiles. class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { public: // Returns the WebDataServiceWrapper associated with the |profile|. - static WebDataServiceWrapper* GetForProfile( - Profile* profile, - Profile::ServiceAccessType access_type); + static WebDataServiceWrapper* GetForProfile(Profile* profile, + ServiceAccessType access_type); static WebDataServiceWrapper* GetForProfileIfExists( Profile* profile, - Profile::ServiceAccessType access_type); + ServiceAccessType access_type); // Returns the AutofillWebDataService associated with the |profile|. static scoped_refptr<autofill::AutofillWebDataService> - GetAutofillWebDataForProfile(Profile* profile, - Profile::ServiceAccessType access_type); + GetAutofillWebDataForProfile(Profile* profile, ServiceAccessType access_type); // Returns the KeywordWebDataService associated with the |profile|. static scoped_refptr<KeywordWebDataService> GetKeywordWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type); + ServiceAccessType access_type); // Returns the TokenWebData associated with the |profile|. static scoped_refptr<TokenWebData> GetTokenWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type); + ServiceAccessType access_type); #if defined(OS_WIN) // Returns the PasswordWebDataService associated with the |profile|. static scoped_refptr<PasswordWebDataService> GetPasswordWebDataForProfile( Profile* profile, - Profile::ServiceAccessType access_type); + ServiceAccessType access_type); #endif static WebDataServiceFactory* GetInstance(); diff --git a/chrome/test/base/profile_mock.h b/chrome/test/base/profile_mock.h index e85e584550f09..a97261e96d534 100644 --- a/chrome/test/base/profile_mock.h +++ b/chrome/test/base/profile_mock.h @@ -6,7 +6,7 @@ #define CHROME_TEST_BASE_PROFILE_MOCK_H_ #include "chrome/test/base/testing_profile.h" - +#include "components/keyed_service/core/service_access_type.h" #include "testing/gmock/include/gmock/gmock.h" namespace password_manager { diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 4da232cc66e23..00ac8085dedee 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -925,8 +925,8 @@ PrefProxyConfigTracker* TestingProfile::GetProxyConfigTracker() { } void TestingProfile::BlockUntilHistoryProcessesPendingRequests() { - HistoryService* history_service = - HistoryServiceFactory::GetForProfile(this, Profile::EXPLICIT_ACCESS); + HistoryService* history_service = HistoryServiceFactory::GetForProfile( + this, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(history_service); DCHECK(base::MessageLoop::current()); diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 837b0387deb6b..8b686afdf2aef 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -502,7 +502,7 @@ HistoryEnumerator::HistoryEnumerator(Profile* profile) { new content::MessageLoopRunner; HistoryService* hs = HistoryServiceFactory::GetForProfile( - profile, Profile::EXPLICIT_ACCESS); + profile, ServiceAccessType::EXPLICIT_ACCESS); hs->QueryHistory(base::string16(), history::QueryOptions(), base::Bind(&HistoryEnumerator::HistoryQueryComplete, diff --git a/chrome/test/data/webui/history_ui_browsertest.cc b/chrome/test/data/webui/history_ui_browsertest.cc index 7fe7038fddc08..121e6962fac61 100644 --- a/chrome/test/data/webui/history_ui_browsertest.cc +++ b/chrome/test/data/webui/history_ui_browsertest.cc @@ -25,8 +25,8 @@ HistoryUIBrowserTest::~HistoryUIBrowserTest() { void HistoryUIBrowserTest::SetUpOnMainThread() { WebUIBrowserTest::SetUpOnMainThread(); - history_ = HistoryServiceFactory::GetForProfile(browser()->profile(), - Profile::EXPLICIT_ACCESS); + history_ = HistoryServiceFactory::GetForProfile( + browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS); ui_test_utils::WaitForHistoryToLoad(history_); } diff --git a/components/keyed_service.gypi b/components/keyed_service.gypi index faabf607c02a3..6fb6c958b29f2 100644 --- a/components/keyed_service.gypi +++ b/components/keyed_service.gypi @@ -36,6 +36,7 @@ 'keyed_service/core/refcounted_keyed_service.h', 'keyed_service/core/refcounted_keyed_service_factory.cc', 'keyed_service/core/refcounted_keyed_service_factory.h', + 'keyed_service/core/service_access_type.h', ], }, ], diff --git a/components/keyed_service/core/BUILD.gn b/components/keyed_service/core/BUILD.gn index e0354e577537f..bc8d3b023f2c5 100644 --- a/components/keyed_service/core/BUILD.gn +++ b/components/keyed_service/core/BUILD.gn @@ -21,6 +21,7 @@ component("core") { "refcounted_keyed_service.h", "refcounted_keyed_service_factory.cc", "refcounted_keyed_service_factory.h", + "service_access_types.h", ] defines = [ "KEYED_SERVICE_IMPLEMENTATION" ] diff --git a/components/keyed_service/core/service_access_type.h b/components/keyed_service/core/service_access_type.h new file mode 100644 index 0000000000000..257a47d5d4c89 --- /dev/null +++ b/components/keyed_service/core/service_access_type.h @@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_ +#define COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_ + +// Some KeyedServices 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 context. +// This flag allows the context to perform an additional check. +// +// It also leaves an opportunity to perform further checks in the future. For +// example an history service that only allow some specific methods could be +// returned. +enum class 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 can be performed while + // incognito (for example 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 context, as part of Chrome's implicit data logging. Use this flag + // before performing an operation which is incompatible with the incognito + // mode. + IMPLICIT_ACCESS +}; + +#endif // COMPONENTS_KEYED_SERVICE_CORE_SERVICE_ACCESS_TYPE_H_ diff --git a/components/search_engines/template_url_service_unittest.cc b/components/search_engines/template_url_service_unittest.cc index c05c5f612b707..ad474e7745eed 100644 --- a/components/search_engines/template_url_service_unittest.cc +++ b/components/search_engines/template_url_service_unittest.cc @@ -982,9 +982,8 @@ TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { base::Time::Now(), base::Time::Now()); // Add a visit that matches the url of the keyword. - HistoryService* history = - HistoryServiceFactory::GetForProfile(test_util()->profile(), - Profile::EXPLICIT_ACCESS); + HistoryService* history = HistoryServiceFactory::GetForProfile( + test_util()->profile(), ServiceAccessType::EXPLICIT_ACCESS); history->AddPage( GURL(t_url->url_ref().ReplaceSearchTerms( TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")),