Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/clients/api/Client.h
Line
Count
Source (jump to first uncovered line)
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
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
#ifndef _mozilla_dom_Client_h
7
#define _mozilla_dom_Client_h
8
9
#include "mozilla/dom/ClientBinding.h"
10
#include "nsCOMPtr.h"
11
#include "nsContentUtils.h"
12
#include "nsISupports.h"
13
#include "nsWrapperCache.h"
14
15
class nsIGlobalObject;
16
17
namespace mozilla {
18
19
class ErrorResult;
20
21
namespace dom {
22
23
class ClientHandle;
24
class ClientInfoAndState;
25
class Promise;
26
27
template <typename t> class Sequence;
28
29
class Client final : public nsISupports
30
                   , public nsWrapperCache
31
{
32
  nsCOMPtr<nsIGlobalObject> mGlobal;
33
  UniquePtr<ClientInfoAndState> mData;
34
  RefPtr<ClientHandle> mHandle;
35
36
0
  ~Client() = default;
37
38
  void
39
  EnsureHandle();
40
41
public:
42
  Client(nsIGlobalObject* aGlobal, const ClientInfoAndState& aData);
43
44
  TimeStamp
45
  CreationTime() const;
46
47
  TimeStamp
48
  LastFocusTime() const;
49
50
  nsContentUtils::StorageAccess
51
  GetStorageAccess() const;
52
53
  // nsWrapperCache interface methods
54
  JSObject*
55
  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
56
57
  // DOM bindings methods
58
  nsIGlobalObject*
59
  GetParentObject() const;
60
61
  // Client Bindings
62
  void
63
  GetUrl(nsAString& aUrlOut) const;
64
65
  void
66
  GetId(nsAString& aIdOut) const;
67
68
  ClientType
69
  Type() const;
70
71
  FrameType
72
  GetFrameType() const;
73
74
  // WindowClient bindings
75
  VisibilityState
76
  GetVisibilityState() const;
77
78
  bool
79
  Focused() const;
80
81
  already_AddRefed<Promise>
82
  Focus(ErrorResult& aRv);
83
84
  already_AddRefed<Promise>
85
  Navigate(const nsAString& aURL, ErrorResult& aRv);
86
87
  void
88
  PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
89
              const Sequence<JSObject*>& aTransferrable,
90
              ErrorResult& aRv);
91
92
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
93
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(mozilla::dom::Client)
94
};
95
96
} // namespace dom
97
} // namespace mozilla
98
99
#endif // _mozilla_dom_Client_h