2017-10-27 01:08:41 +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-09-14 05:39:57 +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_PresentationRequest_h
|
|
|
|
#define mozilla_dom_PresentationRequest_h
|
|
|
|
|
2016-09-05 02:17:00 +03:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2015-09-14 05:39:57 +03:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
|
|
|
|
2016-08-11 00:01:00 +03:00
|
|
|
class nsIDocument;
|
|
|
|
|
2015-09-14 05:39:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Promise;
|
|
|
|
class PresentationAvailability;
|
2015-10-12 05:36:31 +03:00
|
|
|
class PresentationConnection;
|
2015-09-14 05:39:57 +03:00
|
|
|
|
|
|
|
class PresentationRequest final : public DOMEventTargetHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2016-09-05 02:17:00 +03:00
|
|
|
static already_AddRefed<PresentationRequest> Constructor(
|
|
|
|
const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aUrl,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
static already_AddRefed<PresentationRequest> Constructor(
|
|
|
|
const GlobalObject& aGlobal,
|
|
|
|
const Sequence<nsString>& aUrls,
|
|
|
|
ErrorResult& aRv);
|
2015-09-14 05:39:57 +03:00
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
// WebIDL (public APIs)
|
|
|
|
already_AddRefed<Promise> Start(ErrorResult& aRv);
|
|
|
|
|
2016-01-13 14:21:25 +03:00
|
|
|
already_AddRefed<Promise> StartWithDevice(const nsAString& aDeviceId,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2016-08-02 20:11:00 +03:00
|
|
|
already_AddRefed<Promise> Reconnect(const nsAString& aPresentationId,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2015-09-14 05:39:57 +03:00
|
|
|
already_AddRefed<Promise> GetAvailability(ErrorResult& aRv);
|
|
|
|
|
2015-10-12 05:36:31 +03:00
|
|
|
IMPL_EVENT_HANDLER(connectionavailable);
|
2015-09-14 05:39:57 +03:00
|
|
|
|
2015-10-12 05:36:31 +03:00
|
|
|
nsresult DispatchConnectionAvailableEvent(PresentationConnection* aConnection);
|
2015-09-10 11:29:08 +03:00
|
|
|
|
2016-10-31 10:49:32 +03:00
|
|
|
void NotifyPromiseSettled();
|
|
|
|
|
2015-09-14 05:39:57 +03:00
|
|
|
private:
|
2016-01-30 20:05:36 +03:00
|
|
|
PresentationRequest(nsPIDOMWindowInner* aWindow,
|
2016-09-05 02:17:00 +03:00
|
|
|
nsTArray<nsString>&& aUrls);
|
2015-09-14 05:39:57 +03:00
|
|
|
|
|
|
|
~PresentationRequest();
|
|
|
|
|
|
|
|
bool Init();
|
|
|
|
|
2016-08-02 20:11:00 +03:00
|
|
|
void FindOrCreatePresentationConnection(const nsAString& aPresentationId,
|
|
|
|
Promise* aPromise);
|
|
|
|
|
2016-08-17 11:15:32 +03:00
|
|
|
void FindOrCreatePresentationAvailability(RefPtr<Promise>& aPromise);
|
|
|
|
|
2016-08-11 00:01:00 +03:00
|
|
|
// Implement https://w3c.github.io/webappsec-mixed-content/#categorize-settings-object
|
|
|
|
bool IsProhibitMixedSecurityContexts(nsIDocument* aDocument);
|
|
|
|
|
|
|
|
// Implement https://w3c.github.io/webappsec-mixed-content/#a-priori-authenticated-url
|
|
|
|
bool IsPrioriAuthenticatedURL(const nsAString& aUrl);
|
|
|
|
|
2016-09-05 02:17:00 +03:00
|
|
|
bool IsAllURLAuthenticated();
|
|
|
|
|
|
|
|
nsTArray<nsString> mUrls;
|
2015-09-14 05:39:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PresentationRequest_h
|