BackgroundFetch currently uses the DownloadManager directly which means it can't handle being resumed after chrome shuts down. It should instead use DownloadService.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ad9e3bc4850398908af750b29555d2e6fadca04f commit ad9e3bc4850398908af750b29555d2e6fadca04f Author: Dan Elphick <delphick@chromium.org> Date: Fri Aug 25 06:46:48 2017 Convert BackgroundFetch to use GUIDs In preparation for converting to use the DownloadService, change the interface between the BackgroundFetchDelegateProxy and the DownloadManager to match what will be ultimately used. This means converts to use GUIDs to identify on-going downloads. Fix the MockDownloadManager to actually use the supplied GUID. Change-Id: I9e67ffee5957bfc58f8276c912d3914dc39fa9db Bug: 758562 Reviewed-on: https://chromium-review.googlesource.com/625623 Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#497339} [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/BUILD.gn [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_cross_origin_filter_unittest.cc [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_delegate_proxy.h [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_request_info.cc [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_request_info.h [add] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_response.cc [add] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_response.h [modify] https://crrev.com/ad9e3bc4850398908af750b29555d2e6fadca04f/content/browser/background_fetch/background_fetch_test_base.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68 commit 1c0bc744b0f6d53621426bd3e8c3f652f7a23f68 Author: Dan Elphick <delphick@chromium.org> Date: Fri Sep 08 15:05:07 2017 Create a BackgroundFetchDelegate Factor out the DownloadManager logic from BackgroundFetchDelegateProxy into BackgroundFetchDelegate and BackgroundFetchDelegateImpl. Bug: 758562 Change-Id: I3fa1caa30ebd34bdf8649ecf0117568b393b5b9e Reviewed-on: https://chromium-review.googlesource.com/645386 Commit-Queue: Dan Elphick <delphick@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Cr-Commit-Position: refs/heads/master@{#500593} [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/BUILD.gn [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_context.h [add] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate.cc [add] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate.h [add] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate_impl.cc [add] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate_impl.h [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate_proxy.h [add] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_job_controller.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_job_controller.h [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_job_controller_unittest.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_request_info.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_request_info.h [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_response.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_response.h [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/browser/background_fetch/background_fetch_service_unittest.cc [modify] https://crrev.com/1c0bc744b0f6d53621426bd3e8c3f652f7a23f68/content/test/BUILD.gn
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/97521318f7a23ae5eebccc33b724966299c047a5 commit 97521318f7a23ae5eebccc33b724966299c047a5 Author: Dan Elphick <delphick@chromium.org> Date: Fri Sep 22 10:37:47 2017 Move BackgroundFetchDelegate to content/public The implementation of this interface will ultimately come from chrome so move it into content/public/browser as well as BackgroundFetchResponse which it uses in the interface. Bug: 758562 Change-Id: I214f7b22e408ecfb744aa9868b06f99ff16df2ea Reviewed-on: https://chromium-review.googlesource.com/647751 Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Eric Seckler <eseckler@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#503707} [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/android_webview/browser/aw_browser_context.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/android_webview/browser/aw_browser_context.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/BUILD.gn [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/background_fetch/OWNERS [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/background_fetch/background_fetch_delegate_factory.cc [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/background_fetch/background_fetch_delegate_factory.h [rename] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/background_fetch/background_fetch_delegate_impl.cc [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/background_fetch/background_fetch_delegate_impl.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/profiles/off_the_record_profile_impl.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/profiles/off_the_record_profile_impl.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/profiles/profile_impl.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/profiles/profile_impl.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/ui/app_list/test/fake_profile.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/browser/ui/app_list/test/fake_profile.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/test/base/testing_profile.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chrome/test/base/testing_profile.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chromecast/browser/cast_browser_context.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/chromecast/browser/cast_browser_context.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/BUILD.gn [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_context.h [delete] https://crrev.com/fdf861917fa27e55a6be0b21335880824e250a58/content/browser/background_fetch/background_fetch_delegate_impl.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_delegate_proxy.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_job_controller.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_job_controller_unittest.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_request_info.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_request_info.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_service_unittest.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_test_base.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_test_base.h [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_test_browser_context.cc [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/background_fetch_test_browser_context.h [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/mock_background_fetch_delegate.cc [add] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/background_fetch/mock_background_fetch_delegate.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/browser/download/download_manager_impl_unittest.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/BUILD.gn [rename] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/background_fetch_delegate.cc [rename] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/background_fetch_delegate.h [rename] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/background_fetch_response.cc [rename] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/background_fetch_response.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/browser/browser_context.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/test/test_browser_context.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/public/test/test_browser_context.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/shell/browser/shell_browser_context.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/shell/browser/shell_browser_context.h [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/content/test/BUILD.gn [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/headless/lib/browser/headless_browser_context_impl.cc [modify] https://crrev.com/97521318f7a23ae5eebccc33b724966299c047a5/headless/lib/browser/headless_browser_context_impl.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/906e13713d20602f2af24511d945c5c53eaad3d6 commit 906e13713d20602f2af24511d945c5c53eaad3d6 Author: Dan Elphick <delphick@chromium.org> Date: Fri Sep 29 00:36:49 2017 Convert BackgroundFetchDelegateImpl to use DownloadService Creates a new download::Client, BackgroundFetchDownloadClient, which forwards calls to the BackgroundFetchDelegateImpl. Bug: 758562 Change-Id: I8fa30334b41713b1e1d9952448c521ae547bfc2d Reviewed-on: https://chromium-review.googlesource.com/663718 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: David Trainor <dtrainor@chromium.org> Cr-Commit-Position: refs/heads/master@{#505230} [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/BUILD.gn [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/background_fetch/background_fetch_delegate_factory.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/background_fetch/background_fetch_delegate_impl.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/background_fetch/background_fetch_delegate_impl.h [add] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/background_fetch/background_fetch_download_client.cc [add] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/background_fetch/background_fetch_download_client.h [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/download/download_service_factory.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/chrome/browser/download/download_service_factory.h [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/components/download/internal/proto/entry.proto [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/components/download/internal/proto_conversions.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/components/download/internal/stats.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/components/download/public/clients.h [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/906e13713d20602f2af24511d945c5c53eaad3d6/content/public/browser/background_fetch_delegate.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/752cfe24d16120d1dd22a7360541f2eef31f30b9 commit 752cfe24d16120d1dd22a7360541f2eef31f30b9 Author: Dan Elphick <delphick@chromium.org> Date: Thu Oct 19 15:28:03 2017 BackgroundFetch aborts now cancel active Downloads. Pass through the Abort message to the DownloadService for any outstanding downloads matching the given job_unique_id. Update abort unit tests to verify that the download successful messages do not get delivered. Change-Id: I600a3f102047939d7189dc6d30e9ca88eedf4c04 Bug: 758562 Reviewed-on: https://chromium-review.googlesource.com/723321 Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#510090} [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/chrome/browser/background_fetch/background_fetch_delegate_impl.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/chrome/browser/background_fetch/background_fetch_delegate_impl.h [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/background_fetch_delegate_proxy.h [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/background_fetch_job_controller.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/background_fetch_job_controller_unittest.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/mock_background_fetch_delegate.cc [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/browser/background_fetch/mock_background_fetch_delegate.h [modify] https://crrev.com/752cfe24d16120d1dd22a7360541f2eef31f30b9/content/public/browser/background_fetch_delegate.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f1c221dfc538313aafe81fc4a972a7e7190a3882 commit f1c221dfc538313aafe81fc4a972a7e7190a3882 Author: Dan Elphick <delphick@chromium.org> Date: Fri Oct 20 14:47:45 2017 Abort outstanding BackgroundFetch downloads at start Since Background Fetch doesn't yet persist across browser restarts, just cancel any pre-existing downloads that the DownloadService notifies us about when it initializes. Bug: 758562 Change-Id: I2475afea7954f1f0d400f77309416713c5c6d91c Reviewed-on: https://chromium-review.googlesource.com/730985 Reviewed-by: John Mellor <johnme@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#510432} [modify] https://crrev.com/f1c221dfc538313aafe81fc4a972a7e7190a3882/chrome/browser/background_fetch/background_fetch_download_client.cc
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/771998f4f55ff34eb8bd3c64634b28d98e0464ee commit 771998f4f55ff34eb8bd3c64634b28d98e0464ee Author: Dan Elphick <delphick@chromium.org> Date: Fri Oct 27 22:00:30 2017 Allow cancellation of Background fetches Extend all BackgroundFetchDelegate::Client methods to take job_unique_id as well as download_guid in order to identify to quickly identify the job that the download belongs to. Further, BackgroundFetchDelegateProxy now does a two stage lookup to find a download using the job id and then the download id. Add OnJobCancelled to BackgroundFetchDelegate::Client, which is called in response to tapping Cancel in the Background Fetch download notification. This method cancels the entire job rather than just an individual download request within it. Ultimately this calls AbortFromUser on the JobController which then signals back to Javascript. BackgroundFetchDelegateImpl now updates the notification after Abort() to mark it cancelled. It is also now more resilient to calls from the DownloadService about GUIDs that it doesn't know about. In all cases it just drops them on the floor since it no longer has any state for them. This mostly happens because BackgroundFetch is not yet persisting state between browser restarts and so this will be not be a problem in the future. Bug: 758562 Change-Id: I8c7c70da6bf91d9b0580ec2bf8614ccc4e208da3 Reviewed-on: https://chromium-review.googlesource.com/731084 Reviewed-by: Peter Beverloo <peter@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Commit-Queue: Peter Beverloo <peter@chromium.org> Cr-Commit-Position: refs/heads/master@{#512300} [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/chrome/browser/background_fetch/background_fetch_delegate_impl.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/chrome/browser/background_fetch/background_fetch_delegate_impl.h [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_data_manager.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_data_manager.h [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_delegate_proxy.h [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_job_controller.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_job_controller.h [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/background_fetch_job_controller_unittest.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/browser/background_fetch/mock_background_fetch_delegate.cc [modify] https://crrev.com/771998f4f55ff34eb8bd3c64634b28d98e0464ee/content/public/browser/background_fetch_delegate.h
Comment 1 by bugdroid1@chromium.org
, Aug 25 2017