Bug 1880558: Allow PnP windows to enter macOS native fullscreen. r=pip-reviewers...
[gecko.git] / dom / html / nsBrowserElement.h
blobc81529de3380cfd8c4109ffe0661b947516e6e97
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsBrowserElement_h
8 #define nsBrowserElement_h
10 #include "mozilla/dom/BindingDeclarations.h"
12 #include "nsCOMPtr.h"
13 #include "nsIBrowserElementAPI.h"
15 class nsFrameLoader;
17 namespace mozilla {
19 namespace dom {
20 class Promise;
21 } // namespace dom
23 class ErrorResult;
25 /**
26 * A helper class for browser-element frames
28 class nsBrowserElement {
29 public:
30 nsBrowserElement() = default;
31 virtual ~nsBrowserElement() = default;
33 void SendMouseEvent(const nsAString& aType, uint32_t aX, uint32_t aY,
34 uint32_t aButton, uint32_t aClickCount,
35 uint32_t aModifiers, ErrorResult& aRv);
36 void GoBack(ErrorResult& aRv);
37 void GoForward(ErrorResult& aRv);
38 void Reload(bool aHardReload, ErrorResult& aRv);
39 void Stop(ErrorResult& aRv);
41 already_AddRefed<dom::Promise> GetCanGoBack(ErrorResult& aRv);
42 already_AddRefed<dom::Promise> GetCanGoForward(ErrorResult& aRv);
44 protected:
45 virtual already_AddRefed<nsFrameLoader> GetFrameLoader() = 0;
47 void InitBrowserElementAPI();
48 void DestroyBrowserElementFrameScripts();
49 nsCOMPtr<nsIBrowserElementAPI> mBrowserElementAPI;
51 private:
52 bool IsBrowserElementOrThrow(ErrorResult& aRv);
55 } // namespace mozilla
57 #endif // nsBrowserElement_h