| Index: third_party/WebKit/Source/core/html/LinkServiceWorker.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/LinkServiceWorker.cpp b/third_party/WebKit/Source/core/html/LinkServiceWorker.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..14168b5c6182b30f882455256d6d354797ebb385
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/html/LinkServiceWorker.cpp
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/html/LinkServiceWorker.h"
|
| +
|
| +#include "core/dom/Document.h"
|
| +#include "core/frame/LocalFrame.h"
|
| +#include "core/html/HTMLLinkElement.h"
|
| +#include "core/loader/FrameLoaderClient.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtrWillBeRawPtr<LinkServiceWorker> LinkServiceWorker::create(HTMLLinkElement* owner)
|
| +{
|
| + return adoptPtrWillBeNoop(new LinkServiceWorker(owner));
|
| +}
|
| +
|
| +LinkServiceWorker::~LinkServiceWorker()
|
| +{
|
| +}
|
| +
|
| +void LinkServiceWorker::process()
|
| +{
|
| + if (!m_owner || !m_owner->document().frame())
|
| + return;
|
| +
|
| + KURL scriptURL = m_owner->href();
|
| +
|
| + String scope = m_owner->scope();
|
| + KURL scopeURL;
|
| + if (scope.isNull())
|
| + scopeURL = KURL(scriptURL, "./");
|
| + else
|
| + scopeURL = m_owner->document().completeURL(scope);
|
| + scopeURL.removeFragmentIdentifier();
|
| +
|
| + m_owner->document().frame()->loader().client()->registerServiceWorker(scriptURL, scopeURL, m_owner);
|
| +}
|
| +
|
| +bool LinkServiceWorker::hasLoaded() const
|
| +{
|
| + return false;
|
| +}
|
| +
|
| +void LinkServiceWorker::ownerRemoved()
|
| +{
|
| + process();
|
| +}
|
| +
|
| +LinkServiceWorker::LinkServiceWorker(HTMLLinkElement* owner)
|
| + : LinkResource(owner)
|
| +{
|
| +}
|
| +
|
| +} // namespace blink
|
|
|