blob: 873b43f199430f6d74ff60a3ede3eb9c7cb16455 [file] [log] [blame]
jkarlindb185222015-05-29 12:02:001// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
iclelland8467f462015-10-21 14:03:135#ifndef CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_
6#define CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_
jkarlindb185222015-05-29 12:02:007
8#include <set>
9
10#include "base/android/jni_android.h"
11#include "base/lazy_instance.h"
12#include "base/macros.h"
jkarlindb185222015-05-29 12:02:0013
14namespace content {
15
16class BackgroundSyncManager;
17
iclelland8467f462015-10-21 14:03:1318}
19
jkarlindb185222015-05-29 12:02:0020// The BackgroundSyncLauncherAndroid singleton owns the Java
21// BackgroundSyncLauncher object and is used to register interest in starting
22// the browser the next time the device goes online. This class runs on the UI
23// thread.
iclelland8467f462015-10-21 14:03:1324class BackgroundSyncLauncherAndroid {
jkarlindb185222015-05-29 12:02:0025 public:
26 static BackgroundSyncLauncherAndroid* Get();
27
jkarlin4302d712015-11-10 10:59:0128 static void LaunchBrowserIfStopped(bool launch_when_next_online,
29 int64_t min_delay_ms);
jkarlindb185222015-05-29 12:02:0030
31 static bool RegisterLauncher(JNIEnv* env);
32
33 private:
34 friend struct base::DefaultLazyInstanceTraits<BackgroundSyncLauncherAndroid>;
35
36 // Constructor and destructor marked private to enforce singleton
37 BackgroundSyncLauncherAndroid();
38 ~BackgroundSyncLauncherAndroid();
39
jkarlin4302d712015-11-10 10:59:0140 void LaunchBrowserIfStoppedImpl(bool launch_when_next_online,
41 int64_t min_delay_ms);
jkarlindb185222015-05-29 12:02:0042
jkarlindb185222015-05-29 12:02:0043 base::android::ScopedJavaGlobalRef<jobject> java_launcher_;
44 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncLauncherAndroid);
45};
46
iclelland8467f462015-10-21 14:03:1347#endif // CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_