Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5537)

Unified Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 2838773002: Move offline related functions from Tab to OfflinePageUtils (Closed)
Patch Set: Fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | chrome/browser/android/tab_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/offline_page_bridge.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc
index 9819635723b790805470614278d46decaf04874a..6f1dbe74178e251aeabe8927b405d2e0b4fdcf41 100644
--- a/chrome/browser/android/offline_pages/offline_page_bridge.cc
+++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc
@@ -631,6 +631,30 @@ void OfflinePageBridge::ScheduleDownload(
static_cast<OfflinePageUtils::DownloadUIActionFlags>(ui_action));
}
+jboolean OfflinePageBridge::IsOfflinePage(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& j_web_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(j_web_contents);
+ return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents(
+ web_contents) != nullptr;
+}
+
+ScopedJavaLocalRef<jobject> OfflinePageBridge::GetOfflinePage(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& j_web_contents) {
+ const offline_pages::OfflinePageItem* offline_page =
+ offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents(
+ content::WebContents::FromJavaWebContents(j_web_contents));
+ if (!offline_page)
+ return ScopedJavaLocalRef<jobject>();
+
+ return offline_pages::android::OfflinePageBridge::ConvertToJavaOfflinePage(
+ env, *offline_page);
+}
+
void OfflinePageBridge::NotifyIfDoneLoading() const {
if (!offline_page_model_->is_loaded())
return;
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | chrome/browser/android/tab_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698