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

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

Issue 2801823003: [Presentation API] Change connection to 'connected' if start a presentation with "https://www.googl… (Closed)
Patch Set: resolve code review comments from mlamouri 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/NavigatorPresentation.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/NavigatorPresentation.cpp b/third_party/WebKit/Source/modules/presentation/NavigatorPresentation.cpp
index a3ce1b4fd4e5c7ba2e08a79826fe221ee224539f..ab33d1479bb8ccabdd3caa3bca35d8f5478ca8fa 100644
--- a/third_party/WebKit/Source/modules/presentation/NavigatorPresentation.cpp
+++ b/third_party/WebKit/Source/modules/presentation/NavigatorPresentation.cpp
@@ -4,6 +4,9 @@
#include "modules/presentation/NavigatorPresentation.h"
+#include "core/dom/Document.h"
+#include "core/frame/LocalDOMWindow.h"
+#include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h"
#include "modules/presentation/Presentation.h"
@@ -17,6 +20,23 @@ const char* NavigatorPresentation::supplementName() {
}
// static
+NavigatorPresentation* NavigatorPresentation::ensurePresentationReceiver(
mark a. foltz 2017/04/10 21:59:57 Slight preference to move this to PresentationRece
zhaobin 2017/04/11 00:03:09 Done.
+ Document& document) {
+ if (!document.frame() || !document.frame()->domWindow())
+ return 0;
mark a. foltz 2017/04/10 21:59:57 nullptr
zhaobin 2017/04/11 00:03:09 Done.
+ Navigator& navigator = *document.frame()->domWindow()->navigator();
+ NavigatorPresentation* presentation = &from(navigator);
+
+ if (navigator.frame()) {
+ // This need to be eagerly created in order to have the receiver associated
+ // with the client.
+ presentation->m_presentation = Presentation::create(navigator.frame());
+ presentation->m_presentation->receiver();
+ }
+ return presentation;
+}
+
+// static
NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator) {
NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(
Supplement<Navigator>::from(navigator, supplementName()));

Powered by Google App Engine
This is Rietveld 408576698