2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-03-06 16:04:49 +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 mozilla_dom_workers_serviceworkerwindowclient_h
|
|
|
|
#define mozilla_dom_workers_serviceworkerwindowclient_h
|
|
|
|
|
|
|
|
#include "ServiceWorkerClient.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2015-07-02 15:54:00 +03:00
|
|
|
|
|
|
|
class Promise;
|
|
|
|
|
2015-03-06 16:04:49 +03:00
|
|
|
namespace workers {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class ServiceWorkerWindowClient final : public ServiceWorkerClient
|
2015-03-06 16:04:49 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ServiceWorkerWindowClient(nsISupports* aOwner,
|
|
|
|
const ServiceWorkerClientInfo& aClientInfo)
|
|
|
|
: ServiceWorkerClient(aOwner, aClientInfo),
|
|
|
|
mVisibilityState(aClientInfo.mVisibilityState),
|
2015-10-25 06:17:02 +03:00
|
|
|
mFocused(aClientInfo.mFocused)
|
2015-03-06 16:04:49 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual JSObject*
|
2015-03-21 19:28:04 +03:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2015-03-06 16:04:49 +03:00
|
|
|
|
|
|
|
mozilla::dom::VisibilityState
|
|
|
|
VisibilityState() const
|
|
|
|
{
|
|
|
|
return mVisibilityState;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Focused() const
|
|
|
|
{
|
|
|
|
return mFocused;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
2015-04-07 16:25:08 +03:00
|
|
|
Focus(ErrorResult& aRv) const;
|
2015-03-06 16:04:49 +03:00
|
|
|
|
2016-05-24 10:05:17 +03:00
|
|
|
already_AddRefed<Promise>
|
|
|
|
Navigate(const nsAString& aUrl, ErrorResult& aRv);
|
|
|
|
|
2015-03-06 16:04:49 +03:00
|
|
|
private:
|
|
|
|
~ServiceWorkerWindowClient()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
mozilla::dom::VisibilityState mVisibilityState;
|
|
|
|
bool mFocused;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace workers
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_serviceworkerwindowclient_h
|