declare namespace chrome { export type ContentWindow = { postMessage(message: any, targetOrigin: string): void; }; export interface webviewTag extends HTMLElement { contentWindow: ContentWindow; src: string; } } interface AppDocument extends Document { webkitCancelFullScreen(): void; } declare namespace chrome.app.window { export type FrameOptions = { activeColor?: string; color?: string; inactiveColor?: string; type?: string; }; export type Bounds = { height: number; left: number; maxHeight?: number; maxWidth?: number; minHeight?: number; minWidth?: number; top: number; width: number; setMaximumSize: Function; setMinimumSize: Function; setPosition: Function; setSize: Function; }; export type BoundsSpecification = { height?: number; left?: number; maxHeight?: number; maxWidth?: number; minHeight?: number; minWidth?: number; top?: number; width?: number; visibleOnAllWorkspaces?: boolean; }; export type State = 'normal' | 'fullscreen' | 'maximized' | 'minimized'; export type WindowType = 'shell' | 'panel'; export type CreateWindowOptions = { alwaysOnTop?: boolean; focused?: boolean; frame?: string | FrameOptions; hidden?: boolean; icon?: string; id?: string; innerBounds?: BoundsSpecification; outerBounds?: BoundsSpecification; resizable?: boolean; singleton?: boolean; state?: State; type?: WindowType; }; export type ContentBounds = { height?: number; left?: number; top?: number; width?: number; }; export interface AppWindow { contentWindow: any; // TODO: any id: string; innerBounds: Bounds; onBoundsChanged: any; // TODO: any onMinimized: any; // TODO: any onRestored: any; // TODO: any onClosed: any; // TODO: any close(): void; isAlwaysOnTop(): boolean; isMinimized(): boolean; isMaximized(): boolean; isFullscreen(): boolean; minimize(): void; restore(): void; setAlwaysOnTop(b: boolean): void; fullscreen(): void; show(): void; focus(): void; setBounds(bounds: ContentBounds): void; // DEPRECATED: Use innerBounds or outerBounds } export function create( url: string, options?: CreateWindowOptions, callback?: (createdWindow: AppWindow) => void ): void; export function current(): AppWindow; }