OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp/ntp_snippets_launcher.h" | 5 #include "chrome/browser/android/ntp/ntp_snippets_launcher.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/SnippetsLauncher_jni.h" | 9 #include "jni/SnippetsLauncher_jni.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 period_fallback.InSeconds()); | 33 period_fallback.InSeconds()); |
34 } | 34 } |
35 | 35 |
36 bool NTPSnippetsLauncher::Unschedule() { | 36 bool NTPSnippetsLauncher::Unschedule() { |
37 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 37 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
38 | 38 |
39 JNIEnv* env = base::android::AttachCurrentThread(); | 39 JNIEnv* env = base::android::AttachCurrentThread(); |
40 return Java_SnippetsLauncher_unschedule(env, java_launcher_); | 40 return Java_SnippetsLauncher_unschedule(env, java_launcher_); |
41 } | 41 } |
42 | 42 |
| 43 bool NTPSnippetsLauncher::IsOnUnmeteredConnection() { |
| 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 45 |
| 46 JNIEnv* env = base::android::AttachCurrentThread(); |
| 47 return Java_SnippetsLauncher_isOnUnmeteredConnection(env, java_launcher_); |
| 48 } |
| 49 |
43 NTPSnippetsLauncher::NTPSnippetsLauncher() { | 50 NTPSnippetsLauncher::NTPSnippetsLauncher() { |
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 51 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
45 | 52 |
46 JNIEnv* env = base::android::AttachCurrentThread(); | 53 JNIEnv* env = base::android::AttachCurrentThread(); |
47 java_launcher_.Reset(Java_SnippetsLauncher_create( | 54 java_launcher_.Reset(Java_SnippetsLauncher_create( |
48 env, base::android::GetApplicationContext())); | 55 env, base::android::GetApplicationContext())); |
49 } | 56 } |
50 | 57 |
51 NTPSnippetsLauncher::~NTPSnippetsLauncher() { | 58 NTPSnippetsLauncher::~NTPSnippetsLauncher() { |
52 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 59 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
53 | 60 |
54 JNIEnv* env = base::android::AttachCurrentThread(); | 61 JNIEnv* env = base::android::AttachCurrentThread(); |
55 Java_SnippetsLauncher_destroy(env, java_launcher_); | 62 Java_SnippetsLauncher_destroy(env, java_launcher_); |
56 java_launcher_.Reset(); | 63 java_launcher_.Reset(); |
57 } | 64 } |
OLD | NEW |