blob: 453b9350769dcbd16e16343f82a27c52637d1cd1 (
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
45
46
47
48
49
50
51
|
// 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 "modules/presentation/NavigatorPresentation.h"
#include "core/frame/Navigator.h"
#include "modules/presentation/Presentation.h"
namespace blink {
NavigatorPresentation::NavigatorPresentation()
{
}
// static
const char* NavigatorPresentation::supplementName()
{
return "NavigatorPresentation";
}
// static
NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator)
{
NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(HeapSupplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
supplement = new NavigatorPresentation();
provideTo(navigator, supplementName(), supplement);
}
return *supplement;
}
// static
Presentation* NavigatorPresentation::presentation(Navigator& navigator)
{
NavigatorPresentation& self = NavigatorPresentation::from(navigator);
if (!self.m_presentation) {
if (!navigator.frame())
return nullptr;
self.m_presentation = Presentation::create(navigator.frame());
}
return self.m_presentation;
}
DEFINE_TRACE(NavigatorPresentation)
{
visitor->trace(m_presentation);
HeapSupplement<Navigator>::trace(visitor);
}
} // namespace blink
|