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

Unified Diff: chrome/browser/android/tab_android.cc

Issue 1973033002: [Offline pages] Lighting up the bookmark star for saved recent pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/tab_android.cc
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc
index f9464507dd05085f9cfdda0cbd7f886914497b1d..533528fc4cc7baac2aacc91704b2207edcc643a2 100644
--- a/chrome/browser/android/tab_android.cc
+++ b/chrome/browser/android/tab_android.cc
@@ -761,10 +761,11 @@ jlong TabAndroid::GetBookmarkId(JNIEnv* env,
web_contents()->GetURL());
Profile* profile = GetProfile();
- // If the url points to an offline page, it already has a bookmark ID that it
- // is related to.
- int64_t candidate_bookmark_id =
- offline_pages::OfflinePageUtils::GetBookmarkIdForOfflineURL(profile, url);
+ // If the url points to an offline page, then we need to get its original URL.
+ if (offline_pages::OfflinePageUtils::IsOfflinePage(profile, url)) {
+ url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL(profile,
+ url);
+ }
// Get all the nodes for |url| and sort them by date added.
std::vector<const bookmarks::BookmarkNode*> nodes;
@@ -773,13 +774,6 @@ jlong TabAndroid::GetBookmarkId(JNIEnv* env,
bookmarks::BookmarkModel* model =
BookmarkModelFactory::GetForProfile(profile);
- // If we have a candidate bookmark ID from the offline page model and that ID
- // matches an existing bookmark, return it.
- if (candidate_bookmark_id != -1 &&
- bookmarks::GetBookmarkNodeByID(model, candidate_bookmark_id) != nullptr) {
- return candidate_bookmark_id;
- }
-
model->GetNodesByURL(url, &nodes);
std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698