michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMWindow; michael@0: interface nsIWebProgressListener; michael@0: michael@0: /** michael@0: * The nsIWebProgress interface is used to add or remove nsIWebProgressListener michael@0: * instances to observe the loading of asynchronous requests (usually in the michael@0: * context of a DOM window). michael@0: * michael@0: * nsIWebProgress instances may be arranged in a parent-child configuration, michael@0: * corresponding to the parent-child configuration of their respective DOM michael@0: * windows. However, in some cases a nsIWebProgress instance may not have an michael@0: * associated DOM window. The parent-child relationship of nsIWebProgress michael@0: * instances is not made explicit by this interface, but the relationship may michael@0: * exist in some implementations. michael@0: * michael@0: * A nsIWebProgressListener instance receives notifications for the michael@0: * nsIWebProgress instance to which it added itself, and it may also receive michael@0: * notifications from any nsIWebProgress instances that are children of that michael@0: * nsIWebProgress instance. michael@0: */ michael@0: [scriptable, uuid(bd0efb3b-1c81-4fb0-b16d-576a2be48a95)] michael@0: interface nsIWebProgress : nsISupports michael@0: { michael@0: /** michael@0: * The following flags may be combined to form the aNotifyMask parameter for michael@0: * the addProgressListener method. They limit the set of events that are michael@0: * delivered to an nsIWebProgressListener instance. michael@0: */ michael@0: michael@0: /** michael@0: * These flags indicate the state transistions to observe, corresponding to michael@0: * nsIWebProgressListener::onStateChange. michael@0: * michael@0: * NOTIFY_STATE_REQUEST michael@0: * Only receive the onStateChange event if the aStateFlags parameter michael@0: * includes nsIWebProgressListener::STATE_IS_REQUEST. michael@0: * michael@0: * NOTIFY_STATE_DOCUMENT michael@0: * Only receive the onStateChange event if the aStateFlags parameter michael@0: * includes nsIWebProgressListener::STATE_IS_DOCUMENT. michael@0: * michael@0: * NOTIFY_STATE_NETWORK michael@0: * Only receive the onStateChange event if the aStateFlags parameter michael@0: * includes nsIWebProgressListener::STATE_IS_NETWORK. michael@0: * michael@0: * NOTIFY_STATE_WINDOW michael@0: * Only receive the onStateChange event if the aStateFlags parameter michael@0: * includes nsIWebProgressListener::STATE_IS_WINDOW. michael@0: * michael@0: * NOTIFY_STATE_ALL michael@0: * Receive all onStateChange events. michael@0: */ michael@0: const unsigned long NOTIFY_STATE_REQUEST = 0x00000001; michael@0: const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002; michael@0: const unsigned long NOTIFY_STATE_NETWORK = 0x00000004; michael@0: const unsigned long NOTIFY_STATE_WINDOW = 0x00000008; michael@0: const unsigned long NOTIFY_STATE_ALL = 0x0000000f; michael@0: michael@0: /** michael@0: * These flags indicate the other events to observe, corresponding to the michael@0: * other four methods defined on nsIWebProgressListener. michael@0: * michael@0: * NOTIFY_PROGRESS michael@0: * Receive onProgressChange events. michael@0: * michael@0: * NOTIFY_STATUS michael@0: * Receive onStatusChange events. michael@0: * michael@0: * NOTIFY_SECURITY michael@0: * Receive onSecurityChange events. michael@0: * michael@0: * NOTIFY_LOCATION michael@0: * Receive onLocationChange events. michael@0: * michael@0: * NOTIFY_REFRESH michael@0: * Receive onRefreshAttempted events. michael@0: * This is defined on nsIWebProgressListener2. michael@0: */ michael@0: const unsigned long NOTIFY_PROGRESS = 0x00000010; michael@0: const unsigned long NOTIFY_STATUS = 0x00000020; michael@0: const unsigned long NOTIFY_SECURITY = 0x00000040; michael@0: const unsigned long NOTIFY_LOCATION = 0x00000080; michael@0: const unsigned long NOTIFY_REFRESH = 0x00000100; michael@0: michael@0: /** michael@0: * This flag enables all notifications. michael@0: */ michael@0: const unsigned long NOTIFY_ALL = 0x000001ff; michael@0: michael@0: /** michael@0: * Registers a listener to receive web progress events. michael@0: * michael@0: * @param aListener michael@0: * The listener interface to be called when a progress event occurs. michael@0: * This object must also implement nsISupportsWeakReference. michael@0: * @param aNotifyMask michael@0: * The types of notifications to receive. michael@0: * michael@0: * @throw NS_ERROR_INVALID_ARG michael@0: * Indicates that aListener was either null or that it does not michael@0: * support weak references. michael@0: * @throw NS_ERROR_FAILURE michael@0: * Indicates that aListener was already registered. michael@0: */ michael@0: void addProgressListener(in nsIWebProgressListener aListener, michael@0: in unsigned long aNotifyMask); michael@0: michael@0: /** michael@0: * Removes a previously registered listener of progress events. michael@0: * michael@0: * @param aListener michael@0: * The listener interface previously registered with a call to michael@0: * addProgressListener. michael@0: * michael@0: * @throw NS_ERROR_FAILURE michael@0: * Indicates that aListener was not registered. michael@0: */ michael@0: void removeProgressListener(in nsIWebProgressListener aListener); michael@0: michael@0: /** michael@0: * The DOM window associated with this nsIWebProgress instance. michael@0: * michael@0: * @throw NS_ERROR_FAILURE michael@0: * Indicates that there is no associated DOM window. michael@0: */ michael@0: readonly attribute nsIDOMWindow DOMWindow; michael@0: readonly attribute uint64_t DOMWindowID; michael@0: michael@0: /** michael@0: * Indicates whether DOMWindow.top == DOMWindow. michael@0: */ michael@0: readonly attribute boolean isTopLevel; michael@0: michael@0: /** michael@0: * Indicates whether or not a document is currently being loaded michael@0: * in the context of this nsIWebProgress instance. michael@0: */ michael@0: readonly attribute boolean isLoadingDocument; michael@0: michael@0: /** michael@0: * Contains a load type as specified by the load* constants in michael@0: * nsIDocShellLoadInfo.idl. michael@0: */ michael@0: readonly attribute unsigned long loadType; michael@0: };