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

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: Full change 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 "modules/presentation/Presentation.h"
12 #include "public/platform/WebString.h"
13 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
14 #include "wtf/OwnPtr.h"
9 15
10 namespace blink { 16 namespace blink {
11 17
12 PresentationSession::PresentationSession(ExecutionContext* executionContext) 18 PresentationSession::PresentationSession(LocalFrame* frame, const WebString& id)
13 : ContextLifecycleObserver(executionContext) 19 : DOMWindowProperty(frame)
20 , m_id(id)
21 , m_state("disconnected")
14 { 22 {
15 } 23 }
16 24
17 PresentationSession::~PresentationSession() 25 PresentationSession::~PresentationSession()
18 { 26 {
19 } 27 }
20 28
21 // static 29 // static
22 PresentationSession* PresentationSession::create(ExecutionContext* executionCont ext) 30 PresentationSession* PresentationSession::take(WebPresentationSessionClient* cli entRaw, Presentation* presentation)
23 { 31 {
24 return new PresentationSession(executionContext); 32 ASSERT(clientRaw);
33 ASSERT(presentation);
34 OwnPtr<WebPresentationSessionClient> client = adoptPtr(clientRaw);
35
36 PresentationSession* session = new PresentationSession(presentation->frame() , client->getId());
37 presentation->registerSession(session);
38 return session;
39 }
40
41 // static
42 void PresentationSession::dispose(WebPresentationSessionClient* client)
43 {
44 delete client;
25 } 45 }
26 46
27 const AtomicString& PresentationSession::interfaceName() const 47 const AtomicString& PresentationSession::interfaceName() const
28 { 48 {
29 return EventTargetNames::PresentationSession; 49 return EventTargetNames::PresentationSession;
30 } 50 }
31 51
32 ExecutionContext* PresentationSession::executionContext() const 52 ExecutionContext* PresentationSession::executionContext() const
33 { 53 {
34 return ContextLifecycleObserver::executionContext(); 54 if (!frame())
35 } 55 return nullptr;
56 return frame()->document();}
36 57
37 DEFINE_TRACE(PresentationSession) 58 DEFINE_TRACE(PresentationSession)
38 { 59 {
39 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr ace(visitor); 60 RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::tr ace(visitor);
40 ContextLifecycleObserver::trace(visitor); 61 DOMWindowProperty::trace(visitor);
41 } 62 }
42 63
43 void PresentationSession::postMessage(const String& message) 64 void PresentationSession::postMessage(const String& message)
44 { 65 {
45 } 66 }
46 67
47 void PresentationSession::close() 68 void PresentationSession::close()
48 { 69 {
49 } 70 }
50 71
51 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationSession.h ('k') | Source/modules/presentation/PresentationSessionClientCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698