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

Jump to navigation Jump to search
Formatting the links
(Created the page with basic wiki formatting)
 
(Formatting the links)
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.
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]
 
[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]
Line 12: Line 10:


There is nothing interesting happening here. It just uses nsIWindowWatcher to show the downloads window by giving the chrome url of downloads.xul and the windowType attribute value. Now all the action happens when the window loads and by that I mean in the '''onLoad''' handler of the DM window which is '''Startup()''' present in downloads.js and in particular here: [http://mxr.mozilla.org/seamonkey/source/toolkit/mozapps/downloads/content/downloads.js#406].  
There is nothing interesting happening here. It just uses nsIWindowWatcher to show the downloads window by giving the chrome url of downloads.xul and the windowType attribute value. Now all the action happens when the window loads and by that I mean in the '''onLoad''' handler of the DM window which is '''Startup()''' present in downloads.js and in particular here: [http://mxr.mozilla.org/seamonkey/source/toolkit/mozapps/downloads/content/downloads.js#406].  
And the function definition itself is here: http://mxr.mozilla.org/seamonkey/source/toolkit/mozapps/downloads/content/downloads.js#174
And the function definition itself is here: [http://mxr.mozilla.org/seamonkey/source/toolkit/mozapps/downloads/content/downloads.js#174]


All of it self-explanative, but one thing to note here is the variable: '''gUserInteracted'''. Based on my mxr search this is not used anywhere other than this downloads.js file. And in this file, there is only one assignment which is during initialization where it is set to false. So this variable is probably doomed to be false through out. (I am thinking of making its life better, if I succeed this document must also change).
All of it self-explanative, but one thing to note here is the variable: '''gUserInteracted'''. Based on my mxr search this is not used anywhere other than this downloads.js file. And in this file, there is only one assignment which is during initialization where it is set to false. So this variable is probably doomed to be false through out. (I am thinking of making its life better, if I succeed this document must also change).
95

edits

Navigation menu