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

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

Issue 940503002: [PresentationAPI] Added plumbing for start/joinSession from JS to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comment Created 5 years, 10 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/presentation/PresentationSession.h" 6 #include "modules/presentation/PresentationSession.h"
7 7
8 #include "core/dom/Document.h"
9 #include "core/frame/LocalFrame.h"
8 #include "modules/EventTargetModules.h" 10 #include "modules/EventTargetModules.h"
11 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
9 12
10 namespace blink { 13 namespace blink {
11 14
12 PresentationSession::PresentationSession(ExecutionContext* executionContext) 15 PresentationSession::PresentationSession(LocalFrame* frame, WebPresentationSessi onClient* client)
13 : ContextLifecycleObserver(executionContext) 16 : DOMWindowProperty(frame)
17 , m_id(client->getId())
mlamouri (slow - plz ping) 2015/02/25 20:51:06 So if you only need the id, maybe you could only p
whywhat 2015/02/25 21:04:14 The client needs to outlive the callback since it
mlamouri (slow - plz ping) 2015/02/25 21:08:54 Understood. That's why you should pass the id only
whywhat 2015/02/25 22:46:52 Ok, I'll pass the presentation id and will use it
18 , m_state("disconnected")
14 { 19 {
15 } 20 }
16 21
17 PresentationSession::~PresentationSession() 22 PresentationSession::~PresentationSession()
18 { 23 {
19 } 24 }
20 25
21 // static 26 // static
22 PresentationSession* PresentationSession::create(ExecutionContext* executionCont ext) 27 PresentationSession* PresentationSession::create(LocalFrame* frame, WebPresentat ionSessionClient* client)
23 { 28 {
24 return new PresentationSession(executionContext); 29 return new PresentationSession(frame, client);
25 } 30 }
26 31
27 const AtomicString& PresentationSession::interfaceName() const 32 const AtomicString& PresentationSession::interfaceName() const
28 { 33 {
29 return EventTargetNames::PresentationSession; 34 return EventTargetNames::PresentationSession;
30 } 35 }
31 36
32 ExecutionContext* PresentationSession::executionContext() const 37 ExecutionContext* PresentationSession::executionContext() const
33 { 38 {
34 return ContextLifecycleObserver::executionContext(); 39 if (!frame())
35 } 40 return nullptr;
41 return frame()->document();}
36 42
37 DEFINE_TRACE(PresentationSession) 43 DEFINE_TRACE(PresentationSession)
38 { 44 {
39 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr ace(visitor); 45 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr ace(visitor);
40 ContextLifecycleObserver::trace(visitor); 46 DOMWindowProperty::trace(visitor);
41 } 47 }
42 48
43 void PresentationSession::postMessage(const String& message) 49 void PresentationSession::postMessage(const String& message)
44 { 50 {
45 } 51 }
46 52
47 void PresentationSession::close() 53 void PresentationSession::close()
48 { 54 {
49 } 55 }
50 56
51 } // namespace blink 57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698