| 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 "bindings/core/v8/ScriptState.h" |
| 7 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Navigator.h" | 11 #include "core/frame/Navigator.h" |
| 11 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 12 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {} | 16 NavigatorServiceWorker::NavigatorServiceWorker(Navigator& navigator) {} |
| 16 | 17 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 Navigator& navigator) { | 45 Navigator& navigator) { |
| 45 return static_cast<NavigatorServiceWorker*>( | 46 return static_cast<NavigatorServiceWorker*>( |
| 46 Supplement<Navigator>::from(navigator, supplementName())); | 47 Supplement<Navigator>::from(navigator, supplementName())); |
| 47 } | 48 } |
| 48 | 49 |
| 49 const char* NavigatorServiceWorker::supplementName() { | 50 const char* NavigatorServiceWorker::supplementName() { |
| 50 return "NavigatorServiceWorker"; | 51 return "NavigatorServiceWorker"; |
| 51 } | 52 } |
| 52 | 53 |
| 53 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( | 54 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( |
| 54 ExecutionContext* executionContext, | 55 ScriptState* scriptState, |
| 55 Navigator& navigator, | 56 Navigator& navigator, |
| 56 ExceptionState& exceptionState) { | 57 ExceptionState& exceptionState) { |
| 58 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 57 DCHECK(!navigator.frame() || | 59 DCHECK(!navigator.frame() || |
| 58 executionContext->getSecurityOrigin()->canAccessCheckSuborigins( | 60 executionContext->getSecurityOrigin()->canAccessCheckSuborigins( |
| 59 navigator.frame()->securityContext()->getSecurityOrigin())); | 61 navigator.frame()->securityContext()->getSecurityOrigin())); |
| 60 return NavigatorServiceWorker::from(navigator).serviceWorker( | 62 return NavigatorServiceWorker::from(navigator).serviceWorker( |
| 61 navigator.frame(), exceptionState); | 63 navigator.frame(), exceptionState); |
| 62 } | 64 } |
| 63 | 65 |
| 64 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( | 66 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( |
| 65 ExecutionContext* executionContext, | 67 ScriptState* scriptState, |
| 66 Navigator& navigator, | 68 Navigator& navigator, |
| 67 String& errorMessage) { | 69 String& errorMessage) { |
| 70 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 68 DCHECK(!navigator.frame() || | 71 DCHECK(!navigator.frame() || |
| 69 executionContext->getSecurityOrigin()->canAccessCheckSuborigins( | 72 executionContext->getSecurityOrigin()->canAccessCheckSuborigins( |
| 70 navigator.frame()->securityContext()->getSecurityOrigin())); | 73 navigator.frame()->securityContext()->getSecurityOrigin())); |
| 71 return NavigatorServiceWorker::from(navigator).serviceWorker( | 74 return NavigatorServiceWorker::from(navigator).serviceWorker( |
| 72 navigator.frame(), errorMessage); | 75 navigator.frame(), errorMessage); |
| 73 } | 76 } |
| 74 | 77 |
| 75 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( | 78 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker( |
| 76 LocalFrame* frame, | 79 LocalFrame* frame, |
| 77 ExceptionState& exceptionState) { | 80 ExceptionState& exceptionState) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void NavigatorServiceWorker::clearServiceWorker() { | 121 void NavigatorServiceWorker::clearServiceWorker() { |
| 119 m_serviceWorker = nullptr; | 122 m_serviceWorker = nullptr; |
| 120 } | 123 } |
| 121 | 124 |
| 122 DEFINE_TRACE(NavigatorServiceWorker) { | 125 DEFINE_TRACE(NavigatorServiceWorker) { |
| 123 visitor->trace(m_serviceWorker); | 126 visitor->trace(m_serviceWorker); |
| 124 Supplement<Navigator>::trace(visitor); | 127 Supplement<Navigator>::trace(visitor); |
| 125 } | 128 } |
| 126 | 129 |
| 127 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |