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