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

Side by Side Diff: Source/modules/presentation/Presentation.cpp

Issue 1212423003: Presentation API: Blink changes to allow getAvailability() to be rejected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@presentation-availability-cleanups
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | Source/modules/presentation/PresentationAvailabilityCallback.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/Presentation.h" 6 #include "modules/presentation/Presentation.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 { 115 {
116 dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessio nstart, session)); 116 dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessio nstart, session));
117 } 117 }
118 118
119 void Presentation::didChangeSessionState(WebPresentationSessionClient* sessionCl ient, WebPresentationSessionState sessionState) 119 void Presentation::didChangeSessionState(WebPresentationSessionClient* sessionCl ient, WebPresentationSessionState sessionState)
120 { 120 {
121 PresentationSession* session = findSession(sessionClient); 121 PresentationSession* session = findSession(sessionClient);
122 if (session) 122 if (session)
123 session->didChangeState(sessionState); 123 session->didChangeState(sessionState);
124 124
125 PresentationSession::dispose(sessionClient); 125 delete sessionClient;
126 } 126 }
127 127
128 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se ssionClient, const String& message) 128 void Presentation::didReceiveSessionTextMessage(WebPresentationSessionClient* se ssionClient, const String& message)
129 { 129 {
130 PresentationSession* session = findSession(sessionClient); 130 PresentationSession* session = findSession(sessionClient);
131 if (session) 131 if (session)
132 session->didReceiveTextMessage(message); 132 session->didReceiveTextMessage(message);
133 133
134 PresentationSession::dispose(sessionClient); 134 delete sessionClient;
135 } 135 }
136 136
137 void Presentation::registerSession(PresentationSession* session) 137 void Presentation::registerSession(PresentationSession* session)
138 { 138 {
139 m_openSessions.add(session); 139 m_openSessions.add(session);
140 } 140 }
141 141
142 PresentationController* Presentation::presentationController() 142 PresentationController* Presentation::presentationController()
143 { 143 {
144 if (!frame()) 144 if (!frame())
145 return nullptr; 145 return nullptr;
146 return PresentationController::from(*frame()); 146 return PresentationController::from(*frame());
147 } 147 }
148 148
149 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses sionClient) 149 PresentationSession* Presentation::findSession(WebPresentationSessionClient* ses sionClient)
150 { 150 {
151 for (const auto& session : m_openSessions) { 151 for (const auto& session : m_openSessions) {
152 if (session->matches(sessionClient)) 152 if (session->matches(sessionClient))
153 return session.get(); 153 return session.get();
154 } 154 }
155 return nullptr; 155 return nullptr;
156 } 156 }
157 157
158 } // namespace blink 158 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/presentation/PresentationAvailabilityCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698