import type * as OpenFin from '../../OpenFin'; import { NamedEvent } from './base'; import { CrashedEvent } from './application'; type BaseLoadFailedEvent = NamedEvent & { errorCode: number; errorDescription: string; validatedURL: string; isMainFrame: boolean; }; export type ResourceLoadFailedEvent = BaseLoadFailedEvent & { type: 'resource-load-failed'; }; export type ResourceResponseReceivedEvent = NamedEvent & { type: 'response-received'; status: boolean; newUrl: string; originalUrl: string; httpResponseCode: number; requestMethod: string; referrer: string; headers: any; resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; }; export type PageTitleUpdatedEvent = NamedEvent & { type: 'page-title-updated'; title: string; }; export type CertificateErrorEvent = NamedEvent & { type: 'certificate-error'; error: string; url: string; certificate: OpenFin.Certificate; }; export type CertificateSelectionShownEvent = NamedEvent & { type: 'certificate-selection-shown'; url: string; certificates: OpenFin.Certificate[]; }; export type FaviconUpdatedEvent = NamedEvent & { type: 'page-favicon-updated'; favicons: string[]; }; export type NavigationRejectedEvent = NamedEvent & { type: 'navigation-rejected'; sourceName?: string; url: string; }; type BaseUrlEvent = NamedEvent & { type: 'url-changed'; url: string; }; export type UrlChangedEvent = BaseUrlEvent & ({ isInPage: true; } | { isInPage: false; httpResponseCode: number; httpStatusText: string; }); export type DidFinishLoadEvent = NamedEvent & { type: 'did-finish-load'; }; export type DidFailLoadEvent = BaseLoadFailedEvent & { type: 'did-fail-load'; }; export type FoundInPageEvent = NamedEvent & { type: 'found-in-page'; } & { result: OpenFin.FindInPageResult; }; export type BlurredEvent = NamedEvent & { type: 'blurred'; }; export type DidChangeThemeColorEvent = NamedEvent & { type: 'did-change-theme-color'; }; export type FocusedEvent = NamedEvent & { type: 'focused'; }; export type ChildContentBlockedEvent = NamedEvent & { type: 'child-content-blocked'; }; export type ChildContentOpenedInBrowserEvent = NamedEvent & { type: 'child-content-opened-in-browser'; }; export type ChildViewCreatedEvent = NamedEvent & { type: 'child-view-created'; }; export type FileDownloadEvent = NamedEvent & { state: 'started' | 'progressing' | 'cancelled' | 'interrupted' | 'completed'; /** * The url from which the file is being downloaded. */ url: string; mimeType: string; /** * Name used to save the file locally. */ fileName: string; /** * Original name of the file. */ originalFileName: string; totalBytes: number; /** * The number of seconds since the UNIX epoch when the download was started. */ startTime: number; /** * The value of the Content-Disposition field from the response header. */ contentDisposition: string; /** * The value of the Last-Modified header. */ lastModifiedTime: Date; /** * The value of the ETag header. */ eTag: string; /** * The number of bytes of the item that have already been downloaded. */ downloadedBytes: number; }; export type FileDownloadStartedEvent = FileDownloadEvent & { type: 'file-download-started'; state: 'started'; }; export type FileDownloadProgressEvent = FileDownloadEvent & { type: 'file-download-progress'; state: 'progressing' | 'interrupted'; }; export type FileDownloadCompletedEvent = FileDownloadEvent & { type: 'file-download-completed'; state: 'completed' | 'interrupted' | 'cancelled'; }; /** * A WebContents event that does propagate to (republish on) parent topics. */ export type WillPropagateWebContentsEvent = BlurredEvent | CertificateSelectionShownEvent | CrashedEvent | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | FaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent; /** * A WebContents event that does not propagate to (republish on) parent topics. */ export type NonPropagatedWebContentsEvent = FoundInPageEvent | CertificateErrorEvent; export type WebContentsEvent = NonPropagatedWebContentsEvent | WillPropagateWebContentsEvent; export {};