зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1377295 - Use old Top Sites pinned sites in AS panel. r=mcomella
MozReview-Commit-ID: 6i3Cam8un45 --HG-- extra : rebase_source : 12dcbc18f7d41110b54cc79e2e1357fa906e0309
This commit is contained in:
Родитель
bd2aad8d07
Коммит
b743cc4898
|
@ -964,19 +964,15 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
|
|||
}
|
||||
|
||||
// We have two types of pinned sites, positioned and non-positioned. Positioned pins are used
|
||||
// by regular Top Sites, where position in the grid is of importance. Non-positioned pins are
|
||||
// used by Activity Stream Top Sites, where pins are displayed in front of other top site items.
|
||||
// Non-positioned pins all have the same special position value which is used to identify them.
|
||||
// An alternative to this is creating a separate special folder for non-positioned pins, introducing
|
||||
// a database migration, adjusting sync code, etc. While on some level this might
|
||||
// be a cleaner solution, a "position hack" is simpler to implement and manage over time in light
|
||||
// of A-S being either a likely replacement for regular Top Sites, or being scrapped.
|
||||
// by regular Top Sites, where position in the grid is of importance.
|
||||
// Activity Stream Top Sites pins are displayed in front of other top site items - they inherit
|
||||
// the Top Sites positioned pins, and new pins are created as non-positioned.
|
||||
// Since we will be permanently moving to Activity Stream, if a pin is modified in Activity Stream, it is
|
||||
// lost from (legacy) Top Sites.
|
||||
String pinnedSitesFromClause = "FROM " + TABLE_BOOKMARKS + " WHERE " +
|
||||
Bookmarks.PARENT + " = " + Bookmarks.FIXED_PINNED_LIST_ID +
|
||||
" AND " + Bookmarks.IS_DELETED + " IS NOT 1";
|
||||
if (nonPositionedPins != null) {
|
||||
pinnedSitesFromClause += " AND " + Bookmarks.POSITION + " = " + Bookmarks.FIXED_AS_PIN_POSITION;
|
||||
} else {
|
||||
if (nonPositionedPins == null) {
|
||||
pinnedSitesFromClause += " AND " + Bookmarks.POSITION + " != " + Bookmarks.FIXED_AS_PIN_POSITION;
|
||||
}
|
||||
|
||||
|
|
|
@ -1747,11 +1747,9 @@ public class LocalBrowserDB extends BrowserDB {
|
|||
public void unpinSiteForAS(ContentResolver cr, String url) {
|
||||
cr.delete(mBookmarksUriWithProfile,
|
||||
Bookmarks.PARENT + " == ? AND " +
|
||||
Bookmarks.POSITION + " == ? AND " +
|
||||
Bookmarks.URL + " = ?",
|
||||
new String[] {
|
||||
String.valueOf(Bookmarks.FIXED_PINNED_LIST_ID),
|
||||
String.valueOf(Bookmarks.FIXED_AS_PIN_POSITION),
|
||||
url
|
||||
});
|
||||
}
|
||||
|
@ -1760,11 +1758,10 @@ public class LocalBrowserDB extends BrowserDB {
|
|||
public boolean isPinnedForAS(ContentResolver cr, String url) {
|
||||
final Cursor c = cr.query(bookmarksUriWithLimit(1),
|
||||
new String[] { Bookmarks._ID },
|
||||
Bookmarks.URL + " = ? AND " + Bookmarks.PARENT + " = ? AND " + Bookmarks.POSITION + " = ?",
|
||||
Bookmarks.URL + " = ? AND " + Bookmarks.PARENT + " = ?",
|
||||
new String[] {
|
||||
url,
|
||||
String.valueOf(Bookmarks.FIXED_PINNED_LIST_ID),
|
||||
String.valueOf(Bookmarks.FIXED_AS_PIN_POSITION)
|
||||
}, null);
|
||||
|
||||
if (c == null) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче