summaryrefslogtreecommitdiff
path: root/chromium/components/favicon/core
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/favicon/core')
-rw-r--r--chromium/components/favicon/core/BUILD.gn9
-rw-r--r--chromium/components/favicon/core/favicon_handler.cc25
-rw-r--r--chromium/components/favicon/core/favicon_handler.h8
-rw-r--r--chromium/components/favicon/core/favicon_service.h8
-rw-r--r--chromium/components/favicon/core/favicon_service_impl.cc2
-rw-r--r--chromium/components/favicon/core/favicon_service_impl.h9
6 files changed, 61 insertions, 0 deletions
diff --git a/chromium/components/favicon/core/BUILD.gn b/chromium/components/favicon/core/BUILD.gn
index e281da5a8aa..755e70f5896 100644
--- a/chromium/components/favicon/core/BUILD.gn
+++ b/chromium/components/favicon/core/BUILD.gn
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/features.gni")
+
static_library("core") {
sources = [
"core_favicon_service.cc",
@@ -32,6 +34,13 @@ static_library("core") {
"large_icon_worker.h",
]
+ if (use_qt) {
+ sources += [
+ "favicon_service_impl.cc",
+ "favicon_service_impl.h",
+ ]
+ }
+
deps = [
"//base",
"//base:i18n",
diff --git a/chromium/components/favicon/core/favicon_handler.cc b/chromium/components/favicon/core/favicon_handler.cc
index ddfc129b658..b03e3d150a3 100644
--- a/chromium/components/favicon/core/favicon_handler.cc
+++ b/chromium/components/favicon/core/favicon_handler.cc
@@ -223,6 +223,13 @@ void FaviconHandler::FetchFavicon(const GURL& page_url, bool is_same_document) {
current_candidate_index_ = 0u;
best_favicon_ = DownloadedFavicon();
+#if defined(TOOLKIT_QT)
+ if (delegate_->IsOffTheRecord()) {
+ OnFaviconDataForInitialURLFromFaviconService(std::vector<favicon_base::FaviconRawBitmapResult>());
+ return;
+ }
+#endif
+
// Request the favicon from the history service. In parallel to this the
// renderer is going to notify us (well WebContents) when the favicon url is
// available. We use |last_page_url_| specifically (regardless of other
@@ -478,6 +485,9 @@ void FaviconHandler::OnGotInitialHistoryDataAndIconURLCandidates() {
// The page lists no candidates that match our target |icon_types_|, so
// check if any existing mappings should be deleted.
MaybeDeleteFaviconMappings();
+#if defined(TOOLKIT_QT)
+ delegate_->OnHandlerCompleted(this);
+#endif
return;
}
@@ -492,6 +502,9 @@ void FaviconHandler::OnGotInitialHistoryDataAndIconURLCandidates() {
// TODO: Store all of the icon URLs associated with a page in history so
// that we can check whether the page's icon URLs match the page's icon URLs
// at the time that the favicon data was stored to the history database.
+#if defined(TOOLKIT_QT)
+ delegate_->OnHandlerCompleted(this);
+#endif
return;
}
@@ -565,6 +578,9 @@ void FaviconHandler::OnDidDownloadFavicon(
// Clear download related state.
current_candidate_index_ = final_candidates_->size();
best_favicon_ = DownloadedFavicon();
+#if defined(TOOLKIT_QT)
+ delegate_->OnHandlerCompleted(this);
+#endif
}
}
@@ -656,9 +672,13 @@ void FaviconHandler::GetFaviconAndUpdateMappingsUnlessIncognito(
// favicon for another page that shares the same favicon. Ask for the
// favicon given the favicon URL.
if (delegate_->IsOffTheRecord()) {
+#if defined(TOOLKIT_QT)
+ std::move(callback).Run(std::vector<favicon_base::FaviconRawBitmapResult>());
+#else
service_->GetFavicon(icon_url, icon_type, preferred_icon_size(),
std::move(callback),
&cancelable_task_tracker_for_candidates_);
+#endif
} else {
// Ask the history service for the icon. This does two things:
// 1. Attempts to fetch the favicon data from the database.
@@ -695,6 +715,11 @@ void FaviconHandler::OnFaviconData(
ScheduleImageDownload(current_candidate()->icon_url,
current_candidate()->icon_type);
}
+#if defined(TOOLKIT_QT)
+ else {
+ delegate_->OnHandlerCompleted(this);
+ }
+#endif
}
void FaviconHandler::ScheduleImageDownload(const GURL& image_url,
diff --git a/chromium/components/favicon/core/favicon_handler.h b/chromium/components/favicon/core/favicon_handler.h
index 631d3bf584b..2826297e977 100644
--- a/chromium/components/favicon/core/favicon_handler.h
+++ b/chromium/components/favicon/core/favicon_handler.h
@@ -124,6 +124,10 @@ class FaviconHandler {
virtual void OnFaviconDeleted(
const GURL& page_url,
FaviconDriverObserver::NotificationIconType notification_icon_type) = 0;
+
+#if defined(TOOLKIT_QT)
+ virtual void OnHandlerCompleted(FaviconHandler *handler) {}
+#endif
};
// |service| may be null (which means favicons are not saved). If |service|
@@ -163,6 +167,10 @@ class FaviconHandler {
FaviconDriverObserver::NotificationIconType handler_type,
bool candidates_from_web_manifest);
+#if defined(TOOLKIT_QT)
+ FaviconDriverObserver::NotificationIconType Type() const { return handler_type_; }
+#endif
+
private:
// Used to track a candidate for the favicon.
struct FaviconCandidate {
diff --git a/chromium/components/favicon/core/favicon_service.h b/chromium/components/favicon/core/favicon_service.h
index b6ba9f6b67e..26a6fbda174 100644
--- a/chromium/components/favicon/core/favicon_service.h
+++ b/chromium/components/favicon/core/favicon_service.h
@@ -17,6 +17,10 @@
class GURL;
+namespace history {
+class HistoryService;
+}
+
namespace favicon {
class FaviconService : public CoreFaviconService, public LargeFaviconProvider {
@@ -153,6 +157,10 @@ class FaviconService : public CoreFaviconService, public LargeFaviconProvider {
favicon_base::IconType icon_type,
const gfx::Image& image,
base::OnceCallback<void(bool)> callback) = 0;
+#if defined(TOOLKIT_QT)
+ virtual history::HistoryService* HistoryService() const = 0;
+ virtual void SetHistoryService(history::HistoryService* history_service) = 0;
+#endif
};
} // namespace favicon
diff --git a/chromium/components/favicon/core/favicon_service_impl.cc b/chromium/components/favicon/core/favicon_service_impl.cc
index bcf470bcd07..7c5379cc663 100644
--- a/chromium/components/favicon/core/favicon_service_impl.cc
+++ b/chromium/components/favicon/core/favicon_service_impl.cc
@@ -29,8 +29,10 @@ FaviconServiceImpl::FaviconServiceImpl(
history::HistoryService* history_service)
: favicon_client_(std::move(favicon_client)),
history_service_(history_service) {
+#if !defined(TOOLKIT_QT)
// TODO(https://crbug.com/1024959): convert to DCHECK once crash is resolved.
CHECK(history_service_);
+#endif
}
FaviconServiceImpl::~FaviconServiceImpl() {}
diff --git a/chromium/components/favicon/core/favicon_service_impl.h b/chromium/components/favicon/core/favicon_service_impl.h
index 9daed8cdb31..2b759934518 100644
--- a/chromium/components/favicon/core/favicon_service_impl.h
+++ b/chromium/components/favicon/core/favicon_service_impl.h
@@ -125,6 +125,15 @@ class FaviconServiceImpl : public FaviconService {
void UnableToDownloadFavicon(const GURL& icon_url) override;
bool WasUnableToDownloadFavicon(const GURL& icon_url) const override;
void ClearUnableToDownloadFavicons() override;
+#if defined(TOOLKIT_QT)
+ history::HistoryService* HistoryService() const override {
+ return history_service_;
+ }
+
+ void SetHistoryService(history::HistoryService* history_service) override {
+ history_service_ = history_service;
+ }
+#endif
private:
using MissingFaviconURLHash = size_t;