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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Fix trybot Created 4 years, 3 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
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_string.h" 10 #include "base/android/jni_string.h"
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 render_frame_host->GetRoutingID())); 754 render_frame_host->GetRoutingID()));
755 } 755 }
756 756
757 jlong TabAndroid::GetBookmarkId(JNIEnv* env, 757 jlong TabAndroid::GetBookmarkId(JNIEnv* env,
758 const JavaParamRef<jobject>& obj, 758 const JavaParamRef<jobject>& obj,
759 jboolean only_editable) { 759 jboolean only_editable) {
760 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl( 760 GURL url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(
761 web_contents()->GetURL()); 761 web_contents()->GetURL());
762 Profile* profile = GetProfile(); 762 Profile* profile = GetProfile();
763 763
764 // If the url points to an offline page, then we need to get its original URL.
765 if (offline_pages::OfflinePageUtils::IsOfflinePage(profile, url)) {
766 url = offline_pages::OfflinePageUtils::MaybeGetOnlineURLForOfflineURL(
767 profile, url);
768 }
769
770 // Get all the nodes for |url| and sort them by date added. 764 // Get all the nodes for |url| and sort them by date added.
771 std::vector<const bookmarks::BookmarkNode*> nodes; 765 std::vector<const bookmarks::BookmarkNode*> nodes;
772 bookmarks::ManagedBookmarkService* managed = 766 bookmarks::ManagedBookmarkService* managed =
773 ManagedBookmarkServiceFactory::GetForProfile(profile); 767 ManagedBookmarkServiceFactory::GetForProfile(profile);
774 bookmarks::BookmarkModel* model = 768 bookmarks::BookmarkModel* model =
775 BookmarkModelFactory::GetForBrowserContext(profile); 769 BookmarkModelFactory::GetForBrowserContext(profile);
776 770
777 model->GetNodesByURL(url, &nodes); 771 model->GetNodesByURL(url, &nodes);
778 std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded); 772 std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded);
779 773
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 892 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
899 TRACE_EVENT0("native", "TabAndroid::Init"); 893 TRACE_EVENT0("native", "TabAndroid::Init");
900 // This will automatically bind to the Java object and pass ownership there. 894 // This will automatically bind to the Java object and pass ownership there.
901 new TabAndroid(env, obj); 895 new TabAndroid(env, obj);
902 } 896 }
903 897
904 // static 898 // static
905 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 899 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
906 return RegisterNativesImpl(env); 900 return RegisterNativesImpl(env);
907 } 901 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698