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

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

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (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
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 "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "modules/presentation/PresentationController.h" 10 #include "modules/presentation/PresentationController.h"
11 #include "modules/presentation/PresentationReceiver.h" 11 #include "modules/presentation/PresentationReceiver.h"
12 #include "modules/presentation/PresentationRequest.h" 12 #include "modules/presentation/PresentationRequest.h"
13 #include "platform/weborigin/KURL.h"
14 #include "wtf/Vector.h"
13 15
14 namespace blink { 16 namespace blink {
15 17
16 Presentation::Presentation(LocalFrame* frame) : DOMWindowProperty(frame) {} 18 Presentation::Presentation(LocalFrame* frame) : DOMWindowProperty(frame) {}
17 19
18 // static 20 // static
19 Presentation* Presentation::create(LocalFrame* frame) { 21 Presentation* Presentation::create(LocalFrame* frame) {
20 ASSERT(frame); 22 ASSERT(frame);
21 23
22 Presentation* presentation = new Presentation(frame); 24 Presentation* presentation = new Presentation(frame);
(...skipping 15 matching lines...) Expand all
38 40
39 void Presentation::setDefaultRequest(PresentationRequest* request) { 41 void Presentation::setDefaultRequest(PresentationRequest* request) {
40 m_defaultRequest = request; 42 m_defaultRequest = request;
41 43
42 if (!frame()) 44 if (!frame())
43 return; 45 return;
44 46
45 PresentationController* controller = PresentationController::from(*frame()); 47 PresentationController* controller = PresentationController::from(*frame());
46 if (!controller) 48 if (!controller)
47 return; 49 return;
48 controller->setDefaultRequestUrl(request ? request->url() : KURL()); 50 controller->setDefaultRequestUrl(request ? request->urls()
mark a. foltz 2016/12/09 05:38:03 Do we need to call setDefaultRequestUrl at all for
whywhat 2016/12/09 22:44:09 We probably do so that navigator.presentation.defa
zhaobin 2016/12/09 23:01:59 Done.
51 : WTF::Vector<KURL>());
49 } 52 }
50 53
51 PresentationReceiver* Presentation::receiver() { 54 PresentationReceiver* Presentation::receiver() {
52 if (!frame() || !frame()->settings()) 55 if (!frame() || !frame()->settings())
53 return nullptr; 56 return nullptr;
54 57
55 if (!frame()->settings()->presentationReceiver()) 58 if (!frame()->settings()->presentationReceiver())
56 return nullptr; 59 return nullptr;
57 60
58 if (!m_receiver) { 61 if (!m_receiver) {
59 PresentationController* controller = PresentationController::from(*frame()); 62 PresentationController* controller = PresentationController::from(*frame());
60 auto* client = controller ? controller->client() : nullptr; 63 auto* client = controller ? controller->client() : nullptr;
61 m_receiver = new PresentationReceiver(frame(), client); 64 m_receiver = new PresentationReceiver(frame(), client);
62 } 65 }
63 66
64 return m_receiver; 67 return m_receiver;
65 } 68 }
66 69
67 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698