Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: Source/modules/presentation/NavigatorPresentation.cpp

Issue 408663002: Add the Presentation API module and a single event target (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed my fix for the layout tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/presentation/NavigatorPresentation.h"
7
8 #include "core/dom/Document.h"
9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Navigator.h"
11 #include "modules/presentation/Presentation.h"
12 #include "platform/heap/Handle.h"
13
14 namespace blink {
15
16 NavigatorPresentation::NavigatorPresentation(LocalFrame* frame)
17 : DOMWindowProperty(frame)
18 {
19 }
20
21 NavigatorPresentation::~NavigatorPresentation()
22 {
23 }
24
25 // static
26 const char* NavigatorPresentation::supplementName()
27 {
28 return "NavigatorPresentation";
29 }
30
31 // static
32 NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator)
33 {
34 NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(Will BeHeapSupplement<Navigator>::from(navigator, supplementName()));
35 if (!supplement) {
36 supplement = new NavigatorPresentation(navigator.frame());
37 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
38 }
39 return *supplement;
40 }
41
42 // static
43 Presentation* NavigatorPresentation::presentation(Navigator& navigator)
44 {
45 return NavigatorPresentation::from(navigator).presentation();
46 }
47
48 Presentation* NavigatorPresentation::presentation()
49 {
50 if (!m_presentation) {
51 if (!frame())
52 return 0;
53 m_presentation = Presentation::create(frame()->document());
54 }
55 return m_presentation.get();
56 }
57
58 void NavigatorPresentation::trace(Visitor* visitor)
59 {
60 visitor->trace(m_presentation);
61 WillBeHeapSupplement<Navigator>::trace(visitor);
62 DOMWindowProperty::trace(visitor);
63 }
64
65 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/presentation/NavigatorPresentation.h ('k') | Source/modules/presentation/NavigatorPresentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698