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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_event_router.cc

Issue 1059743003: Remove NOTIFICATION_FAVICON_UPDATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-active-title
Patch Set: Add DISALLOW_COPY_AND_ASSIGN(FaviconUpdateWatcher) Created 5 years, 8 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/extensions/api/tabs/tabs_event_router.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
index baab0e12ffeef2f666fae69c5454aeff8b6e8550..8cbd5349d61f2d9d735d9f9355b83a2655213310 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
#include "chrome/browser/extensions/api/tabs/windows_event_router.h"
#include "chrome/browser/extensions/extension_tab_util.h"
+#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_iterator.h"
@@ -94,7 +95,8 @@ base::DictionaryValue* TabsEventRouter::TabEntry::DidNavigate(
return changed_properties;
}
-TabsEventRouter::TabsEventRouter(Profile* profile) : profile_(profile) {
+TabsEventRouter::TabsEventRouter(Profile* profile)
+ : profile_(profile), favicon_scoped_observer_(this) {
DCHECK(!profile->IsOffTheRecord());
BrowserList::AddObserver(this);
@@ -148,8 +150,7 @@ void TabsEventRouter::RegisterForTabNotifications(WebContents* contents) {
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::Source<WebContents>(contents));
- registrar_.Add(this, chrome::NOTIFICATION_FAVICON_UPDATED,
- content::Source<WebContents>(contents));
+ favicon_scoped_observer_.Add(FaviconTabHelper::FromWebContents(contents));
ZoomController::FromWebContents(contents)->AddObserver(this);
}
@@ -159,8 +160,7 @@ void TabsEventRouter::UnregisterForTabNotifications(WebContents* contents) {
content::Source<NavigationController>(&contents->GetController()));
registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::Source<WebContents>(contents));
- registrar_.Remove(this, chrome::NOTIFICATION_FAVICON_UPDATED,
- content::Source<WebContents>(contents));
+ favicon_scoped_observer_.Remove(FaviconTabHelper::FromWebContents(contents));
ZoomController::FromWebContents(contents)->RemoveObserver(this);
}
@@ -501,12 +501,8 @@ void TabsEventRouter::Observe(int type,
content::Source<NavigationController>(&contents->GetController()));
registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::Source<WebContents>(contents));
- registrar_.Remove(this, chrome::NOTIFICATION_FAVICON_UPDATED,
- content::Source<WebContents>(contents));
- } else if (type == chrome::NOTIFICATION_FAVICON_UPDATED) {
- bool icon_url_changed = *content::Details<bool>(details).ptr();
- if (icon_url_changed)
- FaviconUrlUpdated(content::Source<WebContents>(source).ptr());
+ favicon_scoped_observer_.Remove(
+ FaviconTabHelper::FromWebContents(contents));
} else {
NOTREACHED();
}
@@ -585,4 +581,16 @@ void TabsEventRouter::OnZoomChanged(
EventRouter::USER_GESTURE_UNKNOWN);
}
+void TabsEventRouter::OnFaviconAvailable(const gfx::Image& image) {
+}
+
+void TabsEventRouter::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
+ bool icon_url_changed) {
+ if (icon_url_changed) {
+ FaviconTabHelper* favicon_tab_helper =
+ static_cast<FaviconTabHelper*>(favicon_driver);
+ FaviconUrlUpdated(favicon_tab_helper->web_contents());
+ }
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_event_router.h ('k') | chrome/browser/favicon/favicon_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698