From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- dom/html/nsBrowserElement.h | 140 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 dom/html/nsBrowserElement.h (limited to 'dom/html/nsBrowserElement.h') diff --git a/dom/html/nsBrowserElement.h b/dom/html/nsBrowserElement.h new file mode 100644 index 000000000..e0f4ca186 --- /dev/null +++ b/dom/html/nsBrowserElement.h @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef nsBrowserElement_h +#define nsBrowserElement_h + +#include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/BrowserElementAudioChannel.h" + +#include "nsCOMPtr.h" +#include "nsIBrowserElementAPI.h" + +class nsFrameLoader; + +namespace mozilla { + +namespace dom { +struct BrowserElementDownloadOptions; +struct BrowserElementExecuteScriptOptions; +class BrowserElementNextPaintEventCallback; +class DOMRequest; +enum class BrowserFindCaseSensitivity: uint32_t; +enum class BrowserFindDirection: uint32_t; +} // namespace dom + +class ErrorResult; + +/** + * A helper class for browser-element frames + */ +class nsBrowserElement +{ +public: + nsBrowserElement() {} + virtual ~nsBrowserElement() {} + + void SetVisible(bool aVisible, ErrorResult& aRv); + already_AddRefed GetVisible(ErrorResult& aRv); + void SetActive(bool aActive, ErrorResult& aRv); + bool GetActive(ErrorResult& aRv); + + void SendMouseEvent(const nsAString& aType, + uint32_t aX, + uint32_t aY, + uint32_t aButton, + uint32_t aClickCount, + uint32_t aModifiers, + ErrorResult& aRv); + void SendTouchEvent(const nsAString& aType, + const dom::Sequence& aIdentifiers, + const dom::Sequence& aX, + const dom::Sequence& aY, + const dom::Sequence& aRx, + const dom::Sequence& aRy, + const dom::Sequence& aRotationAngles, + const dom::Sequence& aForces, + uint32_t aCount, + uint32_t aModifiers, + ErrorResult& aRv); + void GoBack(ErrorResult& aRv); + void GoForward(ErrorResult& aRv); + void Reload(bool aHardReload, ErrorResult& aRv); + void Stop(ErrorResult& aRv); + + already_AddRefed + Download(const nsAString& aUrl, + const dom::BrowserElementDownloadOptions& options, + ErrorResult& aRv); + + already_AddRefed PurgeHistory(ErrorResult& aRv); + + void GetAllowedAudioChannels( + nsTArray>& aAudioChannels, + ErrorResult& aRv); + + void Mute(ErrorResult& aRv); + void Unmute(ErrorResult& aRv); + already_AddRefed GetMuted(ErrorResult& aRv); + + void SetVolume(float aVolume , ErrorResult& aRv); + already_AddRefed GetVolume(ErrorResult& aRv); + + already_AddRefed + GetScreenshot(uint32_t aWidth, + uint32_t aHeight, + const nsAString& aMimeType, + ErrorResult& aRv); + + void Zoom(float aZoom, ErrorResult& aRv); + + already_AddRefed GetCanGoBack(ErrorResult& aRv); + already_AddRefed GetCanGoForward(ErrorResult& aRv); + already_AddRefed GetContentDimensions(ErrorResult& aRv); + + void FindAll(const nsAString& aSearchString, dom::BrowserFindCaseSensitivity aCaseSensitivity, + ErrorResult& aRv); + void FindNext(dom::BrowserFindDirection aDirection, ErrorResult& aRv); + void ClearMatch(ErrorResult& aRv); + + void AddNextPaintListener(dom::BrowserElementNextPaintEventCallback& listener, + ErrorResult& aRv); + void RemoveNextPaintListener(dom::BrowserElementNextPaintEventCallback& listener, + ErrorResult& aRv); + + already_AddRefed SetInputMethodActive(bool isActive, + ErrorResult& aRv); + + already_AddRefed ExecuteScript(const nsAString& aScript, + const dom::BrowserElementExecuteScriptOptions& aOptions, + ErrorResult& aRv); + + already_AddRefed GetWebManifest(ErrorResult& aRv); + + // Helper + static void GenerateAllowedAudioChannels( + nsPIDOMWindowInner* aWindow, + nsIFrameLoader* aFrameLoader, + nsIBrowserElementAPI* aAPI, + nsTArray>& aAudioChannels, + ErrorResult& aRv); + +protected: + NS_IMETHOD_(already_AddRefed) GetFrameLoader() = 0; + NS_IMETHOD GetParentApplication(mozIApplication** aApplication) = 0; + + void InitBrowserElementAPI(); + void DestroyBrowserElementFrameScripts(); + nsCOMPtr mBrowserElementAPI; + nsTArray> mBrowserElementAudioChannels; + +private: + bool IsBrowserElementOrThrow(ErrorResult& aRv); +}; + +} // namespace mozilla + +#endif // nsBrowserElement_h -- cgit v1.2.3