blob: fe56741665451f874f5407c851d17daddd21503c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/presentation/navigator_presentation.h"
#include "third_party/blink/renderer/core/frame/navigator.h"
#include "third_party/blink/renderer/modules/presentation/presentation.h"
namespace blink {
NavigatorPresentation::NavigatorPresentation() = default;
// static
const char NavigatorPresentation::kSupplementName[] = "NavigatorPresentation";
// static
NavigatorPresentation& NavigatorPresentation::From(Navigator& navigator) {
NavigatorPresentation* supplement =
Supplement<Navigator>::From<NavigatorPresentation>(navigator);
if (!supplement) {
supplement = MakeGarbageCollected<NavigatorPresentation>();
ProvideTo(navigator, supplement);
}
return *supplement;
}
// static
Presentation* NavigatorPresentation::presentation(Navigator& navigator) {
NavigatorPresentation& self = NavigatorPresentation::From(navigator);
if (!self.presentation_) {
if (!navigator.DomWindow())
return nullptr;
self.presentation_ = Presentation::Create(navigator.DomWindow());
}
return self.presentation_;
}
void NavigatorPresentation::Trace(Visitor* visitor) const {
visitor->Trace(presentation_);
Supplement<Navigator>::Trace(visitor);
}
} // namespace blink
|