Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| OLD | NEW |