| 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 JNIEnv* env = base::android::AttachCurrentThread(); | 807 JNIEnv* env = base::android::AttachCurrentThread(); |
| 808 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env)); | 808 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env)); |
| 809 } | 809 } |
| 810 | 810 |
| 811 jboolean TabAndroid::IsOfflinePage(JNIEnv* env, | 811 jboolean TabAndroid::IsOfflinePage(JNIEnv* env, |
| 812 const JavaParamRef<jobject>& obj) { | 812 const JavaParamRef<jobject>& obj) { |
| 813 return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( | 813 return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( |
| 814 web_contents()) != nullptr; | 814 web_contents()) != nullptr; |
| 815 } | 815 } |
| 816 | 816 |
| 817 jboolean TabAndroid::IsShowingOfflinePreview(JNIEnv* env, |
| 818 const JavaParamRef<jobject>& obj) { |
| 819 return offline_pages::OfflinePageUtils::IsShowingOfflinePreview( |
| 820 web_contents()); |
| 821 } |
| 822 |
| 817 ScopedJavaLocalRef<jobject> TabAndroid::GetOfflinePage( | 823 ScopedJavaLocalRef<jobject> TabAndroid::GetOfflinePage( |
| 818 JNIEnv* env, | 824 JNIEnv* env, |
| 819 const JavaParamRef<jobject>& obj) { | 825 const JavaParamRef<jobject>& obj) { |
| 820 const offline_pages::OfflinePageItem* offline_page = | 826 const offline_pages::OfflinePageItem* offline_page = |
| 821 offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( | 827 offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents( |
| 822 web_contents()); | 828 web_contents()); |
| 823 if (!offline_page) | 829 if (!offline_page) |
| 824 return ScopedJavaLocalRef<jobject>(); | 830 return ScopedJavaLocalRef<jobject>(); |
| 825 | 831 |
| 826 return offline_pages::android::OfflinePageBridge::ConvertToJavaOfflinePage( | 832 return offline_pages::android::OfflinePageBridge::ConvertToJavaOfflinePage( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 888 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 883 TRACE_EVENT0("native", "TabAndroid::Init"); | 889 TRACE_EVENT0("native", "TabAndroid::Init"); |
| 884 // This will automatically bind to the Java object and pass ownership there. | 890 // This will automatically bind to the Java object and pass ownership there. |
| 885 new TabAndroid(env, obj); | 891 new TabAndroid(env, obj); |
| 886 } | 892 } |
| 887 | 893 |
| 888 // static | 894 // static |
| 889 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 895 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 890 return RegisterNativesImpl(env); | 896 return RegisterNativesImpl(env); |
| 891 } | 897 } |
| OLD | NEW |