[BackgroundSync] Recover from closed browser mid-sync

Utilizes BackgroundSyncController::RunInBackground to restart the
browser if it closed on Android mid-sync. On other platforms
RunInBackground will keep the browser open so it shouldn't close.

The primary change of this CL is to add a min_time_ms parameter to
BackgroundSyncController::RunInBackground so that it waits at wait
min_time_ms before checking if the browser is running.

BUG=501838

Review URL: https://codereview.chromium.org/1427433010

Cr-Commit-Position: refs/heads/master@{#358817}
diff --git a/chrome/browser/android/background_sync_launcher_android.h b/chrome/browser/android/background_sync_launcher_android.h
index 1f23d75..873b43f 100644
--- a/chrome/browser/android/background_sync_launcher_android.h
+++ b/chrome/browser/android/background_sync_launcher_android.h
@@ -25,8 +25,8 @@
  public:
   static BackgroundSyncLauncherAndroid* Get();
 
-  static void LaunchBrowserWhenNextOnline(
-      bool launch_when_next_online);
+  static void LaunchBrowserIfStopped(bool launch_when_next_online,
+                                     int64_t min_delay_ms);
 
   static bool RegisterLauncher(JNIEnv* env);
 
@@ -37,8 +37,8 @@
   BackgroundSyncLauncherAndroid();
   ~BackgroundSyncLauncherAndroid();
 
-  void LaunchBrowserWhenNextOnlineImpl(
-      bool launch_when_next_online);
+  void LaunchBrowserIfStoppedImpl(bool launch_when_next_online,
+                                  int64_t min_delay_ms);
 
   base::android::ScopedJavaGlobalRef<jobject> java_launcher_;
   DISALLOW_COPY_AND_ASSIGN(BackgroundSyncLauncherAndroid);