Bug 553489 - Part9: NotifyStep. r=sdwilsh

This commit is contained in:
Marco Bonardo 2010-03-25 12:34:47 +01:00
Родитель 5fdcdaacbd
Коммит b3c445b4a4
3 изменённых файлов: 47 добавлений и 3 удалений

Просмотреть файл

@ -932,6 +932,36 @@ AssociateIconWithPageStep::HandleCompletion(PRUint16 aReason)
////////////////////////////////////////////////////////////////////////////////
//// NotifyStep
NS_IMPL_ISUPPORTS_INHERITED0(
NotifyStep
, AsyncFaviconStep
)
void
NotifyStep::Run()
{
NS_ASSERTION(mStepper, "Step is not associated to a stepper");
// If a new icon has been added to the database or an icon has been associated
// with a page, we want to notify.
FAVICONSTEP_CANCEL_IF_TRUE(mStepper->mData.Length() == 0, PR_FALSE);
if (mStepper->mIconStatus & ICON_STATUS_SAVED ||
mStepper->mIconStatus & ICON_STATUS_ASSOCIATED) {
nsFaviconService* fs = nsFaviconService::GetFaviconService();
FAVICONSTEP_FAIL_IF_FALSE(fs);
fs->SendFaviconNotifications(mStepper->mPageURI, mStepper->mIconURI);
nsresult rv = fs->UpdateBookmarkRedirectFavicon(mStepper->mPageURI,
mStepper->mIconURI);
FAVICONSTEP_FAIL_IF_FALSE(NS_SUCCEEDED(rv));
}
// Proceed to next step.
nsresult rv = mStepper->Step();
FAVICONSTEP_FAIL_IF_FALSE(NS_SUCCEEDED(rv));
}
} // namespace places
} // namespace mozilla

Просмотреть файл

@ -378,6 +378,19 @@ public:
void Run();
};
/**
* Notify favicon changes.
*/
class NotifyStep : public AsyncFaviconStep
{
public:
NS_DECL_ISUPPORTS_INHERITED
NotifyStep() {};
void Run();
};
} // namespace places
} // namespace mozilla

Просмотреть файл

@ -163,6 +163,10 @@ public:
return nsnull;
}
nsresult UpdateBookmarkRedirectFavicon(nsIURI* aPage, nsIURI* aFavicon);
void SendFaviconNotifications(nsIURI* aPage, nsIURI* aFaviconURI);
NS_DECL_ISUPPORTS
NS_DECL_NSIFAVICONSERVICE
@ -213,9 +217,6 @@ private:
nsresult SetFaviconUrlForPageInternal(nsIURI* aURI, nsIURI* aFavicon,
PRBool* aHasData);
nsresult UpdateBookmarkRedirectFavicon(nsIURI* aPage, nsIURI* aFavicon);
void SendFaviconNotifications(nsIURI* aPage, nsIURI* aFaviconURI);
friend class FaviconLoadListener;
bool mShuttingDown;