| 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;
|
|
|