Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Unified Diff: content/browser/background_sync/background_sync_manager.cc

Issue 1316743002: Reland of [Background Sync] Allow sync manager access from uncontrolled clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/background_sync/background_sync_manager.cc
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc
index 018bbae5ab270ecfc3905a191a9fbb48dd63cb93..6ba38b57924d1e0dbe2ded9e8775ea56e176531d 100644
--- a/content/browser/background_sync/background_sync_manager.cc
+++ b/content/browser/background_sync/background_sync_manager.cc
@@ -73,6 +73,7 @@ BackgroundSyncManager::RegistrationKey::RegistrationKey(
void BackgroundSyncManager::Register(
int64 sw_registration_id,
const BackgroundSyncRegistrationOptions& options,
+ bool requested_from_service_worker,
const StatusAndRegistrationCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -93,10 +94,10 @@ void BackgroundSyncManager::Register(
return;
}
- op_scheduler_.ScheduleOperation(
- base::Bind(&BackgroundSyncManager::RegisterImpl,
- weak_ptr_factory_.GetWeakPtr(), sw_registration_id, options,
- MakeStatusAndRegistrationCompletion(callback)));
+ op_scheduler_.ScheduleOperation(base::Bind(
+ &BackgroundSyncManager::RegisterImpl, weak_ptr_factory_.GetWeakPtr(),
+ sw_registration_id, options, requested_from_service_worker,
+ MakeStatusAndRegistrationCompletion(callback)));
}
void BackgroundSyncManager::Unregister(
@@ -301,6 +302,7 @@ void BackgroundSyncManager::InitDidGetDataFromBackend(
void BackgroundSyncManager::RegisterImpl(
int64 sw_registration_id,
const BackgroundSyncRegistrationOptions& options,
+ bool requested_from_service_worker,
const StatusAndRegistrationCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -335,7 +337,8 @@ void BackgroundSyncManager::RegisterImpl(
return;
}
- if (!sw_registration->active_version()->HasWindowClients()) {
+ if (requested_from_service_worker &&
+ !sw_registration->active_version()->HasWindowClients()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_NOT_ALLOWED,
BackgroundSyncRegistration()));

Powered by Google App Engine
This is Rietveld 408576698