diff options
author | sdefresne <sdefresne@chromium.org> | 2015-03-30 10:17:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-30 17:18:00 +0000 |
commit | 494aec68691f10626b226892396d442503dd9af7 (patch) | |
tree | 3cf53649ec6e4c708d419928ca798b5bc6641dee /chrome/browser | |
parent | 24c5e71f6cc5f1033485d83bd7d767c45071cf16 (diff) | |
download | chromium_src-494aec68691f10626b226892396d442503dd9af7.zip chromium_src-494aec68691f10626b226892396d442503dd9af7.tar.gz chromium_src-494aec68691f10626b226892396d442503dd9af7.tar.bz2 |
Move //components/favicon code into the favicon namespace
Move all classes defined in //components/favicon into the favicon namespace
and update all client code forward-declaration and usage.
Rename FaviconTabHelperObserver to FaviconDriverObserver as FaviconDriver is
the name of the base interface (and iOS wants to use that observer but will
not be able to use FaviconTabHelper).
BUG=359513
Review URL: https://codereview.chromium.org/1028503004
Cr-Commit-Position: refs/heads/master@{#322799}
Diffstat (limited to 'chrome/browser')
45 files changed, 258 insertions, 191 deletions
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_reader.cc b/chrome/browser/android/bookmarks/partner_bookmarks_reader.cc index 5a04979..7894193 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_reader.cc +++ b/chrome/browser/android/bookmarks/partner_bookmarks_reader.cc @@ -38,9 +38,10 @@ void SetFaviconTask(Profile* profile, scoped_refptr<base::RefCountedMemory> bitmap_data( new base::RefCountedBytes(image_data)); gfx::Size pixel_size(gfx::kFaviconSize, gfx::kFaviconSize); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - ProfileManager::GetActiveUserProfile(), - ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile( + ProfileManager::GetActiveUserProfile(), + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; diff --git a/chrome/browser/android/favicon_helper.cc b/chrome/browser/android/favicon_helper.cc index ddcacef..6b2a938 100644 --- a/chrome/browser/android/favicon_helper.cc +++ b/chrome/browser/android/favicon_helper.cc @@ -115,8 +115,9 @@ jboolean FaviconHelper::GetLocalFaviconImageForURL( if (!profile) return false; - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS); DCHECK(favicon_service); if (!favicon_service) return false; @@ -151,8 +152,9 @@ void FaviconHelper::GetLargestRawFaviconForUrl( if (!profile) return; - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(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 1c40a1d..076a22b 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.cc +++ b/chrome/browser/android/provider/chrome_browser_provider.cc @@ -651,13 +651,13 @@ class AsyncServiceRequest : protected BlockingUIThreadAsyncRequest { }; // Base class for all asynchronous blocking tasks that use the favicon service. -class FaviconServiceTask : public AsyncServiceRequest<FaviconService> { +class FaviconServiceTask : public AsyncServiceRequest<favicon::FaviconService> { public: FaviconServiceTask(base::CancelableTaskTracker* cancelable_tracker, Profile* profile, - FaviconService* favicon_service) - : AsyncServiceRequest<FaviconService>(favicon_service, - cancelable_tracker), + favicon::FaviconService* favicon_service) + : AsyncServiceRequest<favicon::FaviconService>(favicon_service, + cancelable_tracker), profile_(profile) {} Profile* profile() const { return profile_; } @@ -673,7 +673,7 @@ class BookmarkIconFetchTask : public FaviconServiceTask { public: BookmarkIconFetchTask(base::CancelableTaskTracker* cancelable_tracker, Profile* profile, - FaviconService* favicon_service) + favicon::FaviconService* favicon_service) : FaviconServiceTask(cancelable_tracker, profile, favicon_service) {} favicon_base::FaviconRawBitmapResult Run(const GURL& url) { @@ -684,15 +684,13 @@ class BookmarkIconFetchTask : public FaviconServiceTask { if (service() == NULL) return favicon_base::FaviconRawBitmapResult(); - RunAsyncRequestOnUIThreadBlocking( - base::Bind(&FaviconService::GetRawFaviconForPageURL, - base::Unretained(service()), - url, - favicon_base::FAVICON | favicon_base::TOUCH_ICON, - desired_size_in_pixel, - base::Bind(&BookmarkIconFetchTask::OnFaviconRetrieved, - base::Unretained(this)), - cancelable_tracker())); + RunAsyncRequestOnUIThreadBlocking(base::Bind( + &favicon::FaviconService::GetRawFaviconForPageURL, + base::Unretained(service()), url, + favicon_base::FAVICON | favicon_base::TOUCH_ICON, desired_size_in_pixel, + base::Bind(&BookmarkIconFetchTask::OnFaviconRetrieved, + base::Unretained(this)), + cancelable_tracker())); return result_; } diff --git a/chrome/browser/android/provider/chrome_browser_provider.h b/chrome/browser/android/provider/chrome_browser_provider.h index e788c45..80da75e 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.h +++ b/chrome/browser/android/provider/chrome_browser_provider.h @@ -16,9 +16,12 @@ #include "components/history/core/browser/history_service_observer.h" class AndroidHistoryProviderService; -class FaviconService; class Profile; +namespace favicon { +class FaviconService; +} + namespace history { class TopSites; } @@ -211,7 +214,7 @@ class ChromeBrowserProvider : public bookmarks::BaseBookmarkModelObserver, Profile* profile_; bookmarks::BookmarkModel* bookmark_model_; scoped_refptr<history::TopSites> top_sites_; - FaviconService* favicon_service_; + favicon::FaviconService* favicon_service_; scoped_ptr<AndroidHistoryProviderService> service_; diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc index 70cf788..779e272 100644 --- a/chrome/browser/android/shortcut_helper.cc +++ b/chrome/browser/android/shortcut_helper.cc @@ -244,8 +244,9 @@ void ShortcutHelper::AddShortcutUsingFavicon() { icon_types.push_back(favicon_base::FAVICON); icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | favicon_base::TOUCH_ICON); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(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/android/tab_android.h b/chrome/browser/android/tab_android.h index 0de4f1f..af89b58 100644 --- a/chrome/browser/android/tab_android.h +++ b/chrome/browser/android/tab_android.h @@ -16,7 +16,7 @@ #include "chrome/browser/ui/search/search_tab_helper_delegate.h" #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" -#include "components/favicon/core/favicon_tab_helper_observer.h" +#include "components/favicon/core/favicon_driver_observer.h" #include "components/sessions/session_id.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -53,7 +53,7 @@ class TabAndroid : public CoreTabHelperDelegate, public InstantServiceObserver, public SearchTabHelperDelegate, public content::NotificationObserver, - public FaviconTabHelperObserver { + public favicon::FaviconDriverObserver { public: // A Java counterpart will be generated for this enum. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser @@ -137,7 +137,7 @@ class TabAndroid : public CoreTabHelperDelegate, const content::NotificationSource& source, const content::NotificationDetails& details) override; - // FaviconTabHelperObserver ----------------------------------------------- + // favicon::FaviconDriverObserver ------------------------------------------- void OnFaviconAvailable(const gfx::Image& image) override; // Methods called from Java via JNI ----------------------------------------- diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index c5e30e8..aeba2a8 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -458,8 +458,9 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { // Filter out urls that we've already got favicon for. URLFaviconMap::const_iterator iter = favicons_map_->find(url); if (favicons_map_->end() == iter) { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::EXPLICIT_ACCESS); favicon_service->GetRawFaviconForPageURL( GURL(url), favicon_base::FAVICON, diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.cc b/chrome/browser/bookmarks/chrome_bookmark_client.cc index b319648..82f3da9 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client.cc +++ b/chrome/browser/bookmarks/chrome_bookmark_client.cc @@ -114,8 +114,9 @@ ChromeBookmarkClient::GetFaviconImageForPageURL( favicon_base::IconType type, const favicon_base::FaviconImageCallback& callback, base::CancelableTaskTracker* tracker) { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index 9402ada..d90c173 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc @@ -249,8 +249,9 @@ ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate( content::BrowserContext* context, const std::string& title, const GURL& launch_url) const { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - Profile::FromBrowserContext(context), ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context), + ServiceAccessType::EXPLICIT_ACCESS); DCHECK(favicon_service); ChromeAppForLinkDelegate* delegate = new ChromeAppForLinkDelegate; diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 4d06efc..54ccc8b 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -117,9 +117,8 @@ void RunFaviconCallbackAsync( base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&FaviconService::FaviconResultsCallbackRunner, - callback, - base::Owned(favicon_bitmap_results))); + base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, + callback, base::Owned(favicon_bitmap_results))); } bool ValidateOverrideURL(const base::Value* override_url_value, diff --git a/chrome/browser/favicon/chrome_favicon_client.cc b/chrome/browser/favicon/chrome_favicon_client.cc index ce0882e..99ef3ba 100644 --- a/chrome/browser/favicon/chrome_favicon_client.cc +++ b/chrome/browser/favicon/chrome_favicon_client.cc @@ -4,6 +4,7 @@ #include "chrome/browser/favicon/chrome_favicon_client.h" +#include "base/memory/singleton.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" #include "chrome/common/url_constants.h" #include "components/bookmarks/browser/bookmark_model.h" diff --git a/chrome/browser/favicon/chrome_favicon_client.h b/chrome/browser/favicon/chrome_favicon_client.h index e8251f0..fc7f57f 100644 --- a/chrome/browser/favicon/chrome_favicon_client.h +++ b/chrome/browser/favicon/chrome_favicon_client.h @@ -16,14 +16,14 @@ class BookmarkModel; } // ChromeFaviconClient implements the the FaviconClient interface. -class ChromeFaviconClient : public FaviconClient { +class ChromeFaviconClient : public favicon::FaviconClient { public: ChromeFaviconClient(Profile* profile, bookmarks::BookmarkModel* bookmark_model); ~ChromeFaviconClient() override; private: - // FaviconClient implementation: + // favicon::FaviconClient implementation: bool IsBookmarked(const GURL& url) override; bool IsNativeApplicationURL(const GURL& url) override; base::CancelableTaskTracker::TaskId GetFaviconForNativeApplicationURL( diff --git a/chrome/browser/favicon/chrome_favicon_client_factory.cc b/chrome/browser/favicon/chrome_favicon_client_factory.cc index 2941499..ee2d769 100644 --- a/chrome/browser/favicon/chrome_favicon_client_factory.cc +++ b/chrome/browser/favicon/chrome_favicon_client_factory.cc @@ -4,7 +4,9 @@ #include "chrome/browser/favicon/chrome_favicon_client_factory.h" +#include "base/memory/singleton.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/favicon/chrome_favicon_client.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" @@ -20,8 +22,9 @@ ChromeFaviconClientFactory::~ChromeFaviconClientFactory() { } // static -FaviconClient* ChromeFaviconClientFactory::GetForProfile(Profile* profile) { - return static_cast<FaviconClient*>( +favicon::FaviconClient* ChromeFaviconClientFactory::GetForProfile( + Profile* profile) { + return static_cast<favicon::FaviconClient*>( GetInstance()->GetServiceForBrowserContext(profile, true)); } diff --git a/chrome/browser/favicon/chrome_favicon_client_factory.h b/chrome/browser/favicon/chrome_favicon_client_factory.h index 46f8344..83fdcc0 100644 --- a/chrome/browser/favicon/chrome_favicon_client_factory.h +++ b/chrome/browser/favicon/chrome_favicon_client_factory.h @@ -5,19 +5,24 @@ #ifndef CHROME_BROWSER_FAVICON_CHROME_FAVICON_CLIENT_FACTORY_H_ #define CHROME_BROWSER_FAVICON_CHROME_FAVICON_CLIENT_FACTORY_H_ -#include "base/memory/singleton.h" -#include "chrome/browser/favicon/chrome_favicon_client.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" +template <typename T> +struct DefaultSingletonTraits; + class Profile; +namespace favicon { +class FaviconClient; +} + // Singleton that owns all ChromeFaviconClients and associates them with // Profiles. class ChromeFaviconClientFactory : public BrowserContextKeyedServiceFactory { public: - // Returns the instance of FaviconClient associated with this profile + // Returns the instance of favicon::FaviconClient associated with |profile| // (creating one if none exists). - static FaviconClient* GetForProfile(Profile* profile); + static favicon::FaviconClient* GetForProfile(Profile* profile); // Returns an instance of the factory singleton. static ChromeFaviconClientFactory* GetInstance(); diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index 4e4dd4c..be9db08 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc @@ -174,12 +174,12 @@ class HistoryRequestHandler { } // namespace -class TestFaviconClient : public FaviconClient { +class TestFaviconClient : public favicon::FaviconClient { public: ~TestFaviconClient() override {} private: - // FaviconClient implementation. + // favicon::FaviconClient implementation. bool IsBookmarked(const GURL& url) override { return false; } bool IsNativeApplicationURL(const GURL& url) override { return false; } base::CancelableTaskTracker::TaskId GetFaviconForNativeApplicationURL( @@ -191,7 +191,7 @@ class TestFaviconClient : public FaviconClient { } }; -class TestFaviconDriver : public FaviconDriver { +class TestFaviconDriver : public favicon::FaviconDriver { public: TestFaviconDriver() : favicon_validity_(false), @@ -275,18 +275,22 @@ class TestFaviconDriver : public FaviconDriver { // This class is used to catch the FaviconHandler's download and history // request, and also provide the methods to access the FaviconHandler // internals. -class TestFaviconHandler : public FaviconHandler { +class TestFaviconHandler : public favicon::FaviconHandler { public: static int GetMaximalIconSize(favicon_base::IconType icon_type) { return FaviconHandler::GetMaximalIconSize(icon_type); } TestFaviconHandler(const GURL& page_url, - FaviconClient* client, + favicon::FaviconClient* client, TestFaviconDriver* driver, Type type, bool download_largest_icon) - : FaviconHandler(nullptr, client, driver, type, download_largest_icon), + : favicon::FaviconHandler(nullptr, + client, + driver, + type, + download_largest_icon), download_id_(0) { driver->SetActiveURL(page_url); download_handler_.reset(new DownloadHandler(this)); @@ -313,7 +317,7 @@ class TestFaviconHandler : public FaviconHandler { } FaviconURL* current_candidate() { - return FaviconHandler::current_candidate(); + return favicon::FaviconHandler::current_candidate(); } const FaviconCandidate& best_favicon_candidate() { @@ -472,7 +476,7 @@ class FaviconHandlerTest : public ChromeRenderViewHostTestHarness { void SetUp() override { // The score computed by SelectFaviconFrames() is dependent on the supported // scale factors of the platform. It is used for determining the goodness of - // a downloaded bitmap in FaviconHandler::OnDidDownloadFavicon(). + // a downloaded bitmap in favicon::FaviconHandler::OnDidDownloadFavicon(). // Force the values of the scale factors so that the tests produce the same // results on all platforms. std::vector<ui::ScaleFactor> scale_factors; @@ -503,8 +507,8 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::FAVICON, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::FAVICON, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -544,8 +548,8 @@ TEST_F(FaviconHandlerTest, DownloadFavicon) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::FAVICON, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::FAVICON, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -613,8 +617,8 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::FAVICON, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::FAVICON, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -694,8 +698,8 @@ TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::FAVICON, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::FAVICON, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -766,8 +770,8 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::FAVICON, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::FAVICON, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -828,8 +832,8 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::TOUCH, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::TOUCH, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -943,8 +947,8 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) { TestFaviconDriver driver; TestFaviconClient client; - TestFaviconHandler helper( - page_url, &client, &driver, FaviconHandler::TOUCH, false); + TestFaviconHandler helper(page_url, &client, &driver, + favicon::FaviconHandler::TOUCH, false); helper.FetchFavicon(page_url); HistoryRequestHandler* history_handler = helper.history_handler(); @@ -1086,8 +1090,8 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { // that the largest exact match is chosen. TestFaviconDriver driver1; TestFaviconClient client; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, false); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, false); const int kSizes1[] = { 16, 24, 32, 48, 256 }; std::vector<FaviconURL> urls1(kSourceIconURLs, @@ -1108,8 +1112,8 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { // 2) Test that if there are several single resolution favicons to choose // from, the exact match is preferred even if it results in upsampling. TestFaviconDriver driver2; - TestFaviconHandler handler2( - kPageURL, &client, &driver2, FaviconHandler::FAVICON, false); + TestFaviconHandler handler2(kPageURL, &client, &driver2, + favicon::FaviconHandler::FAVICON, false); const int kSizes2[] = { 16, 24, 48, 256 }; std::vector<FaviconURL> urls2(kSourceIconURLs, @@ -1125,8 +1129,8 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { // 3) Test that favicons which need to be upsampled a little or downsampled // a little are preferred over huge favicons. TestFaviconDriver driver3; - TestFaviconHandler handler3( - kPageURL, &client, &driver3, FaviconHandler::FAVICON, false); + TestFaviconHandler handler3(kPageURL, &client, &driver3, + favicon::FaviconHandler::FAVICON, false); const int kSizes3[] = { 256, 48 }; std::vector<FaviconURL> urls3(kSourceIconURLs, @@ -1140,8 +1144,8 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { driver3.GetActiveFaviconURL()); TestFaviconDriver driver4; - TestFaviconHandler handler4( - kPageURL, &client, &driver4, FaviconHandler::FAVICON, false); + TestFaviconHandler handler4(kPageURL, &client, &driver4, + favicon::FaviconHandler::FAVICON, false); const int kSizes4[] = { 17, 256 }; std::vector<FaviconURL> urls4(kSourceIconURLs, @@ -1184,8 +1188,8 @@ TEST_F(FaviconHandlerTest, TestSortFavicon) { TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(kSourceIconURLs, kSourceIconURLs + arraysize(kSourceIconURLs)); UpdateFaviconURL(&driver1, &handler1, kPageURL, urls1); @@ -1248,8 +1252,8 @@ TEST_F(FaviconHandlerTest, TestDownloadLargestFavicon) { TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(kSourceIconURLs, kSourceIconURLs + arraysize(kSourceIconURLs)); UpdateFaviconURL(&driver1, &handler1, kPageURL, urls1); @@ -1314,8 +1318,8 @@ TEST_F(FaviconHandlerTest, TestSelectLargestFavicon) { TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(kSourceIconURLs, kSourceIconURLs + arraysize(kSourceIconURLs)); UpdateFaviconURL(&driver1, &handler1, kPageURL, urls1); @@ -1382,8 +1386,8 @@ TEST_F(FaviconHandlerTest, TestFaviconWasScaledAfterDownload) { TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(kSourceIconURLs, kSourceIconURLs + arraysize(kSourceIconURLs)); UpdateFaviconURL(&driver1, &handler1, kPageURL, urls1); @@ -1444,8 +1448,8 @@ TEST_F(FaviconHandlerTest, TestKeepDownloadedLargestFavicon) { TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - kPageURL, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(kPageURL, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(kSourceIconURLs, kSourceIconURLs + arraysize(kSourceIconURLs)); UpdateFaviconURL(&driver1, &handler1, kPageURL, urls1); @@ -1495,9 +1499,10 @@ TEST_F(FaviconHandlerTest, TestKeepDownloadedLargestFavicon) { static KeyedService* BuildFaviconService(content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); - return new FaviconService(ChromeFaviconClientFactory::GetForProfile(profile), - HistoryServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS)); + return new favicon::FaviconService( + ChromeFaviconClientFactory::GetForProfile(profile), + HistoryServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS)); } static KeyedService* BuildHistoryService(content::BrowserContext* context) { @@ -1519,8 +1524,9 @@ TEST_F(FaviconHandlerTest, UnableToDownloadFavicon) { HistoryServiceFactory::GetInstance()->SetTestingFactory( profile, BuildHistoryService); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::IMPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile, + ServiceAccessType::IMPLICIT_ACCESS); FaviconTabHelper::CreateForWebContents(web_contents()); FaviconTabHelper* favicon_tab_helper = @@ -1608,8 +1614,8 @@ TEST_P(FaviconHandlerActiveFaviconValidityParamTest, FaviconURL(new_favicon_url, favicon_base::FAVICON, one_icon)}; TestFaviconClient client; TestFaviconDriver driver1; - TestFaviconHandler handler1( - page_url, &client, &driver1, FaviconHandler::FAVICON, true); + TestFaviconHandler handler1(page_url, &client, &driver1, + favicon::FaviconHandler::FAVICON, true); std::vector<FaviconURL> urls1(source_icon_urls, source_icon_urls + arraysize(source_icon_urls)); UpdateFaviconURL(&driver1, &handler1, page_url, urls1); diff --git a/chrome/browser/favicon/favicon_service_factory.cc b/chrome/browser/favicon/favicon_service_factory.cc index 1fe2f8b..cb0840c 100644 --- a/chrome/browser/favicon/favicon_service_factory.cc +++ b/chrome/browser/favicon/favicon_service_factory.cc @@ -14,14 +14,15 @@ #include "components/keyed_service/content/browser_context_dependency_manager.h" // static -FaviconService* FaviconServiceFactory::GetForProfile(Profile* profile, - ServiceAccessType sat) { +favicon::FaviconService* FaviconServiceFactory::GetForProfile( + Profile* profile, + ServiceAccessType sat) { if (!profile->IsOffTheRecord()) { - return static_cast<FaviconService*>( + return static_cast<favicon::FaviconService*>( GetInstance()->GetServiceForBrowserContext(profile, true)); } else if (sat == ServiceAccessType::EXPLICIT_ACCESS) { // Profile must be OffTheRecord in this case. - return static_cast<FaviconService*>( + return static_cast<favicon::FaviconService*>( GetInstance()->GetServiceForBrowserContext( profile->GetOriginalProfile(), true)); } @@ -50,9 +51,10 @@ FaviconServiceFactory::~FaviconServiceFactory() { KeyedService* FaviconServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = Profile::FromBrowserContext(context); - return new FaviconService(ChromeFaviconClientFactory::GetForProfile(profile), - HistoryServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS)); + return new favicon::FaviconService( + ChromeFaviconClientFactory::GetForProfile(profile), + HistoryServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS)); } bool FaviconServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/chrome/browser/favicon/favicon_service_factory.h b/chrome/browser/favicon/favicon_service_factory.h index f62e408..fd159de 100644 --- a/chrome/browser/favicon/favicon_service_factory.h +++ b/chrome/browser/favicon/favicon_service_factory.h @@ -5,22 +5,25 @@ #ifndef CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ -#include "base/memory/singleton.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 FaviconService; class Profile; +namespace favicon { +class FaviconService; +} + // Singleton that owns all FaviconService and associates them with // Profiles. class FaviconServiceFactory : public BrowserContextKeyedServiceFactory { public: // |sat| defines what the caller plans to do with the service. See // the ServiceAccessType definition in profile.h. - static FaviconService* GetForProfile(Profile* profile, ServiceAccessType sat); + static favicon::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 6d9c9dc..b9716b8 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -15,9 +15,10 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/url_constants.h" #include "components/favicon/content/favicon_url_util.h" +#include "components/favicon/core/favicon_client.h" +#include "components/favicon/core/favicon_driver_observer.h" #include "components/favicon/core/favicon_handler.h" #include "components/favicon/core/favicon_service.h" -#include "components/favicon/core/favicon_tab_helper_observer.h" #include "components/favicon_base/favicon_types.h" #include "components/history/core/browser/history_service.h" #include "components/variations/variations_associated_data.h" @@ -50,27 +51,32 @@ bool IsIconNTPEnabled() { return variations::GetVariationParamValue("IconNTP", "state") == "enabled"; } +#if defined(OS_ANDROID) || defined(OS_IOS) +const bool kDownloadLargestIcon = true; +#else +const bool kDownloadLargestIcon = false; +#endif + } // namespace FaviconTabHelper::FaviconTabHelper(WebContents* web_contents) : content::WebContentsObserver(web_contents), profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) { client_ = ChromeFaviconClientFactory::GetForProfile(profile_); -#if defined(OS_ANDROID) || defined(OS_IOS) - bool download_largest_icon = true; -#else - bool download_largest_icon = false; -#endif - FaviconService* service = FaviconServiceFactory::GetForProfile( + favicon::FaviconService* service = FaviconServiceFactory::GetForProfile( profile_, ServiceAccessType::EXPLICIT_ACCESS); - favicon_handler_.reset(new FaviconHandler( - service, client_, this, FaviconHandler::FAVICON, download_largest_icon)); - if (chrome::kEnableTouchIcon) - touch_icon_handler_.reset(new FaviconHandler( - service, client_, this, FaviconHandler::TOUCH, download_largest_icon)); - if (IsIconNTPEnabled()) - large_icon_handler_.reset(new FaviconHandler( - service, client_, this, FaviconHandler::LARGE, true)); + favicon_handler_.reset(new favicon::FaviconHandler( + service, client_, this, favicon::FaviconHandler::FAVICON, + kDownloadLargestIcon)); + if (chrome::kEnableTouchIcon) { + touch_icon_handler_.reset(new favicon::FaviconHandler( + service, client_, this, favicon::FaviconHandler::TOUCH, + kDownloadLargestIcon)); + } + if (IsIconNTPEnabled()) { + large_icon_handler_.reset(new favicon::FaviconHandler( + service, client_, this, favicon::FaviconHandler::LARGE, true)); + } } FaviconTabHelper::~FaviconTabHelper() { @@ -143,7 +149,7 @@ void FaviconTabHelper::SaveFavicon() { return; history->AddPageNoVisitForBookmark(entry->GetURL(), entry->GetTitle()); - FaviconService* service = FaviconServiceFactory::GetForProfile( + favicon::FaviconService* service = FaviconServiceFactory::GetForProfile( profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (!service) return; @@ -156,17 +162,19 @@ void FaviconTabHelper::SaveFavicon() { entry->GetURL(), favicon.url, favicon_base::FAVICON, favicon.image); } -void FaviconTabHelper::AddObserver(FaviconTabHelperObserver* observer) { +void FaviconTabHelper::AddObserver(favicon::FaviconDriverObserver* observer) { observer_list_.AddObserver(observer); } -void FaviconTabHelper::RemoveObserver(FaviconTabHelperObserver* observer) { +void FaviconTabHelper::RemoveObserver( + favicon::FaviconDriverObserver* observer) { observer_list_.RemoveObserver(observer); } int FaviconTabHelper::StartDownload(const GURL& url, int max_image_size) { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile_->GetOriginalProfile(), + ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service && favicon_service->WasUnableToDownloadFavicon(url)) { DVLOG(1) << "Skip Failed FavIcon: " << url; return 0; @@ -236,9 +244,10 @@ void FaviconTabHelper::OnFaviconAvailable(const gfx::Image& image, content::Details<bool>(&icon_url_changed)); web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); } - if (!image.IsEmpty()) - FOR_EACH_OBSERVER(FaviconTabHelperObserver, observer_list_, + if (!image.IsEmpty()) { + FOR_EACH_OBSERVER(favicon::FaviconDriverObserver, observer_list_, OnFaviconAvailable(image)); + } } content::FaviconStatus& FaviconTabHelper::GetFaviconStatus() { @@ -253,8 +262,9 @@ void FaviconTabHelper::DidStartNavigationToPendingEntry( !profile_->IsOffTheRecord()) { bypass_cache_page_url_ = url; - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::IMPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile( + profile_, ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service) { favicon_service->SetFaviconOutOfDateForPage(url); if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) @@ -305,8 +315,9 @@ 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(), ServiceAccessType::IMPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile( + profile_->GetOriginalProfile(), ServiceAccessType::IMPLICIT_ACCESS); if (favicon_service) favicon_service->UnableToDownloadFavicon(image_url); } diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h index b916d6d..547b37a 100644 --- a/chrome/browser/favicon/favicon_tab_helper.h +++ b/chrome/browser/favicon/favicon_tab_helper.h @@ -10,12 +10,15 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/observer_list.h" -#include "components/favicon/core/favicon_client.h" #include "components/favicon/core/favicon_driver.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" #include "content/public/common/favicon_url.h" +class GURL; +class Profile; +class SkBitmap; + namespace gfx { class Image; } @@ -24,20 +27,20 @@ namespace content { struct FaviconStatus; } -class GURL; +namespace favicon { +class FaviconClient; +class FaviconDriverObserver; class FaviconHandler; -class FaviconTabHelperObserver; -class Profile; -class SkBitmap; +} -// FaviconTabHelper works with FaviconHandlers to fetch the favicons. +// FaviconTabHelper works with favicon::FaviconHandlers to fetch the favicons. // // FetchFavicon fetches the given page's icons. It requests the icons from the // history backend. If the icon is not available or expired, the icon will be // downloaded and saved in the history backend. // class FaviconTabHelper : public content::WebContentsObserver, - public FaviconDriver, + public favicon::FaviconDriver, public content::WebContentsUserData<FaviconTabHelper> { public: ~FaviconTabHelper() override; @@ -72,10 +75,10 @@ class FaviconTabHelper : public content::WebContentsObserver, // Saves the favicon for the current page. void SaveFavicon(); - void AddObserver(FaviconTabHelperObserver* observer); - void RemoveObserver(FaviconTabHelperObserver* observer); + void AddObserver(favicon::FaviconDriverObserver* observer); + void RemoveObserver(favicon::FaviconDriverObserver* observer); - // FaviconDriver methods. + // favicon::FaviconDriver methods. int StartDownload(const GURL& url, int max_bitmap_size) override; bool IsOffTheRecord() override; const gfx::Image GetActiveFaviconImage() override; @@ -123,22 +126,22 @@ class FaviconTabHelper : public content::WebContentsObserver, Profile* profile_; - FaviconClient* client_; + favicon::FaviconClient* client_; std::vector<content::FaviconURL> favicon_urls_; // Bypass cache when downloading favicons for this page URL. GURL bypass_cache_page_url_; - scoped_ptr<FaviconHandler> favicon_handler_; + scoped_ptr<favicon::FaviconHandler> favicon_handler_; - // Handles downloading touchicons. It is NULL if + // Handles downloading touchicons. It is null if // browser_defaults::kEnableTouchIcon is false. - scoped_ptr<FaviconHandler> touch_icon_handler_; + scoped_ptr<favicon::FaviconHandler> touch_icon_handler_; - scoped_ptr<FaviconHandler> large_icon_handler_; + scoped_ptr<favicon::FaviconHandler> large_icon_handler_; - ObserverList<FaviconTabHelperObserver> observer_list_; + ObserverList<favicon::FaviconDriverObserver> observer_list_; DISALLOW_COPY_AND_ASSIGN(FaviconTabHelper); }; diff --git a/chrome/browser/favicon/favicon_tab_helper_browsertest.cc b/chrome/browser/favicon/favicon_tab_helper_browsertest.cc index 2fc363a..25e2223 100644 --- a/chrome/browser/favicon/favicon_tab_helper_browsertest.cc +++ b/chrome/browser/favicon/favicon_tab_helper_browsertest.cc @@ -170,7 +170,7 @@ class FaviconTabHelperTest : public InProcessBrowserTest, // FaviconTabHelperPendingTaskChecker: bool HasPendingTasks() override { - FaviconHandler* favicon_handler = + favicon::FaviconHandler* favicon_handler = FaviconTabHelper::FromWebContents(web_contents()) ->favicon_handler_.get(); return !favicon_handler->download_requests_.empty() || diff --git a/chrome/browser/history/android/android_history_provider_service.cc b/chrome/browser/history/android/android_history_provider_service.cc index 2c897dc..63aa042 100644 --- a/chrome/browser/history/android/android_history_provider_service.cc +++ b/chrome/browser/history/android/android_history_provider_service.cc @@ -459,7 +459,7 @@ AndroidHistoryProviderService::GetLargestRawFaviconForID( favicon_base::FaviconID favicon_id, const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { - FaviconService* fs = FaviconServiceFactory::GetForProfile( + favicon::FaviconService* fs = FaviconServiceFactory::GetForProfile( profile_, ServiceAccessType::EXPLICIT_ACCESS); DCHECK(fs); return fs->GetLargestRawFaviconForID(favicon_id, callback, tracker); diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 3eb22ce..22a73e6 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -396,8 +396,9 @@ void JumpList::StartLoadingFavicon() { return; } - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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 1405326..18203cd 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -237,8 +237,9 @@ void MessageCenterSettingsController::GetNotifierList( ContentSettingsForOneType settings; DesktopNotificationProfileUtil::GetNotificationsSettings(profile, &settings); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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/profiles/profile.h b/chrome/browser/profiles/profile.h index c3b68a1..dcdd679 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -19,7 +19,6 @@ class ChromeAppCacheService; class DevToolsNetworkController; class ExtensionSpecialStoragePolicy; -class FaviconService; class HostContentSettingsMap; class PrefProxyConfigTracker; class PrefService; diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc index 77b13bc..88435a5 100644 --- a/chrome/browser/search/instant_service.cc +++ b/chrome/browser/search/instant_service.cc @@ -131,8 +131,9 @@ InstantService::InstantService(Profile* profile) content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); #endif // !defined(OS_ANDROID) - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS); FallbackIconService* fallback_icon_service = FallbackIconServiceFactory::GetForBrowserContext(profile_); diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index ac57fcd..32db1f9 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -904,8 +904,9 @@ void BookmarkChangeProcessor::ApplyBookmarkFavicon( const scoped_refptr<base::RefCountedMemory>& bitmap_data) { history::HistoryService* history = HistoryServiceFactory::GetForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS); history->AddPageNoVisitForBookmark(bookmark_node->url(), bookmark_node->GetTitle()); diff --git a/chrome/browser/sync/glue/favicon_cache.cc b/chrome/browser/sync/glue/favicon_cache.cc index f722fbc..569644a 100644 --- a/chrome/browser/sync/glue/favicon_cache.cc +++ b/chrome/browser/sync/glue/favicon_cache.cc @@ -437,8 +437,9 @@ void FaviconCache::OnPageFaviconUpdated(const GURL& page_url) { page_task_map_[page_url] = 0; // For testing only. return; } - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index 7bf293e..4a5a6c6 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -250,8 +250,9 @@ void SetFaviconImpl(Profile* profile, BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); FaviconChangeObserver observer(model, node); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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/ui/android/navigation_popup.cc b/chrome/browser/ui/android/navigation_popup.cc index a48c421..53129a2 100644 --- a/chrome/browser/ui/android/navigation_popup.cc +++ b/chrome/browser/ui/android/navigation_popup.cc @@ -40,8 +40,9 @@ void NavigationPopup::FetchFaviconForUrl(JNIEnv* env, jobject obj, jstring jurl) { Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); diff --git a/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h b/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h index ae68fba..bf06e4e 100644 --- a/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h +++ b/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h @@ -11,9 +11,12 @@ #include "ui/app_list/search_provider.h" class AppListControllerDelegate; -class FaviconService; class Profile; +namespace favicon { +class FaviconService; +} // namespace favicon + namespace suggestions { class SuggestionsProfile; class SuggestionsService; @@ -38,7 +41,7 @@ class SuggestionsSearchProvider : public SearchProvider { Profile* profile_; AppListControllerDelegate* list_controller_; - FaviconService* favicon_service_; + favicon::FaviconService* favicon_service_; suggestions::SuggestionsService* suggestions_service_; // For callbacks may be run after destruction. diff --git a/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.cc b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.cc index 8586261..3b1904e 100644 --- a/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.cc +++ b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.cc @@ -22,8 +22,9 @@ namespace app_list { URLSuggestionResult::URLSuggestionResult( - Profile* profile, AppListControllerDelegate* list_controller, - FaviconService* favicon_service, + Profile* profile, + AppListControllerDelegate* list_controller, + favicon::FaviconService* favicon_service, suggestions::SuggestionsService* suggestions_service, const suggestions::ChromeSuggestion& suggestion) : profile_(profile), diff --git a/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h index 5690edd..b4204e4 100644 --- a/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h +++ b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h @@ -11,11 +11,14 @@ #include "ui/app_list/search_result.h" class AppListControllerDelegate; -class FaviconService; class GURL; class Profile; class SkBitmap; +namespace favicon { +class FaviconService; +} // namespace favicon + namespace favicon_base { struct FaviconRawBitmapResult; } // namespace favicon_base @@ -32,7 +35,7 @@ class URLSuggestionResult : public SearchResult { // is expected to live longer that |suggestion|. URLSuggestionResult(Profile* profile, AppListControllerDelegate* list_controller, - FaviconService* favicon_service, + favicon::FaviconService* favicon_service, suggestions::SuggestionsService* suggestions_service, const suggestions::ChromeSuggestion& suggestion); ~URLSuggestionResult() override; @@ -52,7 +55,7 @@ class URLSuggestionResult : public SearchResult { Profile* profile_; AppListControllerDelegate* list_controller_; - FaviconService* favicon_service_; + favicon::FaviconService* favicon_service_; suggestions::SuggestionsService* suggestions_service_; suggestions::ChromeSuggestion suggestion_; scoped_ptr<base::CancelableTaskTracker> cancelable_task_tracker_; diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index 5d5ae9d..560d64b 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm @@ -395,7 +395,7 @@ HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForTab( } void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { - FaviconService* service = FaviconServiceFactory::GetForProfile( + favicon::FaviconService* service = FaviconServiceFactory::GetForProfile( profile_, ServiceAccessType::EXPLICIT_ACCESS); base::CancelableTaskTracker::TaskId task_id = service->GetFaviconImageForPageURL( diff --git a/chrome/browser/ui/search_engines/template_url_table_model.cc b/chrome/browser/ui/search_engines/template_url_table_model.cc index db5a01a..83492ea 100644 --- a/chrome/browser/ui/search_engines/template_url_table_model.cc +++ b/chrome/browser/ui/search_engines/template_url_table_model.cc @@ -115,7 +115,7 @@ class TemplateURLTableModel::ModelEntry { TemplateURLTableModel::TemplateURLTableModel( TemplateURLService* template_url_service, - FaviconService* favicon_service) + favicon::FaviconService* favicon_service) : observer_(NULL), template_url_service_(template_url_service), favicon_service_(favicon_service) { diff --git a/chrome/browser/ui/search_engines/template_url_table_model.h b/chrome/browser/ui/search_engines/template_url_table_model.h index fd48475..03a2bde 100644 --- a/chrome/browser/ui/search_engines/template_url_table_model.h +++ b/chrome/browser/ui/search_engines/template_url_table_model.h @@ -14,10 +14,13 @@ #include "components/search_engines/template_url_service_observer.h" #include "ui/base/models/table_model.h" -class FaviconService; class TemplateURL; class TemplateURLService; +namespace favicon { +class FaviconService; +} + namespace gfx { class ImageSkia; } @@ -37,7 +40,7 @@ class TemplateURLTableModel : public ui::TableModel, TemplateURLServiceObserver { public: TemplateURLTableModel(TemplateURLService* template_url_service, - FaviconService* favicon_service); + favicon::FaviconService* favicon_service); ~TemplateURLTableModel() override; @@ -122,7 +125,7 @@ class TemplateURLTableModel : public ui::TableModel, // The model we're displaying entries from. TemplateURLService* template_url_service_; - FaviconService* favicon_service_; + favicon::FaviconService* favicon_service_; // Index of the last search engine in entries_. This is used to determine the // group boundaries. diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index 762d28d..15d58e7 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -248,8 +248,9 @@ void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) { return; } requested_favicons_.insert(entry->GetUniqueID()); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - browser_->profile(), ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(browser_->profile(), + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; 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 c8e3d39..fa2b428 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc @@ -611,8 +611,9 @@ void RecentTabsSubMenuModel::AddTabFavicon(int command_id, const GURL& url) { // Set default icon first. SetIcon(index_in_menu, default_favicon_); // Start request to fetch actual icon if possible. - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - browser_->profile(), ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(browser_->profile(), + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) return; diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 69ad96c..023af7a 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -559,7 +559,7 @@ void RunFaviconCallbackAsync( const std::vector<favicon_base::FaviconRawBitmapResult>* results) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(&FaviconService::FaviconResultsCallbackRunner, + base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, callback, base::Owned(results))); } diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index aa7ee85..aa4fc2e 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -210,8 +210,9 @@ void ExtensionIconSource::LoadExtensionImage(const ExtensionResource& icon, } void ExtensionIconSource::LoadFaviconImage(int request_id) { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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 1f15edf..7809e73 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -65,8 +65,9 @@ void FaviconSource::StartDataRequest( int render_process_id, int render_frame_id, const content::URLDataSource::GotDataCallback& callback) { - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile_, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service) { SendDefaultResponse(callback); return; diff --git a/chrome/browser/ui/webui/large_icon_source.cc b/chrome/browser/ui/webui/large_icon_source.cc index 1c6d0d2..536b648 100644 --- a/chrome/browser/ui/webui/large_icon_source.cc +++ b/chrome/browser/ui/webui/large_icon_source.cc @@ -38,7 +38,7 @@ LargeIconSource::IconRequest::IconRequest( LargeIconSource::IconRequest::~IconRequest() { } -LargeIconSource::LargeIconSource(FaviconService* favicon_service, +LargeIconSource::LargeIconSource(favicon::FaviconService* favicon_service, FallbackIconService* fallback_icon_service) : favicon_service_(favicon_service), fallback_icon_service_(fallback_icon_service) { diff --git a/chrome/browser/ui/webui/large_icon_source.h b/chrome/browser/ui/webui/large_icon_source.h index 7fcb825..bfe3e65 100644 --- a/chrome/browser/ui/webui/large_icon_source.h +++ b/chrome/browser/ui/webui/large_icon_source.h @@ -14,7 +14,10 @@ #include "content/public/browser/url_data_source.h" class FallbackIconService; + +namespace favicon { class FaviconService; +} // LargeIconSource services explicit chrome:// requests for large icons. // @@ -33,7 +36,7 @@ class LargeIconSource : public content::URLDataSource { public: // |favicon_service| and |fallback_icon_service| are owned by caller and may // be null. - LargeIconSource(FaviconService* favicon_service, + LargeIconSource(favicon::FaviconService* favicon_service, FallbackIconService* fallback_icon_service); ~LargeIconSource() override; @@ -77,7 +80,7 @@ class LargeIconSource : public content::URLDataSource { base::CancelableTaskTracker cancelable_task_tracker_; - FaviconService* favicon_service_; + favicon::FaviconService* favicon_service_; FallbackIconService* fallback_icon_service_; diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index e82057a..801ba18 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -713,8 +713,9 @@ 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, ServiceAccessType::EXPLICIT_ACCESS); + favicon::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 28e2eb1..8f1c392 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc @@ -91,8 +91,9 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor( std::string dom_id; CHECK(args->GetString(1, &dom_id)); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - Profile::FromWebUI(web_ui()), ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()), + ServiceAccessType::EXPLICIT_ACCESS); if (!favicon_service || path.empty()) return; diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc index e6a90c1..d81ebfb 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc @@ -86,8 +86,9 @@ void MostVisitedHandler::RegisterMessages() { // Set up our sources for top-sites data. content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); - FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( - profile, ServiceAccessType::EXPLICIT_ACCESS); + favicon::FaviconService* favicon_service = + FaviconServiceFactory::GetForProfile(profile, + ServiceAccessType::EXPLICIT_ACCESS); FallbackIconService* fallback_icon_service = FallbackIconServiceFactory::GetForBrowserContext(profile); |