Commit 82151579 authored by Rayan Kanso's avatar Rayan Kanso Committed by Commit Bot

[Background Fetch] Update mojo updateUI call to support icon change

Bug: 865063
Change-Id: I8d9cc10e56189099c278d63012dee1d32f0728de
Reviewed-on: https://chromium-review.googlesource.com/1143306
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: default avatarMugdha Lakhani <nator@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577548}
parent acc631ae
...@@ -106,10 +106,14 @@ void BackgroundFetchServiceImpl::UpdateUI( ...@@ -106,10 +106,14 @@ void BackgroundFetchServiceImpl::UpdateUI(
int64_t service_worker_registration_id, int64_t service_worker_registration_id,
const std::string& developer_id, const std::string& developer_id,
const std::string& unique_id, const std::string& unique_id,
const std::string& title, const base::Optional<std::string>& title,
const SkBitmap& icon,
UpdateUICallback callback) { UpdateUICallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!ValidateUniqueId(unique_id) || !ValidateTitle(title)) {
// TODO(crbug.com/865063): Remove the check for |title| when updating both the
// title and icons is supported.
if (!ValidateUniqueId(unique_id) || !title || !ValidateTitle(*title)) {
std::move(callback).Run( std::move(callback).Run(
blink::mojom::BackgroundFetchError::INVALID_ARGUMENT); blink::mojom::BackgroundFetchError::INVALID_ARGUMENT);
return; return;
...@@ -117,7 +121,7 @@ void BackgroundFetchServiceImpl::UpdateUI( ...@@ -117,7 +121,7 @@ void BackgroundFetchServiceImpl::UpdateUI(
BackgroundFetchRegistrationId registration_id( BackgroundFetchRegistrationId registration_id(
service_worker_registration_id, origin_, developer_id, unique_id); service_worker_registration_id, origin_, developer_id, unique_id);
background_fetch_context_->UpdateUI(registration_id, title, background_fetch_context_->UpdateUI(registration_id, *title,
std::move(callback)); std::move(callback));
} }
......
...@@ -47,7 +47,8 @@ class CONTENT_EXPORT BackgroundFetchServiceImpl ...@@ -47,7 +47,8 @@ class CONTENT_EXPORT BackgroundFetchServiceImpl
void UpdateUI(int64_t service_worker_registration_id, void UpdateUI(int64_t service_worker_registration_id,
const std::string& developer_id, const std::string& developer_id,
const std::string& unique_id, const std::string& unique_id,
const std::string& title, const base::Optional<std::string>& title,
const SkBitmap& icon,
UpdateUICallback callback) override; UpdateUICallback callback) override;
void Abort(int64_t service_worker_registration_id, void Abort(int64_t service_worker_registration_id,
const std::string& developer_id, const std::string& developer_id,
......
...@@ -183,7 +183,7 @@ class BackgroundFetchServiceTest : public BackgroundFetchTestBase { ...@@ -183,7 +183,7 @@ class BackgroundFetchServiceTest : public BackgroundFetchTestBase {
base::RunLoop run_loop; base::RunLoop run_loop;
service_->UpdateUI(service_worker_registration_id, unique_id, developer_id, service_->UpdateUI(service_worker_registration_id, unique_id, developer_id,
title, title, SkBitmap(),
base::BindOnce(&BackgroundFetchServiceTest::DidGetError, base::BindOnce(&BackgroundFetchServiceTest::DidGetError,
base::Unretained(this), base::Unretained(this),
run_loop.QuitClosure(), out_error)); run_loop.QuitClosure(), out_error));
......
...@@ -73,7 +73,8 @@ interface BackgroundFetchService { ...@@ -73,7 +73,8 @@ interface BackgroundFetchService {
UpdateUI(int64 service_worker_registration_id, UpdateUI(int64 service_worker_registration_id,
string developer_id, string developer_id,
string unique_id, string unique_id,
string title) string? title,
skia.mojom.Bitmap? icon)
=> (BackgroundFetchError error); => (BackgroundFetchError error);
// Aborts the Background Fetch registration identified by |unique_id| and // Aborts the Background Fetch registration identified by |unique_id| and
......
...@@ -79,7 +79,7 @@ void BackgroundFetchBridge::UpdateUI(const String& developer_id, ...@@ -79,7 +79,7 @@ void BackgroundFetchBridge::UpdateUI(const String& developer_id,
GetService()->UpdateUI( GetService()->UpdateUI(
GetSupplementable()->WebRegistration()->RegistrationId(), developer_id, GetSupplementable()->WebRegistration()->RegistrationId(), developer_id,
unique_id, title, std::move(callback)); unique_id, title, icon, std::move(callback));
} }
void BackgroundFetchBridge::GetRegistration(const String& developer_id, void BackgroundFetchBridge::GetRegistration(const String& developer_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment