2014-11-21 13:56:27 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-11-21 13:56:27 +03:00
|
|
|
/* 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"
|
2015-07-10 19:38:44 +03:00
|
|
|
#include "mozilla/dom/BrowserElementAudioChannel.h"
|
2014-11-21 13:56:27 +03:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2014-11-21 13:56:27 +03:00
|
|
|
#include "nsIBrowserElementAPI.h"
|
|
|
|
|
|
|
|
class nsFrameLoader;
|
2014-11-21 13:56:27 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
struct BrowserElementDownloadOptions;
|
2015-07-16 10:56:00 +03:00
|
|
|
struct BrowserElementExecuteScriptOptions;
|
2014-11-21 13:56:27 +03:00
|
|
|
class BrowserElementNextPaintEventCallback;
|
|
|
|
class DOMRequest;
|
2015-06-10 03:04:00 +03:00
|
|
|
enum class BrowserFindCaseSensitivity: uint32_t;
|
|
|
|
enum class BrowserFindDirection: uint32_t;
|
2014-11-21 13:56:27 +03:00
|
|
|
} // namespace dom
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper class for browser-element frames
|
|
|
|
*/
|
|
|
|
class nsBrowserElement
|
|
|
|
{
|
|
|
|
public:
|
2015-02-09 10:04:18 +03:00
|
|
|
nsBrowserElement() : mOwnerIsWidget(false) {}
|
|
|
|
virtual ~nsBrowserElement() {}
|
2014-11-21 13:56:27 +03:00
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
void SetVisible(bool aVisible, ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::DOMRequest> 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<uint32_t>& aIdentifiers,
|
|
|
|
const dom::Sequence<int32_t>& aX,
|
|
|
|
const dom::Sequence<int32_t>& aY,
|
|
|
|
const dom::Sequence<uint32_t>& aRx,
|
|
|
|
const dom::Sequence<uint32_t>& aRy,
|
|
|
|
const dom::Sequence<float>& aRotationAngles,
|
|
|
|
const dom::Sequence<float>& 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<dom::DOMRequest>
|
|
|
|
Download(const nsAString& aUrl,
|
|
|
|
const dom::BrowserElementDownloadOptions& options,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<dom::DOMRequest> PurgeHistory(ErrorResult& aRv);
|
|
|
|
|
2015-07-10 19:38:44 +03:00
|
|
|
void GetAllowedAudioChannels(
|
|
|
|
nsTArray<nsRefPtr<dom::BrowserElementAudioChannel>>& aAudioChannels,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2015-07-31 20:21:18 +03:00
|
|
|
void Mute(ErrorResult& aRv);
|
|
|
|
void Unmute(ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::DOMRequest> GetMuted(ErrorResult& aRv);
|
|
|
|
|
|
|
|
void SetVolume(float aVolume , ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::DOMRequest> GetVolume(ErrorResult& aRv);
|
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
already_AddRefed<dom::DOMRequest>
|
|
|
|
GetScreenshot(uint32_t aWidth,
|
|
|
|
uint32_t aHeight,
|
2014-11-21 13:56:27 +03:00
|
|
|
const nsAString& aMimeType,
|
2014-11-21 13:56:27 +03:00
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
void Zoom(float aZoom, ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<dom::DOMRequest> GetCanGoBack(ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::DOMRequest> GetCanGoForward(ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::DOMRequest> GetContentDimensions(ErrorResult& aRv);
|
|
|
|
|
2015-06-10 03:04:00 +03:00
|
|
|
void FindAll(const nsAString& aSearchString, dom::BrowserFindCaseSensitivity aCaseSensitivity,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
void FindNext(dom::BrowserFindDirection aDirection, ErrorResult& aRv);
|
|
|
|
void ClearMatch(ErrorResult& aRv);
|
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
void AddNextPaintListener(dom::BrowserElementNextPaintEventCallback& listener,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
void RemoveNextPaintListener(dom::BrowserElementNextPaintEventCallback& listener,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<dom::DOMRequest> SetInputMethodActive(bool isActive,
|
|
|
|
ErrorResult& aRv);
|
2014-11-21 13:56:27 +03:00
|
|
|
|
2015-07-16 10:56:00 +03:00
|
|
|
already_AddRefed<dom::DOMRequest> ExecuteScript(const nsAString& aScript,
|
|
|
|
const dom::BrowserElementExecuteScriptOptions& aOptions,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2015-09-23 09:02:10 +03:00
|
|
|
already_AddRefed<dom::DOMRequest> GetStructuredData(ErrorResult& aRv);
|
|
|
|
|
2015-01-22 12:40:17 +03:00
|
|
|
void SetNFCFocus(bool isFocus,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
protected:
|
|
|
|
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
|
2015-02-09 10:04:18 +03:00
|
|
|
void InitBrowserElementAPI();
|
2014-11-21 13:56:27 +03:00
|
|
|
nsCOMPtr<nsIBrowserElementAPI> mBrowserElementAPI;
|
2015-07-10 19:38:44 +03:00
|
|
|
nsTArray<nsRefPtr<dom::BrowserElementAudioChannel>> mBrowserElementAudioChannels;
|
2014-11-21 13:56:27 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsBrowserElementOrThrow(ErrorResult& aRv);
|
2014-11-21 13:56:28 +03:00
|
|
|
bool IsNotWidgetOrThrow(ErrorResult& aRv);
|
|
|
|
bool mOwnerIsWidget;
|
2014-11-21 13:56:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // nsBrowserElement_h
|