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"
13 #include "nsIBrowserElementAPI.h"
26 * A helper class for browser-element frames
28 class nsBrowserElement
{
31 virtual ~nsBrowserElement() {}
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
);
45 virtual already_AddRefed
<nsFrameLoader
> GetFrameLoader() = 0;
47 void InitBrowserElementAPI();
48 void DestroyBrowserElementFrameScripts();
49 nsCOMPtr
<nsIBrowserElementAPI
> mBrowserElementAPI
;
52 bool IsBrowserElementOrThrow(ErrorResult
& aRv
);
55 } // namespace mozilla
57 #endif // nsBrowserElement_h