| 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 "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/DOMWindow.h" | 8 #include "core/frame/DOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/html/HTMLLinkElement.h" | 10 #include "core/html/HTMLLinkElement.h" |
| 11 #include "core/loader/FrameLoaderClient.h" | 11 #include "core/loader/FrameLoaderClient.h" |
| 12 #include "modules/serviceworkers/NavigatorServiceWorker.h" | 12 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
| 13 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 13 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
| 14 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
| 15 #include "public/platform/WebScheduler.h" | 15 #include "public/platform/WebScheduler.h" |
| 16 #include "wtf/PtrUtil.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class RegistrationCallback : public WebServiceWorkerProvider::WebServiceWorkerRe
gistrationCallbacks { | 22 class RegistrationCallback : public WebServiceWorkerProvider::WebServiceWorkerRe
gistrationCallbacks { |
| 22 public: | 23 public: |
| 23 explicit RegistrationCallback(LinkLoaderClient* client) : m_client(client) {
} | 24 explicit RegistrationCallback(LinkLoaderClient* client) : m_client(client) {
} |
| 24 ~RegistrationCallback() override {} | 25 ~RegistrationCallback() override {} |
| 25 | 26 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 String scope = m_owner->scope(); | 66 String scope = m_owner->scope(); |
| 66 KURL scopeURL; | 67 KURL scopeURL; |
| 67 if (scope.isNull()) | 68 if (scope.isNull()) |
| 68 scopeURL = KURL(scriptURL, "./"); | 69 scopeURL = KURL(scriptURL, "./"); |
| 69 else | 70 else |
| 70 scopeURL = document.completeURL(scope); | 71 scopeURL = document.completeURL(scope); |
| 71 scopeURL.removeFragmentIdentifier(); | 72 scopeURL.removeFragmentIdentifier(); |
| 72 | 73 |
| 73 TrackExceptionState exceptionState; | 74 TrackExceptionState exceptionState; |
| 74 | 75 |
| 75 NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindo
w()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptUR
L, scopeURL, adoptPtr(new RegistrationCallback(m_owner))); | 76 NavigatorServiceWorker::serviceWorker(&document, *document.frame()->domWindo
w()->navigator(), exceptionState)->registerServiceWorkerImpl(&document, scriptUR
L, scopeURL, wrapUnique(new RegistrationCallback(m_owner))); |
| 76 } | 77 } |
| 77 | 78 |
| 78 bool ServiceWorkerLinkResource::hasLoaded() const | 79 bool ServiceWorkerLinkResource::hasLoaded() const |
| 79 { | 80 { |
| 80 return false; | 81 return false; |
| 81 } | 82 } |
| 82 | 83 |
| 83 void ServiceWorkerLinkResource::ownerRemoved() | 84 void ServiceWorkerLinkResource::ownerRemoved() |
| 84 { | 85 { |
| 85 process(); | 86 process(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner) | 89 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner) |
| 89 : LinkResource(owner) | 90 : LinkResource(owner) |
| 90 { | 91 { |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |