OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PresentationController.h" | 6 #include "modules/presentation/PresentationController.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "modules/presentation/PresentationSession.h" |
9 #include "public/platform/modules/presentation/WebPresentationClient.h" | 10 #include "public/platform/modules/presentation/WebPresentationClient.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio
nClient* client) | 14 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio
nClient* client) |
14 : FrameDestructionObserver(&frame) | 15 : FrameDestructionObserver(&frame) |
15 , m_client(client) | 16 , m_client(client) |
16 { | 17 { |
17 if (m_client) | 18 if (m_client) |
18 m_client->setController(this); | 19 m_client->setController(this); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return false; | 68 return false; |
68 return m_presentation->isAvailableChangeWatched(); | 69 return m_presentation->isAvailableChangeWatched(); |
69 } | 70 } |
70 | 71 |
71 void PresentationController::updateAvailableChangeWatched(bool watched) | 72 void PresentationController::updateAvailableChangeWatched(bool watched) |
72 { | 73 { |
73 if (m_client) | 74 if (m_client) |
74 m_client->updateAvailableChangeWatched(watched); | 75 m_client->updateAvailableChangeWatched(watched); |
75 } | 76 } |
76 | 77 |
| 78 void PresentationController::didStartDefaultPresentation(WebPresentationSessionC
lient* sessionClient) |
| 79 { |
| 80 if (!m_presentation) { |
| 81 PresentationSession::dispose(sessionClient); |
| 82 return; |
| 83 } |
| 84 |
| 85 PresentationSession* session = PresentationSession::take(sessionClient, m_pr
esentation); |
| 86 m_presentation->didStartDefaultPresentation(session); |
| 87 } |
| 88 |
| 89 bool PresentationController::isDefaultPresentationStartWatched() const |
| 90 { |
| 91 if (!m_presentation) |
| 92 return false; |
| 93 return m_presentation->isDefaultPresentationStartWatched(); |
| 94 } |
| 95 |
| 96 void PresentationController::updateDefaultPresentationStartWatched(bool watched) |
| 97 { |
| 98 if (m_client) |
| 99 m_client->updateDefaultPresentationStartWatched(watched); |
| 100 } |
| 101 |
77 void PresentationController::startSession(const String& presentationUrl, const S
tring& presentationId, WebPresentationSessionClientCallbacks* callbacks) | 102 void PresentationController::startSession(const String& presentationUrl, const S
tring& presentationId, WebPresentationSessionClientCallbacks* callbacks) |
78 { | 103 { |
79 if (!m_client) { | 104 if (!m_client) { |
80 delete callbacks; | 105 delete callbacks; |
81 return; | 106 return; |
82 } | 107 } |
83 m_client->startSession(presentationUrl, presentationId, callbacks); | 108 m_client->startSession(presentationUrl, presentationId, callbacks); |
84 } | 109 } |
85 | 110 |
86 void PresentationController::joinSession(const String& presentationUrl, const St
ring& presentationId, WebPresentationSessionClientCallbacks* callbacks) | 111 void PresentationController::joinSession(const String& presentationUrl, const St
ring& presentationId, WebPresentationSessionClientCallbacks* callbacks) |
(...skipping 12 matching lines...) Expand all Loading... |
99 | 124 |
100 void PresentationController::willDetachFrameHost() | 125 void PresentationController::willDetachFrameHost() |
101 { | 126 { |
102 if (m_client) { | 127 if (m_client) { |
103 m_client->setController(nullptr); | 128 m_client->setController(nullptr); |
104 m_client = nullptr; | 129 m_client = nullptr; |
105 } | 130 } |
106 } | 131 } |
107 | 132 |
108 } // namespace blink | 133 } // namespace blink |
OLD | NEW |