Commit 3cf447cc authored by jif@chromium.org's avatar jif@chromium.org

Revert of Bypass the favicon_service when importing favicons....

Revert of Bypass the favicon_service when importing favicons. (https://codereview.chromium.org/375613002/)

Reason for revert:
There's a better approach.

Original issue's description:
> Bypass the favicon_service when importing favicons.
> 
> BUG=391795
> TBR=gab
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284045

TBR=blundell@chromium.org,jif@google.com,gab@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=391795

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284092 0039d316-1c4b-4281-b951-d872f2087c98
parent 9a79ba51
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/common/importer/imported_favicon_usage.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/favicon_base/favicon_types.h" #include "components/favicon_base/favicon_types.h"
#include "components/favicon_base/favicon_util.h" #include "components/favicon_base/favicon_util.h"
...@@ -282,6 +283,12 @@ void FaviconService::CloneFavicon(const GURL& old_page_url, ...@@ -282,6 +283,12 @@ void FaviconService::CloneFavicon(const GURL& old_page_url,
history_service_->CloneFavicons(old_page_url, new_page_url); history_service_->CloneFavicons(old_page_url, new_page_url);
} }
void FaviconService::SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage) {
if (history_service_)
history_service_->SetImportedFavicons(favicon_usage);
}
void FaviconService::MergeFavicon( void FaviconService::MergeFavicon(
const GURL& page_url, const GURL& page_url,
const GURL& icon_url, const GURL& icon_url,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
class FaviconClient; class FaviconClient;
class GURL; class GURL;
class HistoryService; class HistoryService;
struct ImportedFaviconUsage;
class Profile; class Profile;
// The favicon service provides methods to access favicons. It calls the history // The favicon service provides methods to access favicons. It calls the history
...@@ -172,6 +173,12 @@ class FaviconService : public KeyedService { ...@@ -172,6 +173,12 @@ class FaviconService : public KeyedService {
// page is ever visited. // page is ever visited.
void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url);
// Allows the importer to set many favicons for many pages at once. The pages
// must exist, any favicon sets for unknown pages will be discarded. Existing
// favicons will not be overwritten.
void SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage);
// Set the favicon for |page_url| for |icon_type| in the thumbnail database. // Set the favicon for |page_url| for |icon_type| in the thumbnail database.
// Unlike SetFavicons(), this method will not delete preexisting bitmap data // Unlike SetFavicons(), this method will not delete preexisting bitmap data
// which is associated to |page_url| if at all possible. Use this method if // which is associated to |page_url| if at all possible. Use this method if
......
...@@ -687,6 +687,13 @@ void HistoryService::CloneFavicons(const GURL& old_page_url, ...@@ -687,6 +687,13 @@ void HistoryService::CloneFavicons(const GURL& old_page_url,
old_page_url, new_page_url); old_page_url, new_page_url);
} }
void HistoryService::SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage) {
DCHECK(thread_checker_.CalledOnValidThread());
ScheduleAndForget(PRIORITY_NORMAL,
&HistoryBackend::SetImportedFavicons, favicon_usage);
}
base::CancelableTaskTracker::TaskId HistoryService::QueryURL( base::CancelableTaskTracker::TaskId HistoryService::QueryURL(
const GURL& url, const GURL& url,
bool want_visits, bool want_visits,
...@@ -706,15 +713,6 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryURL( ...@@ -706,15 +713,6 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryURL(
&RunWithQueryURLResult, callback, base::Owned(query_url_result))); &RunWithQueryURLResult, callback, base::Owned(query_url_result)));
} }
// Importer --------------------------------------------------------------------
void HistoryService::SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage) {
DCHECK(thread_checker_.CalledOnValidThread());
ScheduleAndForget(
PRIORITY_NORMAL, &HistoryBackend::SetImportedFavicons, favicon_usage);
}
// Downloads ------------------------------------------------------------------- // Downloads -------------------------------------------------------------------
// Handle creation of a download by creating an entry in the history service's // Handle creation of a download by creating an entry in the history service's
......
...@@ -377,14 +377,6 @@ class HistoryService : public CancelableRequestProvider, ...@@ -377,14 +377,6 @@ class HistoryService : public CancelableRequestProvider,
syncer::SyncError ProcessLocalDeleteDirective( syncer::SyncError ProcessLocalDeleteDirective(
const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive);
// Importer ------------------------------------------------------------------
// Used by the ProfileWriter for importing many favicons for many pages at
// once. The pages must exist, any favicon sets for unknown pages will be
// discarded. Existing favicons will not be overwritten.
void SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage);
// Downloads ----------------------------------------------------------------- // Downloads -----------------------------------------------------------------
// Implemented by the caller of 'CreateDownload' below, and is called when the // Implemented by the caller of 'CreateDownload' below, and is called when the
...@@ -728,6 +720,12 @@ class HistoryService : public CancelableRequestProvider, ...@@ -728,6 +720,12 @@ class HistoryService : public CancelableRequestProvider,
// provided that other page does not already have favicons. // provided that other page does not already have favicons.
void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url);
// Used by the FaviconService for importing many favicons for many pages at
// once. The pages must exist, any favicon sets for unknown pages will be
// discarded. Existing favicons will not be overwritten.
void SetImportedFavicons(
const std::vector<ImportedFaviconUsage>& favicon_usage);
// Sets the in-memory URL database. This is called by the backend once the // Sets the in-memory URL database. This is called by the backend once the
// database is loaded to make it available. // database is loaded to make it available.
void SetInMemoryBackend( void SetInMemoryBackend(
......
...@@ -231,10 +231,8 @@ void ProfileWriter::AddBookmarks( ...@@ -231,10 +231,8 @@ void ProfileWriter::AddBookmarks(
void ProfileWriter::AddFavicons( void ProfileWriter::AddFavicons(
const std::vector<ImportedFaviconUsage>& favicons) { const std::vector<ImportedFaviconUsage>& favicons) {
HistoryService* history_service = FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)->
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); SetImportedFavicons(favicons);
if (history_service)
history_service->SetImportedFavicons(favicons);
} }
typedef std::map<std::string, TemplateURL*> HostPathMap; typedef std::map<std::string, TemplateURL*> HostPathMap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment