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