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::didStartDefaultSession(WebPresentationSessionClient
* 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->didStartDefaultSession(session); |
| 87 } |
| 88 |
77 void PresentationController::startSession(const String& presentationUrl, const S
tring& presentationId, WebPresentationSessionClientCallbacks* callbacks) | 89 void PresentationController::startSession(const String& presentationUrl, const S
tring& presentationId, WebPresentationSessionClientCallbacks* callbacks) |
78 { | 90 { |
79 if (!m_client) { | 91 if (!m_client) { |
80 delete callbacks; | 92 delete callbacks; |
81 return; | 93 return; |
82 } | 94 } |
83 m_client->startSession(presentationUrl, presentationId, callbacks); | 95 m_client->startSession(presentationUrl, presentationId, callbacks); |
84 } | 96 } |
85 | 97 |
86 void PresentationController::joinSession(const String& presentationUrl, const St
ring& presentationId, WebPresentationSessionClientCallbacks* callbacks) | 98 void PresentationController::joinSession(const String& presentationUrl, const St
ring& presentationId, WebPresentationSessionClientCallbacks* callbacks) |
(...skipping 12 matching lines...) Expand all Loading... |
99 | 111 |
100 void PresentationController::willDetachFrameHost() | 112 void PresentationController::willDetachFrameHost() |
101 { | 113 { |
102 if (m_client) { | 114 if (m_client) { |
103 m_client->setController(nullptr); | 115 m_client->setController(nullptr); |
104 m_client = nullptr; | 116 m_client = nullptr; |
105 } | 117 } |
106 } | 118 } |
107 | 119 |
108 } // namespace blink | 120 } // namespace blink |
OLD | NEW |