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"
|
|
|
|
|
|
|
|
#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 {
|
2018-11-02 00:37:48 +03:00
|
|
|
class Promise;
|
2014-11-21 13:56:27 +03:00
|
|
|
} // namespace dom
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A helper class for browser-element frames
|
|
|
|
*/
|
|
|
|
class nsBrowserElement {
|
|
|
|
public:
|
2016-10-15 03:38:21 +03:00
|
|
|
nsBrowserElement() {}
|
2015-02-09 10:04:18 +03:00
|
|
|
virtual ~nsBrowserElement() {}
|
2014-11-21 13:56:27 +03:00
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
void SendMouseEvent(const nsAString& aType, uint32_t aX, uint32_t aY,
|
|
|
|
uint32_t aButton, uint32_t aClickCount,
|
|
|
|
uint32_t aModifiers, ErrorResult& aRv);
|
|
|
|
void GoBack(ErrorResult& aRv);
|
|
|
|
void GoForward(ErrorResult& aRv);
|
|
|
|
void Reload(bool aHardReload, ErrorResult& aRv);
|
|
|
|
void Stop(ErrorResult& aRv);
|
|
|
|
|
2018-11-02 00:37:48 +03:00
|
|
|
already_AddRefed<dom::Promise> GetCanGoBack(ErrorResult& aRv);
|
|
|
|
already_AddRefed<dom::Promise> GetCanGoForward(ErrorResult& aRv);
|
2014-11-21 13:56:27 +03:00
|
|
|
|
2014-11-21 13:56:27 +03:00
|
|
|
protected:
|
2019-02-16 01:20:53 +03:00
|
|
|
virtual already_AddRefed<nsFrameLoader> GetFrameLoader() = 0;
|
2015-12-11 19:17:33 +03:00
|
|
|
|
2015-02-09 10:04:18 +03:00
|
|
|
void InitBrowserElementAPI();
|
2016-09-09 00:00:12 +03:00
|
|
|
void DestroyBrowserElementFrameScripts();
|
2014-11-21 13:56:27 +03:00
|
|
|
nsCOMPtr<nsIBrowserElementAPI> mBrowserElementAPI;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsBrowserElementOrThrow(ErrorResult& aRv);
|
2014-11-21 13:56:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // nsBrowserElement_h
|