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

Side by Side Diff: chrome/browser/android/background_sync_launcher_android.h

Issue 1324173002: [Background Sync] Use GcmNetworkManager to start the browser for sync events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@bgsync-fix-background5
Patch Set: Move the BackgroundSyncLauncher into /chrome Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_ 5 #ifndef CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_ 6 #define CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/common/content_export.h"
14 13
15 namespace content { 14 namespace content {
16 15
17 class BackgroundSyncManager; 16 class BackgroundSyncManager;
17 };
jkarlin 2015/10/14 18:30:28 remove semicolon
iclelland 2015/10/14 19:31:24 Done.
18
19 namespace chrome {
20 namespace android {
18 21
jkarlin 2015/10/14 18:30:28 Should be in top level namespace
iclelland 2015/10/14 19:31:24 Done.
19 // The BackgroundSyncLauncherAndroid singleton owns the Java 22 // The BackgroundSyncLauncherAndroid singleton owns the Java
20 // BackgroundSyncLauncher object and is used to register interest in starting 23 // BackgroundSyncLauncher object and is used to register interest in starting
21 // the browser the next time the device goes online. This class runs on the UI 24 // the browser the next time the device goes online. This class runs on the UI
22 // thread. 25 // thread.
23 class CONTENT_EXPORT BackgroundSyncLauncherAndroid { 26 class BackgroundSyncLauncherAndroid {
24 public: 27 public:
25 static BackgroundSyncLauncherAndroid* Get(); 28 static BackgroundSyncLauncherAndroid* Get();
26 29
27 // Register the |registrant|'s interest (or disinterest) in starting the 30 // Register the |registrant|'s interest (or disinterest) in starting the
28 // browser the next time the device goes online after the browser has closed. 31 // browser the next time the device goes online after the browser has closed.
29 // |registrant| is used to count the number of interested objects and is not 32 // |registrant| is used to count the number of interested objects and is not
30 // accessed, therefore it is okay for |registrant| to be deleted before this 33 // accessed, therefore it is okay for |registrant| to be deleted before this
31 // class. Interest is reset the next time the BackgroundSyncLauncherAndroid is 34 // class. Interest is reset the next time the BackgroundSyncLauncherAndroid is
32 // created (browser restart). The caller can remove interest in launching the 35 // created (browser restart). The caller can remove interest in launching the
33 // browser by calling with |launch_when_next_online| set to false. 36 // browser by calling with |launch_when_next_online| set to false.
34 static void LaunchBrowserWhenNextOnline( 37 static void LaunchBrowserWhenNextOnline(
35 const BackgroundSyncManager* registrant, 38 const content::BackgroundSyncManager* registrant,
36 bool launch_when_next_online); 39 bool launch_when_next_online);
37 40
38 static bool RegisterLauncher(JNIEnv* env); 41 static bool RegisterLauncher(JNIEnv* env);
39 42
40 private: 43 private:
41 friend struct base::DefaultLazyInstanceTraits<BackgroundSyncLauncherAndroid>; 44 friend struct base::DefaultLazyInstanceTraits<BackgroundSyncLauncherAndroid>;
42 45
43 // Constructor and destructor marked private to enforce singleton 46 // Constructor and destructor marked private to enforce singleton
44 BackgroundSyncLauncherAndroid(); 47 BackgroundSyncLauncherAndroid();
45 ~BackgroundSyncLauncherAndroid(); 48 ~BackgroundSyncLauncherAndroid();
46 49
47 void LaunchBrowserWhenNextOnlineImpl(const BackgroundSyncManager* registrant, 50 void LaunchBrowserWhenNextOnlineImpl(
48 bool launch_when_next_online); 51 const content::BackgroundSyncManager* registrant,
52 bool launch_when_next_online);
49 53
50 std::set<const BackgroundSyncManager*> launch_when_next_online_registrants_; 54 std::set<const content::BackgroundSyncManager*>
55 launch_when_next_online_registrants_;
51 base::android::ScopedJavaGlobalRef<jobject> java_launcher_; 56 base::android::ScopedJavaGlobalRef<jobject> java_launcher_;
52 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncLauncherAndroid); 57 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncLauncherAndroid);
53 }; 58 };
54 59
55 } // namespace content 60 } // namespace android
61 } // namespace chrome
56 62
57 #endif // CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_ 63 #endif // CHROME_BROWSER_ANDROID_BACKGROUND_SYNC_LAUNCHER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698