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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 1750113002: Remove "Show saved copy" button from error page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/net/net_error_tab_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_array.h" 10 #include "base/android/jni_array.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 const JavaParamRef<jobject>& obj) { 746 const JavaParamRef<jobject>& obj) {
747 content::RenderFrameHost* render_frame_host = 747 content::RenderFrameHost* render_frame_host =
748 web_contents()->GetFocusedFrame(); 748 web_contents()->GetFocusedFrame();
749 render_frame_host->Send(new ChromeViewMsg_RequestReloadImageForContextNode( 749 render_frame_host->Send(new ChromeViewMsg_RequestReloadImageForContextNode(
750 render_frame_host->GetRoutingID())); 750 render_frame_host->GetRoutingID()));
751 } 751 }
752 752
753 jlong TabAndroid::GetBookmarkId(JNIEnv* env, 753 jlong TabAndroid::GetBookmarkId(JNIEnv* env,
754 const JavaParamRef<jobject>& obj, 754 const JavaParamRef<jobject>& obj,
755 jboolean only_editable) { 755 jboolean only_editable) {
756 return GetBookmarkIdHelper(only_editable);
757 }
758
759 int64_t TabAndroid::GetBookmarkIdHelper(bool only_editable) const {
760 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl( 756 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(
761 web_contents()->GetURL()); 757 web_contents()->GetURL());
762 Profile* profile = GetProfile(); 758 Profile* profile = GetProfile();
763 759
764 // If the url points to an offline page, it already has a bookmark ID that it 760 // If the url points to an offline page, it already has a bookmark ID that it
765 // is related to. 761 // is related to.
766 int64_t candidate_bookmark_id = 762 int64_t candidate_bookmark_id =
767 offline_pages::OfflinePageUtils::GetBookmarkIdForOfflineURL(profile, url); 763 offline_pages::OfflinePageUtils::GetBookmarkIdForOfflineURL(profile, url);
768 764
769 // Get all the nodes for |url| and sort them by date added. 765 // Get all the nodes for |url| and sort them by date added.
(...skipping 25 matching lines...) Expand all
795 791
796 bool TabAndroid::HasOfflinePages() const { 792 bool TabAndroid::HasOfflinePages() const {
797 return offline_pages::OfflinePageUtils::HasOfflinePages(GetProfile()); 793 return offline_pages::OfflinePageUtils::HasOfflinePages(GetProfile());
798 } 794 }
799 795
800 void TabAndroid::ShowOfflinePages() { 796 void TabAndroid::ShowOfflinePages() {
801 JNIEnv* env = base::android::AttachCurrentThread(); 797 JNIEnv* env = base::android::AttachCurrentThread();
802 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env).obj()); 798 Java_Tab_showOfflinePages(env, weak_java_tab_.get(env).obj());
803 } 799 }
804 800
805 void TabAndroid::LoadOfflineCopy(const GURL& url) {
806 GURL offline_url = offline_pages::OfflinePageUtils::GetOfflineURLForOnlineURL(
807 GetProfile(), url);
808 if (!offline_url.is_valid())
809 return;
810
811 content::NavigationController::LoadURLParams load_params(offline_url);
812 web_contents()->GetController().LoadURLWithParams(load_params);
813 }
814
815 void TabAndroid::OnLoFiResponseReceived(bool is_preview) { 801 void TabAndroid::OnLoFiResponseReceived(bool is_preview) {
816 JNIEnv* env = base::android::AttachCurrentThread(); 802 JNIEnv* env = base::android::AttachCurrentThread();
817 Java_Tab_onLoFiResponseReceived(env, weak_java_tab_.get(env).obj(), 803 Java_Tab_onLoFiResponseReceived(env, weak_java_tab_.get(env).obj(),
818 is_preview); 804 is_preview);
819 } 805 }
820 806
821 jboolean TabAndroid::HasOfflineCopy(JNIEnv* env, 807 jboolean TabAndroid::HasOfflineCopy(JNIEnv* env,
822 const JavaParamRef<jobject>& obj) { 808 const JavaParamRef<jobject>& obj) {
823 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl( 809 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(
824 web_contents()->GetURL()); 810 web_contents()->GetURL());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 916 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
931 TRACE_EVENT0("native", "TabAndroid::Init"); 917 TRACE_EVENT0("native", "TabAndroid::Init");
932 // This will automatically bind to the Java object and pass ownership there. 918 // This will automatically bind to the Java object and pass ownership there.
933 new TabAndroid(env, obj); 919 new TabAndroid(env, obj);
934 } 920 }
935 921
936 // static 922 // static
937 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 923 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
938 return RegisterNativesImpl(env); 924 return RegisterNativesImpl(env);
939 } 925 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/net/net_error_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698