| OLD | NEW |
| 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/serviceworkers/NavigatorServiceWorker.h" | 5 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Navigator.h" | 10 #include "core/frame/Navigator.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (navigator.frame() && navigator.frame()->securityContext()->getSecuri
tyOrigin()->canAccessServiceWorkers()) { | 38 if (navigator.frame() && navigator.frame()->securityContext()->getSecuri
tyOrigin()->canAccessServiceWorkers()) { |
| 39 // Initialize ServiceWorkerContainer too. | 39 // Initialize ServiceWorkerContainer too. |
| 40 supplement->serviceWorker(ASSERT_NO_EXCEPTION); | 40 supplement->serviceWorker(ASSERT_NO_EXCEPTION); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 return *supplement; | 43 return *supplement; |
| 44 } | 44 } |
| 45 | 45 |
| 46 NavigatorServiceWorker* NavigatorServiceWorker::toNavigatorServiceWorker(Navigat
or& navigator) | 46 NavigatorServiceWorker* NavigatorServiceWorker::toNavigatorServiceWorker(Navigat
or& navigator) |
| 47 { | 47 { |
| 48 return static_cast<NavigatorServiceWorker*>(HeapSupplement<Navigator>::from(
navigator, supplementName())); | 48 return static_cast<NavigatorServiceWorker*>(Supplement<Navigator>::from(navi
gator, supplementName())); |
| 49 } | 49 } |
| 50 | 50 |
| 51 const char* NavigatorServiceWorker::supplementName() | 51 const char* NavigatorServiceWorker::supplementName() |
| 52 { | 52 { |
| 53 return "NavigatorServiceWorker"; | 53 return "NavigatorServiceWorker"; |
| 54 } | 54 } |
| 55 | 55 |
| 56 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext*
executionContext, Navigator& navigator, ExceptionState& exceptionState) | 56 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext*
executionContext, Navigator& navigator, ExceptionState& exceptionState) |
| 57 { | 57 { |
| 58 ASSERT(!navigator.frame() || executionContext->getSecurityOrigin()->canAcces
sCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin())); | 58 ASSERT(!navigator.frame() || executionContext->getSecurityOrigin()->canAcces
sCheckSuborigins(navigator.frame()->securityContext()->getSecurityOrigin())); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 { | 79 { |
| 80 if (m_serviceWorker) { | 80 if (m_serviceWorker) { |
| 81 m_serviceWorker->willBeDetachedFromFrame(); | 81 m_serviceWorker->willBeDetachedFromFrame(); |
| 82 m_serviceWorker = nullptr; | 82 m_serviceWorker = nullptr; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 DEFINE_TRACE(NavigatorServiceWorker) | 86 DEFINE_TRACE(NavigatorServiceWorker) |
| 87 { | 87 { |
| 88 visitor->trace(m_serviceWorker); | 88 visitor->trace(m_serviceWorker); |
| 89 HeapSupplement<Navigator>::trace(visitor); | 89 Supplement<Navigator>::trace(visitor); |
| 90 DOMWindowProperty::trace(visitor); | 90 DOMWindowProperty::trace(visitor); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |