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

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

Issue 1383663004: Reland of [Background Sync] Trigger Background Sync events when Chrome is backgrounded on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Don't crash in embedded webview; check permissions before creating NCNAD Created 5 years, 3 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 07ac7d826da13d27755dc09ab46022da5a1232f3..477b31f02d7edf62866357fabacea23406c72b80 100644
--- a/content/browser/background_sync/background_sync_manager.cc
+++ b/content/browser/background_sync/background_sync_manager.cc
@@ -21,6 +21,7 @@
#if defined(OS_ANDROID)
#include "content/browser/android/background_sync_launcher_android.h"
+#include "content/browser/android/background_sync_network_observer_android.h"
#endif
namespace content {
@@ -221,9 +222,15 @@ BackgroundSyncManager::BackgroundSyncManager(
service_worker_context_->AddObserver(this);
+#if defined(OS_ANDROID)
+ network_observer_.reset(new BackgroundSyncNetworkObserverAndroid(
+ base::Bind(&BackgroundSyncManager::OnNetworkChanged,
+ weak_ptr_factory_.GetWeakPtr())));
+#else
network_observer_.reset(new BackgroundSyncNetworkObserver(
base::Bind(&BackgroundSyncManager::OnNetworkChanged,
weak_ptr_factory_.GetWeakPtr())));
+#endif
power_observer_.reset(new BackgroundSyncPowerObserver(base::Bind(
&BackgroundSyncManager::OnPowerChanged, weak_ptr_factory_.GetWeakPtr())));
}

Powered by Google App Engine
This is Rietveld 408576698