| Index: content/browser/background_fetch/background_fetch_service_impl.cc
|
| diff --git a/content/browser/background_fetch/background_fetch_service_impl.cc b/content/browser/background_fetch/background_fetch_service_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e5c75c838b3b683054bccd1c4a3d6c11d11be705
|
| --- /dev/null
|
| +++ b/content/browser/background_fetch/background_fetch_service_impl.cc
|
| @@ -0,0 +1,83 @@
|
| +// Copyright 2017 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 "content/browser/background_fetch/background_fetch_service_impl.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/memory/ptr_util.h"
|
| +#include "content/browser/background_fetch/background_fetch_context.h"
|
| +#include "content/browser/service_worker/service_worker_context_wrapper.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "mojo/public/cpp/bindings/strong_binding.h"
|
| +
|
| +namespace content {
|
| +
|
| +// static
|
| +void BackgroundFetchServiceImpl::Create(
|
| + BackgroundFetchContext* background_fetch_context,
|
| + ServiceWorkerContextWrapper* service_worker_context,
|
| + blink::mojom::BackgroundFetchServiceRequest request) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + mojo::MakeStrongBinding(base::MakeUnique<BackgroundFetchServiceImpl>(
|
| + background_fetch_context, service_worker_context),
|
| + std::move(request));
|
| +}
|
| +
|
| +BackgroundFetchServiceImpl::BackgroundFetchServiceImpl(
|
| + BackgroundFetchContext* background_fetch_context,
|
| + ServiceWorkerContextWrapper* service_worker_context)
|
| + : background_fetch_context_(background_fetch_context),
|
| + service_worker_context_(service_worker_context) {
|
| + DCHECK(background_fetch_context);
|
| + DCHECK(service_worker_context);
|
| +}
|
| +
|
| +BackgroundFetchServiceImpl::~BackgroundFetchServiceImpl() = default;
|
| +
|
| +void BackgroundFetchServiceImpl::UpdateUI(
|
| + int64_t service_worker_registration_id,
|
| + const std::string& tag,
|
| + const std::string& title,
|
| + const UpdateUICallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| + // TODO(peter): Get the BackgroundFetchJobController for the
|
| + // {service_worker_registration_id, tag} pair and call UpdateUI() on it.
|
| +
|
| + callback.Run(blink::mojom::BackgroundFetchError::NONE);
|
| +}
|
| +
|
| +void BackgroundFetchServiceImpl::Abort(int64_t service_worker_registration_id,
|
| + const std::string& tag) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| + // TODO(peter): Get the BackgroundFetchJobController for the
|
| + // {service_worker_registration_id, tag} pair and call Abort() on it.
|
| +}
|
| +
|
| +void BackgroundFetchServiceImpl::GetRegistration(
|
| + int64_t service_worker_registration_id,
|
| + const std::string& tag,
|
| + const GetRegistrationCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| + // TODO(peter): Get the registration for {service_worker_registration_id, tag}
|
| + // and construct a BackgroundFetchRegistrationPtr for it.
|
| +
|
| + callback.Run(blink::mojom::BackgroundFetchError::DUPLICATED_TAG,
|
| + nullptr /* registration */);
|
| +}
|
| +
|
| +void BackgroundFetchServiceImpl::GetTags(int64_t service_worker_registration_id,
|
| + const GetTagsCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| + // TODO(peter): Get the list of active Background Fetches associated with
|
| + // service_worker_registration_id and share their tags.
|
| +
|
| + callback.Run(blink::mojom::BackgroundFetchError::NONE,
|
| + std::vector<std::string>());
|
| +}
|
| +
|
| +} // namespace content
|
|
|