summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/android/bookmarks/partner_bookmarks_reader.cc7
-rw-r--r--chrome/browser/android/favicon_helper.cc10
-rw-r--r--chrome/browser/android/provider/chrome_browser_provider.cc26
-rw-r--r--chrome/browser/android/provider/chrome_browser_provider.h7
-rw-r--r--chrome/browser/android/shortcut_helper.cc5
-rw-r--r--chrome/browser/android/tab_android.h6
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer.cc5
-rw-r--r--chrome/browser/bookmarks/chrome_bookmark_client.cc5
-rw-r--r--chrome/browser/extensions/api/management/chrome_management_api_delegate.cc5
-rw-r--r--chrome/browser/extensions/extension_web_ui.cc5
-rw-r--r--chrome/browser/favicon/chrome_favicon_client.cc1
-rw-r--r--chrome/browser/favicon/chrome_favicon_client.h4
-rw-r--r--chrome/browser/favicon/chrome_favicon_client_factory.cc7
-rw-r--r--chrome/browser/favicon/chrome_favicon_client_factory.h13
-rw-r--r--chrome/browser/favicon/favicon_handler_unittest.cc100
-rw-r--r--chrome/browser/favicon/favicon_service_factory.cc16
-rw-r--r--chrome/browser/favicon/favicon_service_factory.h9
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.cc63
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.h35
-rw-r--r--chrome/browser/favicon/favicon_tab_helper_browsertest.cc2
-rw-r--r--chrome/browser/history/android/android_history_provider_service.cc2
-rw-r--r--chrome/browser/jumplist_win.cc5
-rw-r--r--chrome/browser/notifications/message_center_settings_controller.cc5
-rw-r--r--chrome/browser/profiles/profile.h1
-rw-r--r--chrome/browser/search/instant_service.cc5
-rw-r--r--chrome/browser/sync/glue/bookmark_change_processor.cc5
-rw-r--r--chrome/browser/sync/glue/favicon_cache.cc5
-rw-r--r--chrome/browser/sync/test/integration/bookmarks_helper.cc5
-rw-r--r--chrome/browser/ui/android/navigation_popup.cc5
-rw-r--r--chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.h7
-rw-r--r--chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.cc5
-rw-r--r--chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h9
-rw-r--r--chrome/browser/ui/cocoa/history_menu_bridge.mm2
-rw-r--r--chrome/browser/ui/search_engines/template_url_table_model.cc2
-rw-r--r--chrome/browser/ui/search_engines/template_url_table_model.h9
-rw-r--r--chrome/browser/ui/toolbar/back_forward_menu_model.cc5
-rw-r--r--chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc5
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc2
-rw-r--r--chrome/browser/ui/webui/extensions/extension_icon_source.cc5
-rw-r--r--chrome/browser/ui/webui/favicon_source.cc5
-rw-r--r--chrome/browser/ui/webui/large_icon_source.cc2
-rw-r--r--chrome/browser/ui/webui/large_icon_source.h7
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc5
-rw-r--r--chrome/browser/ui/webui/ntp/favicon_webui_handler.cc5
-rw-r--r--chrome/browser/ui/webui/ntp/most_visited_handler.cc5
-rw-r--r--chrome/test/base/testing_profile.cc7
-rw-r--r--components/favicon.gypi2
-rw-r--r--components/favicon/core/BUILD.gn2
-rw-r--r--components/favicon/core/favicon_client.h4
-rw-r--r--components/favicon/core/favicon_driver.h6
-rw-r--r--components/favicon/core/favicon_driver_observer.h28
-rw-r--r--components/favicon/core/favicon_handler.cc7
-rw-r--r--components/favicon/core/favicon_handler.h17
-rw-r--r--components/favicon/core/favicon_service.cc49
-rw-r--r--components/favicon/core/favicon_service.h7
-rw-r--r--components/favicon/core/favicon_tab_helper_observer.h24
-rw-r--r--components/history/core/browser/history_service.h7
57 files changed, 348 insertions, 261 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);
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 22b166d..31652ec 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -224,9 +224,10 @@ KeyedService* BuildFallbackIconService(content::BrowserContext* context) {
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));
}
KeyedService* BuildHistoryService(content::BrowserContext* context) {
diff --git a/components/favicon.gypi b/components/favicon.gypi
index 8a9378b..d1aa277 100644
--- a/components/favicon.gypi
+++ b/components/favicon.gypi
@@ -24,11 +24,11 @@
'favicon/core/fallback_icon_service.h',
'favicon/core/favicon_client.h',
'favicon/core/favicon_driver.h',
+ 'favicon/core/favicon_driver_observer.h',
'favicon/core/favicon_handler.cc',
'favicon/core/favicon_handler.h',
'favicon/core/favicon_service.cc',
'favicon/core/favicon_service.h',
- 'favicon/core/favicon_tab_helper_observer.h',
'favicon/core/favicon_url.cc',
'favicon/core/favicon_url.h',
],
diff --git a/components/favicon/core/BUILD.gn b/components/favicon/core/BUILD.gn
index 8a4a0f7..4ac4750 100644
--- a/components/favicon/core/BUILD.gn
+++ b/components/favicon/core/BUILD.gn
@@ -9,11 +9,11 @@ static_library("core") {
"fallback_icon_service.h",
"favicon_client.h",
"favicon_driver.h",
+ "favicon_driver_observer.h",
"favicon_handler.cc",
"favicon_handler.h",
"favicon_service.cc",
"favicon_service.h",
- "favicon_tab_helper_observer.h",
"favicon_url.cc",
"favicon_url.h",
]
diff --git a/components/favicon/core/favicon_client.h b/components/favicon/core/favicon_client.h
index 913485e..c17f9a7 100644
--- a/components/favicon/core/favicon_client.h
+++ b/components/favicon/core/favicon_client.h
@@ -14,6 +14,8 @@
class GURL;
+namespace favicon {
+
// This class abstracts operations that depend on the embedder's environment,
// e.g. Chrome.
class FaviconClient : public KeyedService {
@@ -44,4 +46,6 @@ class FaviconClient : public KeyedService {
DISALLOW_COPY_AND_ASSIGN(FaviconClient);
};
+} // namespace favicon
+
#endif // COMPONENTS_FAVICON_CORE_FAVICON_CLIENT_H_
diff --git a/components/favicon/core/favicon_driver.h b/components/favicon/core/favicon_driver.h
index f06ca0d..de53125 100644
--- a/components/favicon/core/favicon_driver.h
+++ b/components/favicon/core/favicon_driver.h
@@ -5,12 +5,16 @@
#ifndef COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
#define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
+#include <base/macros.h>
+
class GURL;
namespace gfx {
class Image;
}
+namespace favicon {
+
// Interface that allows Favicon core code to interact with its driver (i.e.,
// obtain information from it and give information to it). A concrete
// implementation must be provided by the driver.
@@ -61,4 +65,6 @@ class FaviconDriver {
DISALLOW_COPY_AND_ASSIGN(FaviconDriver);
};
+} // namespace favicon
+
#endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
diff --git a/components/favicon/core/favicon_driver_observer.h b/components/favicon/core/favicon_driver_observer.h
new file mode 100644
index 0000000..fb64c1c
--- /dev/null
+++ b/components/favicon/core/favicon_driver_observer.h
@@ -0,0 +1,28 @@
+// Copyright 2014 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_FAVICON_CORE_FAVICON_DRIVER_OBSERVER_H_
+#define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_OBSERVER_H_
+
+namespace gfx {
+class Image;
+}
+
+namespace favicon {
+
+// An observer implemented by classes which are interested in event from
+// FaviconDriver.
+class FaviconDriverObserver {
+ public:
+ // Called when favicon |image| is retrieved from either web site or cached
+ // storage.
+ virtual void OnFaviconAvailable(const gfx::Image& image) = 0;
+
+ protected:
+ virtual ~FaviconDriverObserver() {}
+};
+
+} // namespace favicon
+
+#endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_OBSERVER_H_
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
index 641b0f1..bcdff7c 100644
--- a/components/favicon/core/favicon_handler.cc
+++ b/components/favicon/core/favicon_handler.cc
@@ -22,8 +22,7 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_util.h"
-using favicon::FaviconURL;
-
+namespace favicon {
namespace {
// Size (along each axis) of a touch icon. This currently corresponds to
@@ -691,7 +690,7 @@ int FaviconHandler::ScheduleDownload(const GURL& url,
void FaviconHandler::SortAndPruneImageUrls() {
// Not using const-reference since the loop mutates FaviconURL::icon_sizes.
- for (favicon::FaviconURL& image_url : image_urls_) {
+ for (FaviconURL& image_url : image_urls_) {
if (image_url.icon_sizes.empty())
continue;
@@ -703,3 +702,5 @@ void FaviconHandler::SortAndPruneImageUrls() {
std::stable_sort(image_urls_.begin(), image_urls_.end(),
CompareIconSize);
}
+
+} // namespace favicon
diff --git a/components/favicon/core/favicon_handler.h b/components/favicon/core/favicon_handler.h
index c7181c5..9e59e00 100644
--- a/components/favicon/core/favicon_handler.h
+++ b/components/favicon/core/favicon_handler.h
@@ -19,15 +19,20 @@
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
-class FaviconClient;
-class FaviconDriver;
-class FaviconService;
+class FaviconTabHelperTest;
class SkBitmap;
+class TestFaviconHandler;
namespace base {
class RefCountedMemory;
}
+namespace favicon {
+
+class FaviconClient;
+class FaviconDriver;
+class FaviconService;
+
// FaviconHandler works with FaviconDriver to fetch the specific type of
// favicon.
//
@@ -152,8 +157,8 @@ class FaviconHandler {
private:
// For testing:
- friend class FaviconTabHelperTest;
- friend class TestFaviconHandler;
+ friend class ::FaviconTabHelperTest;
+ friend class ::TestFaviconHandler;
// Represents an in progress download of an image from the renderer.
struct DownloadRequest {
@@ -312,4 +317,6 @@ class FaviconHandler {
DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
};
+} // namespace favicon
+
#endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
diff --git a/components/favicon/core/favicon_service.cc b/components/favicon/core/favicon_service.cc
index b455f1e..dd1ada4c 100644
--- a/components/favicon/core/favicon_service.cc
+++ b/components/favicon/core/favicon_service.cc
@@ -19,8 +19,7 @@
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
-using base::Bind;
-
+namespace favicon {
namespace {
// Helper to run callback with empty results if we cannot get the history
@@ -32,7 +31,8 @@ base::CancelableTaskTracker::TaskId RunWithEmptyResultAsync(
base::ThreadTaskRunnerHandle::Get());
return tracker->PostTask(
thread_runner.get(), FROM_HERE,
- Bind(callback, std::vector<favicon_base::FaviconRawBitmapResult>()));
+ base::Bind(callback,
+ std::vector<favicon_base::FaviconRawBitmapResult>()));
}
// Returns a vector of pixel edge sizes from |size_in_dip| and
@@ -68,8 +68,8 @@ base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImage(
const favicon_base::FaviconImageCallback& callback,
base::CancelableTaskTracker* tracker) {
favicon_base::FaviconResultsCallback callback_runner =
- Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults,
- base::Unretained(this), callback, gfx::kFaviconSize);
+ base::Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults,
+ base::Unretained(this), callback, gfx::kFaviconSize);
if (history_service_) {
std::vector<GURL> icon_urls;
icon_urls.push_back(icon_url);
@@ -90,10 +90,8 @@ base::CancelableTaskTracker::TaskId FaviconService::GetRawFavicon(
const favicon_base::FaviconRawBitmapCallback& callback,
base::CancelableTaskTracker* tracker) {
favicon_base::FaviconResultsCallback callback_runner =
- Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
- base::Unretained(this),
- callback,
- desired_size_in_pixel);
+ base::Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
+ base::Unretained(this), callback, desired_size_in_pixel);
if (history_service_) {
std::vector<GURL> icon_urls;
@@ -131,13 +129,10 @@ base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForPageURL(
const favicon_base::FaviconImageCallback& callback,
base::CancelableTaskTracker* tracker) {
return GetFaviconForPageURLImpl(
- page_url,
- favicon_base::FAVICON,
+ page_url, favicon_base::FAVICON,
GetPixelSizesForFaviconScales(gfx::kFaviconSize),
- Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults,
- base::Unretained(this),
- callback,
- gfx::kFaviconSize),
+ base::Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults,
+ base::Unretained(this), callback, gfx::kFaviconSize),
tracker);
}
@@ -150,13 +145,9 @@ base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForPageURL(
std::vector<int> desired_sizes_in_pixel;
desired_sizes_in_pixel.push_back(desired_size_in_pixel);
return GetFaviconForPageURLImpl(
- page_url,
- icon_types,
- desired_sizes_in_pixel,
- Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
- base::Unretained(this),
- callback,
- desired_size_in_pixel),
+ page_url, icon_types, desired_sizes_in_pixel,
+ base::Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
+ base::Unretained(this), callback, desired_size_in_pixel),
tracker);
}
@@ -168,10 +159,8 @@ FaviconService::GetLargestRawFaviconForPageURL(
const favicon_base::FaviconRawBitmapCallback& callback,
base::CancelableTaskTracker* tracker) {
favicon_base::FaviconResultsCallback favicon_results_callback =
- Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
- base::Unretained(this),
- callback,
- 0);
+ base::Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
+ base::Unretained(this), callback, 0);
if (favicon_client_ && favicon_client_->IsNativeApplicationURL(page_url)) {
std::vector<int> desired_sizes_in_pixel;
desired_sizes_in_pixel.push_back(0);
@@ -227,10 +216,8 @@ base::CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForID(
// any resizing.
int desired_size = 0;
favicon_base::FaviconResultsCallback callback_runner =
- Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
- base::Unretained(this),
- callback,
- desired_size);
+ base::Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults,
+ base::Unretained(this), callback, desired_size);
if (history_service_) {
return history_service_->GetFaviconForID(
@@ -389,3 +376,5 @@ void FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults(
&resized_bitmap_data);
callback.Run(bitmap_result);
}
+
+} // namespace favicon
diff --git a/components/favicon/core/favicon_service.h b/components/favicon/core/favicon_service.h
index 9e45c55..d122e90 100644
--- a/components/favicon/core/favicon_service.h
+++ b/components/favicon/core/favicon_service.h
@@ -16,13 +16,16 @@
#include "components/favicon_base/favicon_usage_data.h"
#include "components/keyed_service/core/keyed_service.h"
-class FaviconClient;
class GURL;
namespace history {
class HistoryService;
}
+namespace favicon {
+
+class FaviconClient;
+
// The favicon service provides methods to access favicons. It calls the history
// backend behind the scenes. The callbacks are run asynchronously, even in the
// case of an error.
@@ -251,4 +254,6 @@ class FaviconService : public KeyedService {
DISALLOW_COPY_AND_ASSIGN(FaviconService);
};
+} // namespace favicon
+
#endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
diff --git a/components/favicon/core/favicon_tab_helper_observer.h b/components/favicon/core/favicon_tab_helper_observer.h
deleted file mode 100644
index bf8a053..0000000
--- a/components/favicon/core/favicon_tab_helper_observer.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 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_FAVICON_CORE_FAVICON_TAB_HELPER_OBSERVER_H_
-#define COMPONENTS_FAVICON_CORE_FAVICON_TAB_HELPER_OBSERVER_H_
-
-namespace gfx {
-class Image;
-}
-
-// An observer implemented by classes which are interested in envent in
-// FaviconTabHelper.
-class FaviconTabHelperObserver {
- public:
- // Called when favicon |image| is retrieved from either web site or history
- // backend.
- virtual void OnFaviconAvailable(const gfx::Image& image) = 0;
-
- protected:
- virtual ~FaviconTabHelperObserver() {}
-};
-
-#endif // COMPONENTS_FAVICON_CORE_FAVICON_TAB_HELPER_OBSERVER_H_
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h
index 5231a03..7d7b00c 100644
--- a/components/history/core/browser/history_service.h
+++ b/components/history/core/browser/history_service.h
@@ -33,7 +33,6 @@
#include "sync/api/syncable_service.h"
#include "ui/base/page_transition_types.h"
-class FaviconService;
class GURL;
class HistoryQuickProviderTest;
class HistoryURLProvider;
@@ -49,6 +48,10 @@ class FilePath;
class Thread;
}
+namespace favicon {
+class FaviconService;
+}
+
namespace history {
struct DownloadRow;
@@ -512,7 +515,7 @@ class HistoryService : public syncer::SyncableService, public KeyedService {
class BackendDelegate;
friend class base::RefCountedThreadSafe<HistoryService>;
friend class BackendDelegate;
- friend class ::FaviconService;
+ friend class favicon::FaviconService;
friend class HistoryBackend;
friend class HistoryQueryTest;
friend class HistoryOperation;