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

Side by Side Diff: Source/modules/presentation/PresentationController.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
OLDNEW
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 "modules/presentation/PresentationSession.h"
10 #include "public/platform/modules/presentation/WebPresentationClient.h" 10 #include "public/platform/modules/presentation/WebPresentationClient.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DEFINE_TRACE(PresentationController) 57 DEFINE_TRACE(PresentationController)
58 { 58 {
59 visitor->trace(m_presentation); 59 visitor->trace(m_presentation);
60 WillBeHeapSupplement<LocalFrame>::trace(visitor); 60 WillBeHeapSupplement<LocalFrame>::trace(visitor);
61 LocalFrameLifecycleObserver::trace(visitor); 61 LocalFrameLifecycleObserver::trace(visitor);
62 } 62 }
63 63
64 void PresentationController::didStartDefaultSession(WebPresentationSessionClient * sessionClient) 64 void PresentationController::didStartDefaultSession(WebPresentationSessionClient * sessionClient)
65 { 65 {
66 if (!m_presentation) { 66 if (!m_presentation) {
67 PresentationSession::dispose(sessionClient); 67 delete sessionClient;
68 return; 68 return;
69 } 69 }
70 70
71 PresentationSession* session = PresentationSession::take(sessionClient, m_pr esentation); 71 PresentationSession* session = PresentationSession::take(sessionClient, m_pr esentation);
72 m_presentation->didStartDefaultSession(session); 72 m_presentation->didStartDefaultSession(session);
73 } 73 }
74 74
75 void PresentationController::didChangeSessionState(WebPresentationSessionClient* sessionClient, WebPresentationSessionState state) 75 void PresentationController::didChangeSessionState(WebPresentationSessionClient* sessionClient, WebPresentationSessionState state)
76 { 76 {
77 if (m_presentation) 77 if (!m_presentation) {
78 m_presentation->didChangeSessionState(sessionClient, state); 78 delete sessionClient;
79 else 79 return;
80 PresentationSession::dispose(sessionClient); 80 }
81
82 m_presentation->didChangeSessionState(sessionClient, state);
81 } 83 }
82 84
83 void PresentationController::didReceiveSessionTextMessage(WebPresentationSession Client* sessionClient, const WebString& message) 85 void PresentationController::didReceiveSessionTextMessage(WebPresentationSession Client* sessionClient, const WebString& message)
84 { 86 {
85 if (m_presentation) 87 if (!m_presentation) {
86 m_presentation->didReceiveSessionTextMessage(sessionClient, message); 88 delete sessionClient;
87 else 89 return;
88 PresentationSession::dispose(sessionClient); 90 }
91
92 m_presentation->didReceiveSessionTextMessage(sessionClient, message);
89 } 93 }
90 94
91 void PresentationController::startSession(const String& presentationUrl, const S tring& presentationId, WebPresentationSessionClientCallbacks* callbacks) 95 void PresentationController::startSession(const String& presentationUrl, const S tring& presentationId, WebPresentationSessionClientCallbacks* callbacks)
92 { 96 {
93 if (!m_client) { 97 if (!m_client) {
94 delete callbacks; 98 delete callbacks;
95 return; 99 return;
96 } 100 }
97 m_client->startSession(presentationUrl, presentationId, callbacks); 101 m_client->startSession(presentationUrl, presentationId, callbacks);
98 } 102 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 152
149 void PresentationController::willDetachFrameHost() 153 void PresentationController::willDetachFrameHost()
150 { 154 {
151 if (m_client) { 155 if (m_client) {
152 m_client->setController(nullptr); 156 m_client->setController(nullptr);
153 m_client = nullptr; 157 m_client = nullptr;
154 } 158 }
155 } 159 }
156 160
157 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationAvailabilityCallback.cpp ('k') | Source/modules/presentation/PresentationError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698