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 |
index cb81edcaec3b54a7a3f1b5c15cf2f02796eb9a78..810b75ddd6dc4753172a005c9478ba0e0bc24726 100644 |
--- a/content/browser/background_fetch/background_fetch_service_impl.cc |
+++ b/content/browser/background_fetch/background_fetch_service_impl.cc |
@@ -6,8 +6,10 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
+#include "base/optional.h" |
#include "content/browser/background_fetch/background_fetch_context.h" |
#include "content/browser/service_worker/service_worker_context_wrapper.h" |
+#include "content/common/service_worker/service_worker_types.h" |
harkness
2017/03/21 11:30:00
#include background_fetch_types instead?
Peter Beverloo
2017/03/21 13:46:27
Done.
|
#include "content/public/browser/browser_thread.h" |
#include "mojo/public/cpp/bindings/strong_binding.h" |
@@ -36,6 +38,26 @@ BackgroundFetchServiceImpl::BackgroundFetchServiceImpl( |
BackgroundFetchServiceImpl::~BackgroundFetchServiceImpl() = default; |
+void BackgroundFetchServiceImpl::Fetch(int64_t service_worker_registration_id, |
+ const std::string& tag, |
+ const BackgroundFetchOptions& options, |
+ const FetchCallback& callback) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ |
+ // TODO(peter): Create a new job with the BackgroundFetchContext for the |
+ // given tag, requests and options. For now we return a registration that's |
+ // based on the given |options|, to make sure round-trip is covered. |
+ |
+ BackgroundFetchRegistration registration; |
+ registration.tag = tag; |
+ registration.icons = options.icons; |
+ registration.title = options.title; |
+ registration.total_download_size = options.total_download_size; |
+ |
+ callback.Run(blink::mojom::BackgroundFetchError::NONE, |
+ std::move(registration)); |
dcheng
2017/03/21 07:03:20
FWIW, I believe that BackgroundFetchRegistration i
Peter Beverloo
2017/03/21 13:46:27
Uch, sloppy. Sorry, done. I had been going back an
|
+} |
+ |
void BackgroundFetchServiceImpl::UpdateUI( |
int64_t service_worker_registration_id, |
const std::string& tag, |
@@ -67,7 +89,7 @@ void BackgroundFetchServiceImpl::GetRegistration( |
// and construct a BackgroundFetchRegistrationPtr for it. |
callback.Run(blink::mojom::BackgroundFetchError::NONE, |
- nullptr /* registration */); |
+ base::nullopt /* registration */); |
} |
void BackgroundFetchServiceImpl::GetTags(int64_t service_worker_registration_id, |