User:Brahmana/Downloads Complete Alert Control Flow: Difference between revisions

Made few things bold
(Formatting the links)
(Made few things bold)
 
Line 1: Line 1:
Here I assume the state of the download changed to "Download Completed" and hence the 'nsDownload::OnStateChange()' is called. This will call 'nsDownload::SetState()' to carry out necessary action for the new state of the download. It is here that we decide to show the sliding alert based on the value of the corresponding preference: browser.download.manager.showAlertOnComplete. This alert is shown using the 'nsIAlertService'. Here is the code which does that: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/downloads/src/nsDownloadManager.cpp#1933]
Here I assume the state of the download changed to "Download Completed" and hence the '''nsDownload::OnStateChange()''' is called. This will call '''nsDownload::SetState()''' to carry out necessary action for the new state of the download. It is here that we decide to show the sliding alert based on the value of the corresponding preference: browser.download.manager.showAlertOnComplete. This alert is shown using the '''nsIAlertService'''. Here is the code which does that: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/downloads/src/nsDownloadManager.cpp#1933]


Based on the definition of 'nsIAlertService' here: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/alerts/public/nsIAlertsService.idl#46]
Based on the definition of '''nsIAlertService''' here: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/alerts/public/nsIAlertsService.idl#46]
and the final function call "alerts->ShowAlertNotification()" tells us that we send the DownloadManager as the listener for any callbacks from the alert service.
and the final function call "alerts->ShowAlertNotification()" tells us that we send the DownloadManager as the listener for any callbacks from the alert service.


Again from the alert service interface definition its clear that for any callbacks it will call the 'Observe()' function of the listener that was passed to it. Further when it needs to do a callback for a click by the user it sends "clickalertcallback" as the topic which brings us back to DownloadManager here: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/downloads/src/nsDownloadManager.cpp#1780]
Again from the alert service interface definition its clear that for any callbacks it will call the '''Observe()''' function of the listener that was passed to it. Further when it needs to do a callback for a click by the user it sends "clickalertcallback" as the topic which brings us back to DownloadManager here: [http://mxr.mozilla.org/seamonkey/source/toolkit/components/downloads/src/nsDownloadManager.cpp#1780]
As seen this code just shows DMUI.
As seen this code just shows DMUI.


95

edits