76
edits
Line 30: | Line 30: | ||
In this section, the product's architecture is described. Any individual components or actors are identified, their "knowledge" or what data they store is identified, and data flow between components and external entities is described. | In this section, the product's architecture is described. Any individual components or actors are identified, their "knowledge" or what data they store is identified, and data flow between components and external entities is described. | ||
'''The main objective of this feature/product is:''' | '''The main objective of this feature/product is:''' to inform general web content within tabs and windows of the user's idle and active state. | ||
'''Design Documents''': | '''Design Documents''': | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=715041#c21 | https://bugzilla.mozilla.org/show_bug.cgi?id=715041#c21 | ||
Line 41: | Line 39: | ||
Describe any major components in the system and how they interact. Also include any third-party APIs (those Mozilla does not control) and what type of data is sent or received via those APIs. | Describe any major components in the system and how they interact. Also include any third-party APIs (those Mozilla does not control) and what type of data is sent or received via those APIs. | ||
=== Component | === Component IdleService === | ||
This component receives requests to register/add and remove idle observers. It has a timers that notify the registered idle observers. The global window registers with the idle service as an idle observer. The idle service component notifies (interacts with) the global window of an idle or 'back'/active events. The global window performs functions based on the 'idle'/'back' notifications received. | |||
The tables below simply summarize the data encountered by this component. | |||
'''Stored Data:''' | |||
{| class="nsIdleService" | |||
|- | |||
! What: Idle Service notifier | |||
! Where: /widget/xpwidgets/nsIdleService.cpp | |||
|- | |||
| data type: nsIObserver, EventListener, | |||
| where stored: nsIObserver stored within an EventListener object stored in an nsTArray of EventListeners of nsIOserver pointers to objects. | |||
|} | |||
'''Communication with Component nsGlobalWindow''' | |||
{| class="nsGlobalWindow" | |||
|- | |||
! Direction: nsIdleService to nsGlobalWindow and vice-versa | |||
! Message: | |||
! - nsIdleService sends a topic of 'idle' or 'back' to nsGlobalWindow | |||
! - nsGlobalWindow requests an add idle observer or remove idle observer from nsIdleService. | |||
! | |||
! Data: Pointer to a nsIObserver object. | |||
! Notes: None | |||
|- | |||
| ''In:'' | |||
| message 1 | |||
| - nsGlobalWindow requests an add idle observer or remove idle observer from nsIdleService. A pointer to the nsIObserver object that is being added or removed is sent to the nsIdleObserver. | |||
| | |||
|- | |||
| ''Out:'' | |||
| message 2 | |||
| - nsIdleService to nsGlobalWindow, data sent is a string called topic which is either "idle" or "active". | |||
| | |||
|} | |||
This component | === Component nsGlobalWindow === | ||
This component: | |||
- requests the addition of idle observers to the nsIdleService | |||
- requests the removal of idle observers to the nsIdleService | |||
- receives idle/back/active notifications from the nsIdleService | |||
- interacts with nsIdleService | |||
- maintains a local idle timer that is triggered when an event notification is received from the nsIdleService which then triggers the local timer if there are any local idle observers for that particular global window. | |||
The tables below simply summarize the data encountered by this component. | The tables below simply summarize the data encountered by this component. | ||
Line 49: | Line 93: | ||
'''Stored Data:''' | '''Stored Data:''' | ||
{| class=" | {| class="nsGlobalWindow" | ||
|- | |- | ||
! What | ! What: - nsTArray of idle observers | ||
! Where | ! - one nITimer local timer for idle observers of the global window | ||
! Where: dom/base/nsGlobalWindow | |||
|- | |- | ||
| data type | | data type | ||
Line 58: | Line 103: | ||
|} | |} | ||
'''Communication with Component | '''Communication with Component IdleService''' | ||
{| class=" | {| class="nsGlobalWindow" | ||
|- | |- | ||
! Direction | ! Direction: nsGlobalWindow to nsIdleService | ||
! Message | ! Message: Add/remove idle observer | ||
! Data | ! Data: pointer to nsIObserver observer object. | ||
! Notes | ! Notes: None | ||
|- | |- | ||
| ''In:'' | | ''In:'' | ||
| message 1 | | message 1 | ||
| | | Add/remove idle observer with a pointer to the nsIObserver object. | ||
| | | | ||
|- | |- | ||
| ''Out:'' | | ''Out:'' | ||
| message 2 | | message 2 | ||
| | | None | ||
| | |||
|} | |||
=== Component Navigator === | |||
This component receives a request from the frontend javascript test to register/add and remove idle observers which passes an idle time, a callback function when the user is idle and a callback function when the user is active. | |||
The tables below simply summarize the data encountered by this component. | |||
'''Stored Data:''' | |||
{| class="Navigator" | |||
|- | |||
! What: Navigator | |||
! Where: /dom/base/Navigator.cpp | |||
|- | |||
| data type: nsIObserver | |||
| where stored: not applicable | |||
|} | |||
'''Communication with Component nsGlobalWindow''' | |||
{| class="nsGlobalWindow" | |||
|- | |||
! Direction: Navigator to nsGlobalWindow | |||
! Message: add/remove idle observer from Navigator to nsGlobalWindow. | |||
! | |||
! Data: nsIObserver object. | |||
! Notes: None | |||
|- | |||
| ''In:'' | |||
| message 1: Navigator receives requests to add/remove idle observers. | |||
| | |||
|- | |||
| ''Out:'' | |||
| message 2: Navigator requests an add/remove idle observers. | |||
| | | | ||
|} | |} |
edits