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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 2462653002: Showing previews UI for Offline Previews (Closed)
Patch Set: fgorski comment Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // reload request in order to keep the consistent behavior if we do decide to 494 // reload request in order to keep the consistent behavior if we do decide to
495 // load the offline page. For example, "id" field should be kept in order to 495 // load the offline page. For example, "id" field should be kept in order to
496 // load the same offline version again if desired. 496 // load the same offline version again if desired.
497 offline_pages::OfflinePageHeader offline_header_for_reload = *offline_header; 497 offline_pages::OfflinePageHeader offline_header_for_reload = *offline_header;
498 offline_header_for_reload.reason = 498 offline_header_for_reload.reason =
499 offline_pages::OfflinePageHeader::Reason::RELOAD; 499 offline_pages::OfflinePageHeader::Reason::RELOAD;
500 return ScopedJavaLocalRef<jstring>(ConvertUTF8ToJavaString( 500 return ScopedJavaLocalRef<jstring>(ConvertUTF8ToJavaString(
501 env, offline_header_for_reload.GetCompleteHeaderString())); 501 env, offline_header_for_reload.GetCompleteHeaderString()));
502 } 502 }
503 503
504 jboolean OfflinePageBridge::IsShowingOfflinePreview(
505 JNIEnv* env,
506 const base::android::JavaParamRef<jobject>& obj,
507 const JavaParamRef<jobject>& j_web_contents) {
508 content::WebContents* web_contents =
509 content::WebContents::FromJavaWebContents(j_web_contents);
510 if (!web_contents)
511 return false;
512 return offline_pages::OfflinePageUtils::IsShowingOfflinePreview(web_contents);
513 }
514
504 void OfflinePageBridge::GetRequestsInQueue( 515 void OfflinePageBridge::GetRequestsInQueue(
505 JNIEnv* env, 516 JNIEnv* env,
506 const JavaParamRef<jobject>& obj, 517 const JavaParamRef<jobject>& obj,
507 const JavaParamRef<jobject>& j_callback_obj) { 518 const JavaParamRef<jobject>& j_callback_obj) {
508 ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj); 519 ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj);
509 520
510 RequestCoordinator* coordinator = 521 RequestCoordinator* coordinator =
511 offline_pages::RequestCoordinatorFactory::GetInstance() 522 offline_pages::RequestCoordinatorFactory::GetInstance()
512 ->GetForBrowserContext(browser_context_); 523 ->GetForBrowserContext(browser_context_);
513 524
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 env, ConvertUTF8ToJavaString(env, client_id.name_space), 573 env, ConvertUTF8ToJavaString(env, client_id.name_space),
563 ConvertUTF8ToJavaString(env, client_id.id)); 574 ConvertUTF8ToJavaString(env, client_id.id));
564 } 575 }
565 576
566 bool RegisterOfflinePageBridge(JNIEnv* env) { 577 bool RegisterOfflinePageBridge(JNIEnv* env) {
567 return RegisterNativesImpl(env); 578 return RegisterNativesImpl(env);
568 } 579 }
569 580
570 } // namespace android 581 } // namespace android
571 } // namespace offline_pages 582 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698