| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 JNIEnv* env = base::android::AttachCurrentThread(); | 813 JNIEnv* env = base::android::AttachCurrentThread(); |
| 814 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env)); | 814 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env)); |
| 815 } | 815 } |
| 816 | 816 |
| 817 jboolean TabAndroid::IsOfflinePage(JNIEnv* env, | 817 jboolean TabAndroid::IsOfflinePage(JNIEnv* env, |
| 818 const JavaParamRef<jobject>& obj) { | 818 const JavaParamRef<jobject>& obj) { |
| 819 return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( | 819 return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( |
| 820 web_contents()) != nullptr; | 820 web_contents()) != nullptr; |
| 821 } | 821 } |
| 822 | 822 |
| 823 jboolean TabAndroid::IsShowingOfflinePreview(JNIEnv* env, |
| 824 const JavaParamRef<jobject>& obj) { |
| 825 return offline_pages::OfflinePageUtils::IsShowingOfflinePreview( |
| 826 web_contents()); |
| 827 } |
| 828 |
| 823 ScopedJavaLocalRef<jobject> TabAndroid::GetOfflinePage( | 829 ScopedJavaLocalRef<jobject> TabAndroid::GetOfflinePage( |
| 824 JNIEnv* env, | 830 JNIEnv* env, |
| 825 const JavaParamRef<jobject>& obj) { | 831 const JavaParamRef<jobject>& obj) { |
| 826 const offline_pages::OfflinePageItem* offline_page = | 832 const offline_pages::OfflinePageItem* offline_page = |
| 827 offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( | 833 offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( |
| 828 web_contents()); | 834 web_contents()); |
| 829 if (!offline_page) | 835 if (!offline_page) |
| 830 return ScopedJavaLocalRef<jobject>(); | 836 return ScopedJavaLocalRef<jobject>(); |
| 831 | 837 |
| 832 return offline_pages::android::OfflinePageBridge::ConvertToJavaOfflinePage( | 838 return offline_pages::android::OfflinePageBridge::ConvertToJavaOfflinePage( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 921 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 916 TRACE_EVENT0("native", "TabAndroid::Init"); | 922 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 917 // This will automatically bind to the Java object and pass ownership there. | 923 // This will automatically bind to the Java object and pass ownership there. |
| 918 new TabAndroid(env, obj); | 924 new TabAndroid(env, obj); |
| 919 } | 925 } |
| 920 | 926 |
| 921 // static | 927 // static |
| 922 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 928 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 923 return RegisterNativesImpl(env); | 929 return RegisterNativesImpl(env); |
| 924 } | 930 } |
| OLD | NEW |