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

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: fix content_unittest and layout test failures 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..6eef890b946c4457a2d0c9d6fd6cb443c3fdff3d 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,11 +20,22 @@ const char* NavigatorPresentation::supplementName() {
}
// static
+NavigatorPresentation* NavigatorPresentation::from(Document& document) {
+ if (!document.frame() || !document.frame()->domWindow())
+ return 0;
+ Navigator& navigator = *document.frame()->domWindow()->navigator();
+ return &from(navigator);
+}
+
+// static
NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator) {
NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(
Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) {
supplement = new NavigatorPresentation();
+ if (navigator.frame())
+ supplement->m_presentation = Presentation::create(navigator.frame());
+
provideTo(navigator, supplementName(), supplement);
}
return *supplement;

Powered by Google App Engine
This is Rietveld 408576698