/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; var EXPORTED_SYMBOLS = [ "PictureInPictureChild", "PictureInPictureToggleChild", "PictureInPictureLauncherChild", ]; ChromeUtils.defineModuleGetter( this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm" ); ChromeUtils.defineModuleGetter( this, "Services", "resource://gre/modules/Services.jsm" ); ChromeUtils.defineModuleGetter( this, "KEYBOARD_CONTROLS", "resource://gre/modules/PictureInPictureControls.jsm" ); ChromeUtils.defineModuleGetter( this, "TOGGLE_POLICIES", "resource://gre/modules/PictureInPictureControls.jsm" ); ChromeUtils.defineModuleGetter( this, "TOGGLE_POLICY_STRINGS", "resource://gre/modules/PictureInPictureControls.jsm" ); ChromeUtils.defineModuleGetter( this, "Rect", "resource://gre/modules/Geometry.jsm" ); ChromeUtils.defineModuleGetter( this, "ContentDOMReference", "resource://gre/modules/ContentDOMReference.jsm" ); const { XPCOMUtils } = ChromeUtils.import( "resource://gre/modules/XPCOMUtils.jsm" ); const TOGGLE_ENABLED_PREF = "media.videocontrols.picture-in-picture.video-toggle.enabled"; const TOGGLE_TESTING_PREF = "media.videocontrols.picture-in-picture.video-toggle.testing"; const MOUSEMOVE_PROCESSING_DELAY_MS = 50; const TOGGLE_HIDING_TIMEOUT_MS = 2000; // The ToggleChild does not want to capture events from the PiP // windows themselves. This set contains all currently open PiP // players' content windows var gPlayerContents = new WeakSet(); // To make it easier to write tests, we have a process-global // WeakSet of all