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

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

Issue 832263007: Added plumbing for the availablechange event from Blink to WebPresentationClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/presentation/PresentationController.h"
7
8 #include "core/frame/LocalFrame.h"
9 #include "public/platform/WebPresentationClient.h"
10 #include "public/platform/WebPresentationController.h"
11
12 namespace blink {
13
14 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio nClient* client)
15 : m_client(client)
16 {
17 if (m_client)
18 m_client->setController(this);
19 }
20
21 PresentationController::~PresentationController()
22 {
23 if (m_client)
24 m_client->setController(nullptr);
25 }
26
27 // static
28 PassOwnPtrWillBeRawPtr<PresentationController> PresentationController::create(Lo calFrame& frame, WebPresentationClient* client)
29 {
30 return adoptPtrWillBeNoop(new PresentationController(frame, client));
31 }
32
33 // static
34 const char* PresentationController::supplementName()
35 {
36 return "PresentationController";
37 }
38
39 // static
40 PresentationController* PresentationController::from(LocalFrame& frame)
41 {
42 return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame> ::from(frame, supplementName()));
43 }
44
45 // static
46 void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient* client)
47 {
48 WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::s upplementName(), PresentationController::create(frame, client));
49 }
50
51 void PresentationController::trace(Visitor* visitor)
52 {
53 visitor->trace(m_presentation);
54 WillBeHeapSupplement<LocalFrame>::trace(visitor);
55 }
56
57 void PresentationController::deviceAvailabilityChanged(bool available)
58 {
59 if (m_presentation)
Peter Beverloo 2015/01/07 14:29:09 Should we get this event if there is no m_presenta
whywhat 2015/01/07 16:22:16 Done.
60 m_presentation->deviceAvailabilityChanged(available);
61 }
62
63 void PresentationController::addDeviceAvailabilityListener()
64 {
65 if (m_client)
66 m_client->addDeviceAvailabilityListener();
Peter Beverloo 2015/01/07 14:29:09 Hm, so the embedder is responsible for doing some
whywhat 2015/01/07 16:22:16 In general, the embedder should care if there's an
Peter Beverloo 2015/01/07 19:53:11 In order to keep information local, we should only
whywhat 2015/01/08 16:05:28 Done.
67 }
68
69 void PresentationController::removeDeviceAvailabilityListener()
70 {
71 if (m_client)
72 m_client->removeDeviceAvailabilityListener();
73 }
74
75 void PresentationController::setPresentation(Presentation* presentation)
Peter Beverloo 2015/01/07 14:29:09 Can we limit the scope of what PresentationControl
whywhat 2015/01/07 16:22:16 Not sure I want to introduce another interface and
Peter Beverloo 2015/01/07 19:53:11 Oh right, that's OK. Just make sure the names of t
whywhat 2015/01/08 16:05:28 I assume that most of the time the code won't comp
76 {
77 m_presentation = presentation;
78 }
79
80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698