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

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp

Issue 2801823003: [Presentation API] Change connection to 'connected' if start a presentation with "https://www.googl… (Closed)
Patch Set: fix windows compile error Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
index 377e3453e7efabe0f73ecf9a788cf05d4b7b5d71..064ca77f6fc9d46be41fcadaf19854aa6685c8a3 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp
@@ -11,7 +11,10 @@
#include "core/dom/ExceptionCode.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Navigator.h"
#include "core/frame/UseCounter.h"
+#include "modules/presentation/NavigatorPresentation.h"
+#include "modules/presentation/Presentation.h"
#include "modules/presentation/PresentationConnection.h"
#include "modules/presentation/PresentationConnectionList.h"
#include "public/platform/modules/presentation/WebPresentationClient.h"
@@ -28,6 +31,18 @@ PresentationReceiver::PresentationReceiver(LocalFrame* frame,
client->SetReceiver(this);
}
+// static
+PresentationReceiver* PresentationReceiver::From(Document& document) {
+ if (!document.GetFrame() || !document.GetFrame()->DomWindow())
+ return nullptr;
+ Navigator& navigator = *document.GetFrame()->DomWindow()->navigator();
+ Presentation* presentation = NavigatorPresentation::presentation(navigator);
+ if (!presentation)
+ return nullptr;
+
+ return presentation->receiver();
+}
+
ScriptPromise PresentationReceiver::connectionList(ScriptState* script_state) {
if (!connection_list_property_)
connection_list_property_ =

Powered by Google App Engine
This is Rietveld 408576698