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 "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "jni/SnippetsLauncher_jni.h" | 8 #include "jni/SnippetsLauncher_jni.h" |
9 | 9 |
10 using content::BrowserThread; | 10 using content::BrowserThread; |
(...skipping 21 matching lines...) Expand all Loading... |
32 period_fallback.InSeconds()); | 32 period_fallback.InSeconds()); |
33 } | 33 } |
34 | 34 |
35 bool NTPSnippetsLauncher::Unschedule() { | 35 bool NTPSnippetsLauncher::Unschedule() { |
36 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 36 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
37 | 37 |
38 JNIEnv* env = base::android::AttachCurrentThread(); | 38 JNIEnv* env = base::android::AttachCurrentThread(); |
39 return Java_SnippetsLauncher_unschedule(env, java_launcher_); | 39 return Java_SnippetsLauncher_unschedule(env, java_launcher_); |
40 } | 40 } |
41 | 41 |
| 42 bool NTPSnippetsLauncher::IsOnUnmeteredConnection() { |
| 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 44 |
| 45 JNIEnv* env = base::android::AttachCurrentThread(); |
| 46 return Java_SnippetsLauncher_isOnUnmeteredConnection(env, java_launcher_); |
| 47 } |
| 48 |
42 NTPSnippetsLauncher::NTPSnippetsLauncher() { | 49 NTPSnippetsLauncher::NTPSnippetsLauncher() { |
43 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 50 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
44 | 51 |
45 JNIEnv* env = base::android::AttachCurrentThread(); | 52 JNIEnv* env = base::android::AttachCurrentThread(); |
46 java_launcher_.Reset(Java_SnippetsLauncher_create(env)); | 53 java_launcher_.Reset(Java_SnippetsLauncher_create(env)); |
47 } | 54 } |
48 | 55 |
49 NTPSnippetsLauncher::~NTPSnippetsLauncher() { | 56 NTPSnippetsLauncher::~NTPSnippetsLauncher() { |
50 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 57 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
51 | 58 |
52 JNIEnv* env = base::android::AttachCurrentThread(); | 59 JNIEnv* env = base::android::AttachCurrentThread(); |
53 Java_SnippetsLauncher_destroy(env, java_launcher_); | 60 Java_SnippetsLauncher_destroy(env, java_launcher_); |
54 java_launcher_.Reset(); | 61 java_launcher_.Reset(); |
55 } | 62 } |
OLD | NEW |