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

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

Issue 2569963003: Remove DOMWindowProperty from PresentationController (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/modules/presentation/PresentationController.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "modules/presentation/PresentationController.h" 5 #include "modules/presentation/PresentationController.h"
6 6
7 #include "core/dom/Document.h"
7 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
8 #include "modules/presentation/PresentationConnection.h" 9 #include "modules/presentation/PresentationConnection.h"
9 #include "public/platform/modules/presentation/WebPresentationClient.h" 10 #include "public/platform/modules/presentation/WebPresentationClient.h"
10 #include "wtf/PtrUtil.h" 11 #include "wtf/PtrUtil.h"
11 #include <memory> 12 #include <memory>
12 13
13 namespace blink { 14 namespace blink {
14 15
15 PresentationController::PresentationController(LocalFrame& frame, 16 PresentationController::PresentationController(LocalFrame& frame,
16 WebPresentationClient* client) 17 WebPresentationClient* client)
17 : DOMWindowProperty(&frame), m_client(client) { 18 : ContextLifecycleObserver(frame.document()), m_client(client) {
18 if (m_client) 19 if (m_client)
19 m_client->setController(this); 20 m_client->setController(this);
20 } 21 }
21 22
22 PresentationController::~PresentationController() { 23 PresentationController::~PresentationController() {
23 if (m_client) 24 if (m_client)
24 m_client->setController(nullptr); 25 m_client->setController(nullptr);
25 } 26 }
26 27
27 // static 28 // static
(...skipping 23 matching lines...) Expand all
51 } 52 }
52 53
53 WebPresentationClient* PresentationController::client() { 54 WebPresentationClient* PresentationController::client() {
54 return m_client; 55 return m_client;
55 } 56 }
56 57
57 DEFINE_TRACE(PresentationController) { 58 DEFINE_TRACE(PresentationController) {
58 visitor->trace(m_presentation); 59 visitor->trace(m_presentation);
59 visitor->trace(m_connections); 60 visitor->trace(m_connections);
60 Supplement<LocalFrame>::trace(visitor); 61 Supplement<LocalFrame>::trace(visitor);
61 DOMWindowProperty::trace(visitor); 62 ContextLifecycleObserver::trace(visitor);
62 } 63 }
63 64
64 void PresentationController::didStartDefaultSession( 65 void PresentationController::didStartDefaultSession(
65 WebPresentationConnectionClient* connectionClient) { 66 WebPresentationConnectionClient* connectionClient) {
66 if (!m_presentation || !m_presentation->defaultRequest()) 67 if (!m_presentation || !m_presentation->defaultRequest())
67 return; 68 return;
68 PresentationConnection::take(this, WTF::wrapUnique(connectionClient), 69 PresentationConnection::take(this, WTF::wrapUnique(connectionClient),
69 m_presentation->defaultRequest()); 70 m_presentation->defaultRequest());
70 } 71 }
71 72
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 presentationUrls[0] = url; 134 presentationUrls[0] = url;
134 135
135 m_client->setDefaultPresentationUrls(presentationUrls); 136 m_client->setDefaultPresentationUrls(presentationUrls);
136 } 137 }
137 138
138 void PresentationController::registerConnection( 139 void PresentationController::registerConnection(
139 PresentationConnection* connection) { 140 PresentationConnection* connection) {
140 m_connections.add(connection); 141 m_connections.add(connection);
141 } 142 }
142 143
143 void PresentationController::frameDestroyed() { 144 void PresentationController::contextDestroyed() {
144 if (m_client) { 145 if (m_client) {
145 m_client->setController(nullptr); 146 m_client->setController(nullptr);
146 m_client = nullptr; 147 m_client = nullptr;
147 } 148 }
148 DOMWindowProperty::frameDestroyed();
149 } 149 }
150 150
151 PresentationConnection* PresentationController::findConnection( 151 PresentationConnection* PresentationController::findConnection(
152 WebPresentationConnectionClient* connectionClient) { 152 WebPresentationConnectionClient* connectionClient) {
153 for (const auto& connection : m_connections) { 153 for (const auto& connection : m_connections) {
154 if (connection->matches(connectionClient)) 154 if (connection->matches(connectionClient))
155 return connection.get(); 155 return connection.get();
156 } 156 }
157 157
158 return nullptr; 158 return nullptr;
159 } 159 }
160 160
161 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698