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

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

Issue 2502633005: [Presentation API] check if frame() is null before accessing presentation.receiver attr (Closed)
Patch Set: Created 4 years, 1 month 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 | 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 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 "modules/presentation/Presentation.h" 5 #include "modules/presentation/Presentation.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "modules/presentation/PresentationController.h" 9 #include "modules/presentation/PresentationController.h"
10 #include "modules/presentation/PresentationReceiver.h" 10 #include "modules/presentation/PresentationReceiver.h"
(...skipping 30 matching lines...) Expand all
41 if (!frame()) 41 if (!frame())
42 return; 42 return;
43 43
44 PresentationController* controller = PresentationController::from(*frame()); 44 PresentationController* controller = PresentationController::from(*frame());
45 if (!controller) 45 if (!controller)
46 return; 46 return;
47 controller->setDefaultRequestUrl(request ? request->url() : KURL()); 47 controller->setDefaultRequestUrl(request ? request->url() : KURL());
48 } 48 }
49 49
50 PresentationReceiver* Presentation::receiver() { 50 PresentationReceiver* Presentation::receiver() {
51 PresentationController* controller = PresentationController::from(*frame()); 51 if (!frame())
52 auto* client = controller ? controller->client() : nullptr; 52 return nullptr;
53 // TODO(crbug.com/647296): only return something if the Blink instance is 53 // TODO(crbug.com/647296): only return something if the Blink instance is
54 // running in presentation receiver mode. The flag PresentationReceiver could 54 // running in presentation receiver mode. The flag PresentationReceiver could
55 // be used for that. 55 // be used for that.
56 if (!m_receiver) 56 if (!m_receiver) {
57 PresentationController* controller = PresentationController::from(*frame());
58 auto* client = controller ? controller->client() : nullptr;
57 m_receiver = new PresentationReceiver(frame(), client); 59 m_receiver = new PresentationReceiver(frame(), client);
60 }
58 return m_receiver; 61 return m_receiver;
59 } 62 }
60 63
61 } // namespace blink 64 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698