webappmanager
|
#include <WebAppManager.h>
Public Member Functions | |
virtual | ~WebAppManager () |
virtual void | run () |
Event::Orientation | orientation () const |
std::list< const ProcessBase * > | runningApps () |
std::list< const ProcessBase * > | runningApps (WindowType::Type winType) |
WebAppBase * | findApp (const QString &processId) |
WebAppBase * | findAppById (const QString &appId) |
LSHandle * | getStatsServiceHandle () const |
void | copiedToClipboard (const QString &appId) |
void | pastedFromClipboard (const QString &appId) |
void | closePageSoon (SysMgrWebBridge *page) |
void | closePageRequest (SysMgrWebBridge *page) |
void | onMessageReceived (const PIpcMessage &msg) |
void | onDisconnected () |
void | setJavascriptFlags (const std::string &flags) |
void | sendAsyncMessage (PIpcMessage *msg) |
void | markUniversalSearchReady () |
void | closeByProcessId (const std::string &processId) |
const void | setHostInfo (const HostInfo *hostInfo) |
const HostInfo & | getHostInfo () const |
void | reportAppLaunched (const QString &appId, const QString &processId) |
void | reportAppClosed (const QString &appId, const QString &processId) |
int | currentUiWidth () |
int | currentUiHeight () |
bool | isDevicePortraitType () |
void | disableAppCaching (bool disable) |
void | setInSimulatedMouseEvent (bool val) |
bool | inSimulatedMouseEvent () const |
void | setActiveAppId (const std::string &id) |
const std::string & | getActiveAppId () |
Public Member Functions inherited from SyncTask | |
SyncTask () | |
SyncTask (GMainContext *ctxt) | |
virtual | ~SyncTask () |
virtual void | quit () |
Static Public Member Functions | |
static WebAppManager * | instance () |
static bool | hasBeenInstanced () |
static const std::string | getTimeZone () |
static SharedGlobalProperties * | globalProperties () |
Protected Member Functions | |
void | onLaunchUrl (const std::string &url, int winType, const std::string &appDesc, const std::string &procId, const std::string &args, const std::string &launchingAppId, const std::string &launchingProcId) |
void | onLaunchUrlChild (const std::string &url, int winType, const std::string &appDesc, const std::string &procId, const std::string &args, const std::string &launchingAppId, const std::string &launchingProcId, int &errorCode, bool isHeadless) |
void | onRelaunchApp (const std::string &procId, const std::string &args, const std::string &launchingAppId, const std::string &launchingProcId) |
void | onSetOrientation (int orient) |
void | onGlobalProperties (int key) |
void | onInspectByProcessId (const std::string &processId) |
void | performLowMemoryActions (const bool allowExpensive=false) |
void | monitorNativeProcessMemory (const pid_t pid, const int maxMemory, pid_t updateFromPid=0) |
void | clearWebkitCache () |
void | enableDebugger (bool enable) |
void | onShutdownEvent () |
bool | onKillApp (const std::string &appId) |
void | onSyncKillApp (const std::string &appId, bool *result) |
void | onProcMgrLaunch (const std::string &appDescString, const std::string ¶ms, const std::string &launchingAppId, const std::string &launchingProcId) |
void | onProcMgrLaunchChild (const std::string &appDescString, const std::string ¶ms, const std::string &launchingAppId, const std::string &launchingProcId, bool isHeadless, bool isParentPdk) |
void | onProcMgrLaunchBootTimApp (const std::string &appDescString) |
void | onListOfRunningAppsRequest (bool includeSysApps) |
void | onDeleteHTML5Database (const std::string &domain) |
void | inputEvent (int ipcKey, sptr< Event > e) |
void | onUiDimensionsChanged (int width, int height) |
void | onSuspendWebkitProcess (bool *result) |
virtual void | threadStarting () |
virtual void | threadStopping () |
virtual void | handleEvent (sptr< Event >) |
virtual void | windowedAppAdded (WindowedWebApp *app) |
virtual void | windowedAppKeyChanged (WindowedWebApp *app, int oldKey) |
virtual void | windowedAppRemoved (WindowedWebApp *app) |
Friends | |
class | SysMgrWebBridge |
class | SysMgrWebPage |
class | WebAppBase |
class | WindowedWebApp |
class | MemoryWatcher |
class | PalmSystem |
class | CardWebApp |
class | AlertWebApp |
class | DashboardWebApp |
class | ProcessManager |
Manages running web apps
|
virtual |
Shuts down and cleans up this process's instance of WebAppManager
Closes all web apps managed by this WebAppManager.
|
protected |
Clears the global system WebKit cache
void WebAppManager::closeByProcessId | ( | const std::string & | processId | ) |
Finds an app by its process ID and closes it
processId | Process ID of the app to close. |
void WebAppManager::closePageRequest | ( | SysMgrWebBridge * | page | ) |
Request that the given page be closed.
void WebAppManager::closePageSoon | ( | SysMgrWebBridge * | page | ) |
Close a page after processing events
Queues up an event to close the given page so that once the event queue finishes processing all current events it goes through and closes all pages which WebAppManager has been asked to close by then.
page | Page to queue up to close. |
void WebAppManager::copiedToClipboard | ( | const QString & | appId | ) |
Adds a banner to indicate that text has been copied to the clipboard
appId | App ID of the app that copied text to the clipboard. |
|
inline |
Gets the height of the UI in pixels
|
inline |
Gets the width of the UI in pixels
void WebAppManager::disableAppCaching | ( | bool | disable | ) |
Disables/enables caching of apps when they're closed
By default under certain circumstances apps can be cached when they're closed. This allows you to disable/enable that functionality.
disable | true to disable app caching, false to enable it. |
|
protected |
Enables the debugger
Current just a wrapper for Palm::WebGlobal::enableDebugger().
WebAppBase * WebAppManager::findApp | ( | const QString & | processId | ) |
Find an app by process ID
processID | Process ID of the app to look for. |
WebAppBase * WebAppManager::findAppById | ( | const QString & | appId | ) |
Find an app by app ID
appID | App ID of the app to look for. |
|
inline |
const HostInfo & WebAppManager::getHostInfo | ( | ) | const |
Gets the cached host device information structure
Retrieves the cached HostInfo structure if it has already been stored using WebAppManager::setHostInfo().
LSHandle * WebAppManager::getStatsServiceHandle | ( | ) | const |
Gets a Luna Service handle to talk to the statistics service
Gets a handle to the statistics service used to report memory statistics to Luna.
|
static |
Gets the time zone from the last time the clock was checked
|
static |
Unknown at this time.
|
protectedvirtual |
Handles a GLib event from the event queue
Currently the only event we handle is InputEvent, which is sent by us internally when WebAppManager::inputEvent() is called.
Doesn't appear to be used anymore.
event | The event to handle. |
Reimplemented from SyncTask.
|
static |
Checks whether or not a WebAppManager instance has been constructed for this process
Return value indicates whether or not WebAppManager::instance() has been called yet for this process.
|
protected |
Posts an event to the event queue to be dispatched to a given app
This used to be used by WebAppManager::onInputEvent(), but since that has been commented out, this is probably unnecessary to have around anymore.
ipcKey | IPC key of the app to dispatch the event to. |
e | Event to dispatch. |
|
inline |
Unknown at this time
See if this is actually used anywhere and for what.
See if we can remove this.
|
static |
Gets this process's WebAppManager instance
WebAppManager is designed as a singleton and can only be constructed once per process. This method returns the allowed instance of WebAppManager for this process and constructs one if one has not yet been created.
|
inline |
Returns whether, in the current device orientation, the rotated screen is taller than wide
Checks to see, with the host device info structure and current orientation, if the screen is being held in such a way that the "vertical" direction is taller than the "horizontal" direction.
void WebAppManager::markUniversalSearchReady | ( | ) |
Lets the bootup screen know that Universal Search is ready
The boot process waits until Universal Search is available before it considers itself "done". This lets it know that Universal Search is all set and ready to use.
|
protected |
Missing implementation
Can't seem to find an implementation of this. Without that, it's unknown what this does.
pid | Unknown. |
maxMemory | Unknown. |
updateFromPid | Unknown. |
|
protected |
Handles an IPC message asking us to delete all HTML5 localStorage data for a given domain
Since we're managing web apps, it's quite possible they will store data in localStorage. This IPC call gives other processes a canonical way to delete that.
Could be quite dangerous, actually, if this is exposed to non-system apps. At this point, it's unknown if that is the case or not.
Confirm details of this once Palm::WebGlobal::deleteDatabasesForDomain() is publicly documented.
Ensure this IPC call is not exposed to non-system apps.
domain | The domain to delete localStorage for. |
void WebAppManager::onDisconnected | ( | ) |
Logs a message indicating that a remote server disconnected
Figure out the purpose for this.
See if this can be removed entirely.
|
protected |
Unknown at the moment
Both the purpose and function of this are currently unknown.
key | Unknown. |
|
protected |
Calls WebAppBase::inspect() for an app
Unknown exactly what the function of this is.
processId | Process ID of the app to inspect. |
|
protected |
Handles an IPC message to close an app
Closes all instances of a given app in response to something else asking us (via InterProcess Communication message) to close an app.
appId | App ID of the app to close. |
|
protected |
Handle an IPC message asking us to open a URL
This method is run whenever the Palm InterProcess Communication hands us a message from another process asking us to open a URL.
url | URL to open. |
winType | Type of window to open. |
procId | Process ID to use for the new WebPage being opened. |
launchingAppId | App ID of the app launching this URL. |
launchingProcId | Process ID of the app launching this URL. |
|
protected |
Handle an IPC message asking us to launch a URL as a child window of another process
This method is run whenever the Palm InterProcess Communication hands us a message from another process asking us to open a URL as a child of another window.
url | URL to open. |
winType | Type of window to open. |
procId | Process ID to use for the new WebPage being opened. |
launchingAppId | App ID of the app launching this URL. |
launchingProcId | Process ID of the app launching this URL. |
errorCode | Variable (passed by reference) for this method to return an error code into if something goes wrong. |
isHeadless | Ignored, at the moment. Purpose is currently unclear. |
|
protected |
Handles an IPC message asking for a list of all running processes
Sends back an IPC ViewHost_ListOfRunningAppsResponse with a single parameter - a JSON string laid out as follows:
includeSysApps | Whether or not to include system app processes (those without an app ID) in the list. |
void WebAppManager::onMessageReceived | ( | const PIpcMessage & | msg | ) |
Dispatch an InterProcess Communication message to the correct spot
Dispatches an IPC message to an app or to one of the onSomething methods of this class depending on the type of message.
msg | IPC message to process. |
|
protected |
Handles an IPC message asking us to launch an app
Launches a web app given its App ID. Pretty simple. See ProcessManager::launch() for more information (it's actually quite well-documented already.
appDescString | App ID of the web app to launch. |
params | JSON launch parameters to pass to the new app. |
launchingAppId | App ID of the app asking us to launch this new app. |
launchingProcId | Process ID of the app asking us to launch this new app (can be NULL). |
|
protected |
Appears to handles an IPC message asking us to launch a headless app at boot time
Document this more fully once ProcessManager::launchBootTimeApp() is fully documented.
Add the missing "e" into the name so it matches ProcessManager.
appDescString | App ID of the app to launch. |
|
protected |
Handles an IPC message asking us to launch an app as a modal child of another app
Launches a web app given its App ID. Differs from WebAppManager::onProcMgrLaunch() in that the new app is set up as a child of the given launching parent and is launched in a modal configuration where it must be dismissed in some way before returning to the parent.
appDescString | App ID of the web app to launch. |
params | JSON launch parameters to pass to the new app. |
launchingAppId | App ID of the app asking us to launch this new app. |
launchingProcId | Process ID of the app asking us to launch this new app (can be NULL). |
isHeadless | true to create an app with no visible window, false to create a modal child app. |
isParentPdk | Pass in true if the parent is a PDK app instead of a web app, false otherwise. |
|
protected |
Finds an app and relaunches it
Unsure at the moment why an app would need to be relaunched.
procId | Process ID of the app to relaunch. |
args | Launch arguments to pass to the app when it relaunches. |
launchingAppId | App ID of the app requesting the relaunch. |
launchingProcId | Process ID of the app requesting the relaunch. |
|
protected |
Run when device orientation has changed
Lets all open WebApps know that "up" has changed direction and that their displays need to rotate to match the screen's direction.
orient | New orientation - one of Event::Orientation_Up, Event::Orientation_Down, Event::Orientation_Left, Event::Orientation_Right. |
|
protected |
Handles an IPC message to close all apps
If TARGET_DESKTOP is defined, this method deletes all open apps from memory then runs the garbage collector to clean up memory.
Either way, it then closes down the GLib main loop and returns.
|
protected |
Handle an IPC message from the SysMgr process telling us our process is going to be suspended
The SysMgr process is suspending this process. As soon as we return from this function the process will be suspended.
result | Variable to place a result into to return to the caller. Always set to true in our implementation. |
|
protected |
Handles an IPC message to close an app and notify the caller when done
Closes all instances of a given app in response to something else asking us (via InterProcess Communication message) to close an app.
Differs from WebAppManager::onKillApp() in that this one returns a result back to the caller to let them know that, yes, we did close everything asked of us.
appId | App ID of the app to close. |
result | Where to store the result of closing apps. Value will be set to true if one or more instances of the given app were open and have now been closed or false if the app was not already open. |
|
protected |
Handle an IPC message telling us that output dimensions have changed
width | New width. |
height | New height. |
Event::Orientation WebAppManager::orientation | ( | ) | const |
Gets the device's current orientation
Returns which side of the display is currently facing up.
void WebAppManager::pastedFromClipboard | ( | const QString & | appId | ) |
Doesn't do anything
Doesn't do anything right now.
appId | App ID of the app that pasted text from the clipboard. |
|
protected |
Ask MemoryWatcher and the main SysMgr process to perform low memory actions
allowExpensive | Guessing this is whether or not to spend additional time to clean up memory due to running really low. |
void WebAppManager::reportAppClosed | ( | const QString & | appId, |
const QString & | processId | ||
) |
Reports to the Luna statistics service that an app has been closed
appId | App ID of the app which has been closed. |
processId | Process ID of the app which has been closed. |
void WebAppManager::reportAppLaunched | ( | const QString & | appId, |
const QString & | processId | ||
) |
Reports to the Luna statistics service that an app has been launched
appId | App ID of the app which has been launched. |
processId | Process ID of the app which has been launched. |
|
virtual |
Reimplemented from SyncTask.
std::list< const ProcessBase * > WebAppManager::runningApps | ( | ) |
Get a list of process information for all running web apps
This class manages web apps running on the system. It tracks all apps and stores information about them. This method returns system information about them, such as their process IDs.
std::list< const ProcessBase * > WebAppManager::runningApps | ( | WindowType::Type | winType | ) |
Get a list of process information for all running web apps filtered to only those of a certain type
This class manages web apps running on the system. It tracks all apps and stores information about them. This method returns system information about them, such as their process IDs, but only those of a given type.
winType | Type of app to look for. |
void WebAppManager::sendAsyncMessage | ( | PIpcMessage * | msg | ) |
Sends an InterProcess Communication message
msg | IPC message to dispatch. |
|
inline |
const void WebAppManager::setHostInfo | ( | const HostInfo * | hostInfo | ) |
Caches a version of the host device information structure
This structure contains information about the device that LunaSysMgr is running on, and is quite useful for checking what size the screen is. By caching it here, it doesn't have to be looked up every time it's used.
This can be retrieved from HostBase::instance()->getInfo().
hostInfo | Host device info to cache. |
|
inline |
Unknown at this time
See if this is actually used anywhere and for what.
See if we can remove this.
val | Unknown at this time. |
void WebAppManager::setJavascriptFlags | ( | const std::string & | flags | ) |
Sets options in Palm::WebGlobal
flags | Command-line-style flags to process (currently only –timeout_script_execution and –notimeout_script_execution seem to be specifically supported). |
|
protectedvirtual |
Initializes WebAppManager
Initializes the various components of WebAppManager:
Figure out why this isn't just put into WebAppManager::run(), since that appears to be the only place it's used, at least unless this class is derived from someplace.
can locale change without restarting sysmgr?
|
protectedvirtual |
Clean up WebAppManager as much as possible in preparation for having our thread stopped
Doesn't currently do anything.
|
protectedvirtual |
Add an already-launched app to the group of apps we're managing
Used internally by WebAppManager::launchUrl() and WebAppManager::launchUrlChild().
app | New already-launched app to manage. |
|
protectedvirtual |
Lets us know that an app's key has changed
app | The app that changed keys. |
oldKey | The key it used to use before the change. |
|
protectedvirtual |
Remove an app from the list of apps we're managing
Tells us not to manage an app anymore. Essentially just removes the tracking link between it and us.
app | App that we should no longer manage. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |