| Index: chrome/browser/extensions/browser_event_router.cc
|
| diff --git a/chrome/browser/extensions/browser_event_router.cc b/chrome/browser/extensions/browser_event_router.cc
|
| index 7b701f2ef50a5f6a44134a713bc1021fcc6302fb..56b688e06141fcf20fbca5e464f2e8d54d0e56f8 100644
|
| --- a/chrome/browser/extensions/browser_event_router.cc
|
| +++ b/chrome/browser/extensions/browser_event_router.cc
|
| @@ -21,9 +21,12 @@
|
| #include "chrome/browser/ui/browser_iterator.h"
|
| #include "chrome/browser/ui/browser_list.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/extensions/api/extension_action/action_info.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| +#include "content/public/browser/favicon_status.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| +#include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -128,6 +131,9 @@ void BrowserEventRouter::RegisterForTabNotifications(WebContents* contents) {
|
| // a devtools WebContents that is opened in window, docked, then closed.
|
| registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<WebContents>(contents));
|
| +
|
| + registrar_.Add(this, chrome::NOTIFICATION_FAVICON_UPDATED,
|
| + content::Source<WebContents>(contents));
|
| }
|
|
|
| void BrowserEventRouter::UnregisterForTabNotifications(WebContents* contents) {
|
| @@ -135,6 +141,8 @@ void BrowserEventRouter::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));
|
| }
|
|
|
| void BrowserEventRouter::OnBrowserRemoved(Browser* browser) {
|
| @@ -352,6 +360,21 @@ void BrowserEventRouter::TabUpdated(WebContents* contents, bool did_navigate) {
|
| DispatchTabUpdatedEvent(contents, changed_properties.Pass());
|
| }
|
|
|
| +void BrowserEventRouter::FaviconUrlUpdated(WebContents* contents,
|
| + const bool* icon_url_changed) {
|
| + if (!icon_url_changed || !*icon_url_changed)
|
| + return;
|
| + content::NavigationEntry* entry =
|
| + contents->GetController().GetActiveEntry();
|
| + if (!entry || !entry->GetFavicon().valid)
|
| + return;
|
| + scoped_ptr<DictionaryValue> changed_properties(new DictionaryValue());
|
| + changed_properties->SetString(
|
| + tab_keys::kFaviconUrlKey,
|
| + entry->GetFavicon().url.possibly_invalid_spec());
|
| + DispatchTabUpdatedEvent(contents, changed_properties.Pass());
|
| +}
|
| +
|
| void BrowserEventRouter::DispatchEvent(
|
| Profile* profile,
|
| const char* event_name,
|
| @@ -467,6 +490,12 @@ void BrowserEventRouter::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) {
|
| + WebContents* contents = content::Source<WebContents>(source).ptr();
|
| + const bool* icon_url_changed = content::Details<bool>(details).ptr();
|
| + FaviconUrlUpdated(contents, icon_url_changed);
|
| } else {
|
| NOTREACHED();
|
| }
|
|
|