OLD | NEW |
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 #include "chrome/browser/android/background_sync_launcher_android.h" | 5 #include "chrome/browser/android/background_sync_launcher_android.h" |
6 | 6 |
7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "jni/BackgroundSyncLauncher_jni.h" | 9 #include "jni/BackgroundSyncLauncher_jni.h" |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int64_t min_delay_ms) { | 42 int64_t min_delay_ms) { |
43 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
44 | 44 |
45 JNIEnv* env = base::android::AttachCurrentThread(); | 45 JNIEnv* env = base::android::AttachCurrentThread(); |
46 Java_BackgroundSyncLauncher_launchBrowserIfStopped( | 46 Java_BackgroundSyncLauncher_launchBrowserIfStopped( |
47 env, java_launcher_.obj(), base::android::GetApplicationContext(), | 47 env, java_launcher_.obj(), base::android::GetApplicationContext(), |
48 launch_when_next_online, min_delay_ms); | 48 launch_when_next_online, min_delay_ms); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
52 bool BackgroundSyncLauncherAndroid::RegisterLauncher(JNIEnv* env) { | |
53 return RegisterNativesImpl(env); | |
54 } | |
55 | |
56 // static | |
57 void BackgroundSyncLauncherAndroid::SetPlayServicesVersionCheckDisabledForTests( | 52 void BackgroundSyncLauncherAndroid::SetPlayServicesVersionCheckDisabledForTests( |
58 bool disabled) { | 53 bool disabled) { |
59 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
60 disable_play_services_version_check_for_tests = disabled; | 55 disable_play_services_version_check_for_tests = disabled; |
61 } | 56 } |
62 | 57 |
63 // static | 58 // static |
64 bool BackgroundSyncLauncherAndroid::ShouldDisableBackgroundSync() { | 59 bool BackgroundSyncLauncherAndroid::ShouldDisableBackgroundSync() { |
65 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 60 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
66 if (disable_play_services_version_check_for_tests) { | 61 if (disable_play_services_version_check_for_tests) { |
(...skipping 11 matching lines...) Expand all Loading... |
78 java_launcher_.Reset(Java_BackgroundSyncLauncher_create( | 73 java_launcher_.Reset(Java_BackgroundSyncLauncher_create( |
79 env, base::android::GetApplicationContext())); | 74 env, base::android::GetApplicationContext())); |
80 } | 75 } |
81 | 76 |
82 BackgroundSyncLauncherAndroid::~BackgroundSyncLauncherAndroid() { | 77 BackgroundSyncLauncherAndroid::~BackgroundSyncLauncherAndroid() { |
83 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 78 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
84 | 79 |
85 JNIEnv* env = base::android::AttachCurrentThread(); | 80 JNIEnv* env = base::android::AttachCurrentThread(); |
86 Java_BackgroundSyncLauncher_destroy(env, java_launcher_.obj()); | 81 Java_BackgroundSyncLauncher_destroy(env, java_launcher_.obj()); |
87 } | 82 } |
OLD | NEW |