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

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

Issue 1222623003: Presentation API: implement .getAvalability() (Blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix tests 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 { 42 {
43 return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame> ::from(frame, supplementName())); 43 return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame> ::from(frame, supplementName()));
44 } 44 }
45 45
46 // static 46 // static
47 void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient* client) 47 void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient* client)
48 { 48 {
49 WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::s upplementName(), PresentationController::create(frame, client)); 49 WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::s upplementName(), PresentationController::create(frame, client));
50 } 50 }
51 51
52 WebPresentationClient* PresentationController::client()
53 {
54 return m_client;
55 }
56
52 DEFINE_TRACE(PresentationController) 57 DEFINE_TRACE(PresentationController)
53 { 58 {
54 visitor->trace(m_presentation); 59 visitor->trace(m_presentation);
55 WillBeHeapSupplement<LocalFrame>::trace(visitor); 60 WillBeHeapSupplement<LocalFrame>::trace(visitor);
56 LocalFrameLifecycleObserver::trace(visitor); 61 LocalFrameLifecycleObserver::trace(visitor);
57 } 62 }
58 63
59 void PresentationController::didChangeAvailability(bool available) 64 void PresentationController::didChangeAvailability(bool available)
60 { 65 {
61 if (m_presentation)
62 m_presentation->didChangeAvailability(available);
63 } 66 }
64 67
65 bool PresentationController::isAvailableChangeWatched() const 68 bool PresentationController::isAvailableChangeWatched() const
66 { 69 {
67 if (!m_presentation) 70 return false;
68 return false;
69 return m_presentation->isAvailableChangeWatched();
70 }
71
72 void PresentationController::updateAvailableChangeWatched(bool watched)
73 {
74 if (m_client)
75 m_client->updateAvailableChangeWatched(watched);
76 } 71 }
77 72
78 void PresentationController::didStartDefaultSession(WebPresentationSessionClient * sessionClient) 73 void PresentationController::didStartDefaultSession(WebPresentationSessionClient * sessionClient)
79 { 74 {
80 if (!m_presentation) { 75 if (!m_presentation) {
81 PresentationSession::dispose(sessionClient); 76 PresentationSession::dispose(sessionClient);
82 return; 77 return;
83 } 78 }
84 79
85 PresentationSession* session = PresentationSession::take(sessionClient, m_pr esentation); 80 PresentationSession* session = PresentationSession::take(sessionClient, m_pr esentation);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 m_client->sendBlobData(presentationUrl, presentationId, data, length); 136 m_client->sendBlobData(presentationUrl, presentationId, data, length);
142 } 137 }
143 138
144 void PresentationController::closeSession(const String& url, const String& prese ntationId) 139 void PresentationController::closeSession(const String& url, const String& prese ntationId)
145 { 140 {
146 if (!m_client) 141 if (!m_client)
147 return; 142 return;
148 m_client->closeSession(url, presentationId); 143 m_client->closeSession(url, presentationId);
149 } 144 }
150 145
146 void PresentationController::getAvailability(const String& presentationUrl, WebP resentationAvailabilityCallbacks* callbacks)
147 {
148 if (!m_client)
149 return;
150 m_client->getAvailability(presentationUrl, callbacks);
151 }
152
151 void PresentationController::setPresentation(Presentation* presentation) 153 void PresentationController::setPresentation(Presentation* presentation)
152 { 154 {
153 m_presentation = presentation; 155 m_presentation = presentation;
154 } 156 }
155 157
156 void PresentationController::willDetachFrameHost() 158 void PresentationController::willDetachFrameHost()
157 { 159 {
158 if (m_client) { 160 if (m_client) {
159 m_client->setController(nullptr); 161 m_client->setController(nullptr);
160 m_client = nullptr; 162 m_client = nullptr;
161 } 163 }
162 } 164 }
163 165
164 } // namespace blink 166 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698