| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ServiceWorkerLinkResource.h" | 5 #include "modules/serviceworkers/ServiceWorkerLinkResource.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/DOMWindow.h" | 9 #include "core/frame/DOMWindow.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 scopeURL.removeFragmentIdentifier(); | 80 scopeURL.removeFragmentIdentifier(); |
| 81 | 81 |
| 82 String errorMessage; | 82 String errorMessage; |
| 83 ServiceWorkerContainer* container = NavigatorServiceWorker::serviceWorker( | 83 ServiceWorkerContainer* container = NavigatorServiceWorker::serviceWorker( |
| 84 &document, *document.frame()->domWindow()->navigator(), errorMessage); | 84 &document, *document.frame()->domWindow()->navigator(), errorMessage); |
| 85 | 85 |
| 86 if (!container) { | 86 if (!container) { |
| 87 document.addConsoleMessage(ConsoleMessage::create( | 87 document.addConsoleMessage(ConsoleMessage::create( |
| 88 JSMessageSource, ErrorMessageLevel, | 88 JSMessageSource, ErrorMessageLevel, |
| 89 "Cannot register service worker with <link> element. " + errorMessage)); | 89 "Cannot register service worker with <link> element. " + errorMessage)); |
| 90 makeUnique<RegistrationCallback>(m_owner)->onError(WebServiceWorkerError( | 90 WTF::makeUnique<RegistrationCallback>(m_owner)->onError( |
| 91 WebServiceWorkerError::ErrorTypeSecurity, errorMessage)); | 91 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity, |
| 92 errorMessage)); |
| 92 return; | 93 return; |
| 93 } | 94 } |
| 94 | 95 |
| 95 container->registerServiceWorkerImpl( | 96 container->registerServiceWorkerImpl( |
| 96 &document, scriptURL, scopeURL, | 97 &document, scriptURL, scopeURL, |
| 97 makeUnique<RegistrationCallback>(m_owner)); | 98 WTF::makeUnique<RegistrationCallback>(m_owner)); |
| 98 } | 99 } |
| 99 | 100 |
| 100 bool ServiceWorkerLinkResource::hasLoaded() const { | 101 bool ServiceWorkerLinkResource::hasLoaded() const { |
| 101 return false; | 102 return false; |
| 102 } | 103 } |
| 103 | 104 |
| 104 void ServiceWorkerLinkResource::ownerRemoved() { | 105 void ServiceWorkerLinkResource::ownerRemoved() { |
| 105 process(); | 106 process(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner) | 109 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner) |
| 109 : LinkResource(owner) {} | 110 : LinkResource(owner) {} |
| 110 | 111 |
| 111 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |