Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1868)

Unified Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 684983003: Add Observer in FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/favicon/favicon_tab_helper.cc
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index 3992f8f02aca60b86bc066008245594ad18c5a90..b0ff7566473d995460d92fc555859a59d2d0950e 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -136,6 +136,14 @@ void FaviconTabHelper::SaveFavicon() {
entry->GetURL(), favicon.url, favicon_base::FAVICON, favicon.image);
}
+void FaviconTabHelper::AddObserver(Observer* observer) {
+ observer_list_.AddObserver(observer);
+}
+
+void FaviconTabHelper::RemoveObserver(Observer* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
int FaviconTabHelper::StartDownload(const GURL& url, int max_image_size) {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS);
@@ -195,6 +203,10 @@ void FaviconTabHelper::SetActiveFaviconValidity(bool validity) {
GetFaviconStatus().valid = validity;
}
+void FaviconTabHelper::OnFaviconAvailable(const gfx::Image& image) {
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnFaviconAvailable(image));
+}
+
content::FaviconStatus& FaviconTabHelper::GetFaviconStatus() {
DCHECK(web_contents()->GetController().GetActiveEntry());
return web_contents()->GetController().GetActiveEntry()->GetFavicon();

Powered by Google App Engine
This is Rietveld 408576698