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/Presentation.h" | 6 #include "modules/presentation/Presentation.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
| 12 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
| 13 #include "core/dom/ExceptionCode.h" | 13 #include "core/dom/ExceptionCode.h" |
| 14 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
| 15 #include "modules/EventTargetModules.h" | 15 #include "modules/EventTargetModules.h" |
| 16 #include "modules/presentation/AvailableChangeEvent.h" | 16 #include "modules/presentation/AvailableChangeEvent.h" |
| 17 #include "modules/presentation/DefaultSessionStartEvent.h" | 17 #include "modules/presentation/DefaultSessionStartEvent.h" |
| 18 #include "modules/presentation/PresentationController.h" | 18 #include "modules/presentation/PresentationController.h" |
| 19 #include "modules/presentation/PresentationSessionClientCallbacks.h" | 19 #include "modules/presentation/PresentationSessionClientCallbacks.h" |
| 20 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" | |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 | 23 |
| 23 Presentation::Presentation(LocalFrame* frame) | 24 Presentation::Presentation(LocalFrame* frame) |
| 24 : DOMWindowProperty(frame) | 25 : DOMWindowProperty(frame) |
| 25 { | 26 { |
| 26 } | 27 } |
| 27 | 28 |
| 28 Presentation::~Presentation() | 29 Presentation::~Presentation() |
| 29 { | 30 { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 void Presentation::didStartDefaultSession(PresentationSession* session) | 150 void Presentation::didStartDefaultSession(PresentationSession* session) |
| 150 { | 151 { |
| 151 dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessio nstart, session)); | 152 dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessio nstart, session)); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void Presentation::registerSession(PresentationSession* session) | 155 void Presentation::registerSession(PresentationSession* session) |
| 155 { | 156 { |
| 156 m_openSessions.add(session); | 157 m_openSessions.add(session); |
| 157 } | 158 } |
| 158 | 159 |
| 160 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses sionClient) | |
| 161 { | |
| 162 for (auto it = m_openSessions.begin(); it != m_openSessions.end(); ++it) { | |
|
Peter Beverloo
2015/03/20 19:07:40
for (const auto& session : m_openSessions)
whywhat
2015/03/23 21:12:16
Done. I can't use a const iterator since I need to
| |
| 163 if ((*it)->matches(sessionClient)) | |
| 164 return it->get(); | |
| 165 } | |
| 166 return nullptr; | |
| 167 } | |
| 168 | |
| 159 PresentationController* Presentation::presentationController() | 169 PresentationController* Presentation::presentationController() |
| 160 { | 170 { |
| 161 if (!frame()) | 171 if (!frame()) |
| 162 return nullptr; | 172 return nullptr; |
| 163 return PresentationController::from(*frame()); | 173 return PresentationController::from(*frame()); |
| 164 } | 174 } |
| 165 | 175 |
| 166 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |