OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/offline_pages/offline_page_bridge.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_bridge.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 JNIEnv* env, | 503 JNIEnv* env, |
504 const base::android::JavaParamRef<jobject>& obj, | 504 const base::android::JavaParamRef<jobject>& obj, |
505 const JavaParamRef<jobject>& j_web_contents) { | 505 const JavaParamRef<jobject>& j_web_contents) { |
506 content::WebContents* web_contents = | 506 content::WebContents* web_contents = |
507 content::WebContents::FromJavaWebContents(j_web_contents); | 507 content::WebContents::FromJavaWebContents(j_web_contents); |
508 if (!web_contents) | 508 if (!web_contents) |
509 return false; | 509 return false; |
510 return offline_pages::OfflinePageUtils::IsShowingOfflinePreview(web_contents); | 510 return offline_pages::OfflinePageUtils::IsShowingOfflinePreview(web_contents); |
511 } | 511 } |
512 | 512 |
| 513 jboolean OfflinePageBridge::IsShowingDownloadButtonInErrorPage( |
| 514 JNIEnv* env, |
| 515 const base::android::JavaParamRef<jobject>& obj, |
| 516 const JavaParamRef<jobject>& j_web_contents) { |
| 517 content::WebContents* web_contents = |
| 518 content::WebContents::FromJavaWebContents(j_web_contents); |
| 519 if (!web_contents) |
| 520 return false; |
| 521 return offline_pages::OfflinePageUtils::IsShowingDownloadButtonInErrorPage( |
| 522 web_contents); |
| 523 } |
| 524 |
513 void OfflinePageBridge::GetRequestsInQueue( | 525 void OfflinePageBridge::GetRequestsInQueue( |
514 JNIEnv* env, | 526 JNIEnv* env, |
515 const JavaParamRef<jobject>& obj, | 527 const JavaParamRef<jobject>& obj, |
516 const JavaParamRef<jobject>& j_callback_obj) { | 528 const JavaParamRef<jobject>& j_callback_obj) { |
517 ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj); | 529 ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj); |
518 | 530 |
519 RequestCoordinator* coordinator = | 531 RequestCoordinator* coordinator = |
520 offline_pages::RequestCoordinatorFactory::GetInstance() | 532 offline_pages::RequestCoordinatorFactory::GetInstance() |
521 ->GetForBrowserContext(browser_context_); | 533 ->GetForBrowserContext(browser_context_); |
522 | 534 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 env, ConvertUTF8ToJavaString(env, client_id.name_space), | 583 env, ConvertUTF8ToJavaString(env, client_id.name_space), |
572 ConvertUTF8ToJavaString(env, client_id.id)); | 584 ConvertUTF8ToJavaString(env, client_id.id)); |
573 } | 585 } |
574 | 586 |
575 bool RegisterOfflinePageBridge(JNIEnv* env) { | 587 bool RegisterOfflinePageBridge(JNIEnv* env) { |
576 return RegisterNativesImpl(env); | 588 return RegisterNativesImpl(env); |
577 } | 589 } |
578 | 590 |
579 } // namespace android | 591 } // namespace android |
580 } // namespace offline_pages | 592 } // namespace offline_pages |
OLD | NEW |