Bug 1064246: Remove dead functions from LocalBrowserDB. r=rnewman

This commit is contained in:
Chris Kitching 2014-09-08 06:15:20 -07:00
parent 9e11942063
commit 6778c4e63e

View File

@ -58,7 +58,7 @@ public class LocalBrowserDB {
// Calculate these once, at initialization. isLoggable is too expensive to
// have in-line in each log call.
private static final String LOGTAG = "GeckoLocalBrowserDB";
private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
protected static void debug(String message) {
if (logDebug) {
Log.d(LOGTAG, message);
@ -449,11 +449,6 @@ public class LocalBrowserDB {
mDesktopBookmarksExist = null;
}
private Uri historyUriWithLimit(int limit) {
return mHistoryUriWithProfile.buildUpon().appendQueryParameter(BrowserContract.PARAM_LIMIT,
String.valueOf(limit)).build();
}
private Uri bookmarksUriWithLimit(int limit) {
return mBookmarksUriWithProfile.buildUpon().appendQueryParameter(BrowserContract.PARAM_LIMIT,
String.valueOf(limit)).build();
@ -486,11 +481,6 @@ public class LocalBrowserDB {
return uriBuilder.build();
}
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
int limit, CharSequence urlFilter) {
return filterAllSites(cr, projection, constraint, limit, urlFilter, "", null);
}
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
int limit, CharSequence urlFilter, String selection, String[] selectionArgs) {
// The combined history/bookmarks selection queries for sites with a url or title containing
@ -639,38 +629,6 @@ public class LocalBrowserDB {
new String[] { uri });
}
public void updateHistoryEntry(ContentResolver cr, String uri, String title,
long date, int visits) {
int oldVisits = 0;
Cursor cursor = null;
try {
cursor = cr.query(mHistoryUriWithProfile,
new String[] { History.VISITS },
History.URL + " = ?",
new String[] { uri },
null);
if (cursor.moveToFirst()) {
oldVisits = cursor.getInt(0);
}
} finally {
if (cursor != null)
cursor.close();
}
ContentValues values = new ContentValues();
values.put(History.DATE_LAST_VISITED, date);
values.put(History.VISITS, oldVisits + visits);
if (title != null) {
values.put(History.TITLE, title);
}
cr.update(mHistoryUriWithProfile,
values,
History.URL + " = ?",
new String[] { uri });
}
@RobocopTarget
public Cursor getAllVisitedHistory(ContentResolver cr) {
return cr.query(mHistoryUriWithProfile,
@ -700,12 +658,6 @@ public class LocalBrowserDB {
cr.delete(url, null, null);
}
public void removeHistoryEntry(ContentResolver cr, int id) {
cr.delete(mHistoryUriWithProfile,
History._ID + " = ?",
new String[] { String.valueOf(id) });
}
@RobocopTarget
public void removeHistoryEntry(ContentResolver cr, String url) {
cr.delete(mHistoryUriWithProfile,
@ -807,22 +759,6 @@ public class LocalBrowserDB {
return mDesktopBookmarksExist;
}
public int getReadingListCount(ContentResolver cr) {
Cursor c = null;
try {
c = cr.query(mReadingListUriWithProfile,
new String[] { ReadingListItems._ID },
null,
null,
null);
return c.getCount();
} finally {
if (c != null) {
c.close();
}
}
}
@RobocopTarget
public boolean isBookmark(ContentResolver cr, String uri) {
Cursor c = null;
@ -1008,18 +944,6 @@ public class LocalBrowserDB {
addBookmarkItem(cr, title, uri, folderId);
}
public void removeBookmark(ContentResolver cr, int id) {
Uri contentUri = mBookmarksUriWithProfile;
// Do this now so that the item still exists!
final String idString = String.valueOf(id);
bumpParents(cr, Bookmarks._ID, idString);
final String[] idArgs = new String[] { idString };
final String idEquals = Bookmarks._ID + " = ?";
cr.delete(contentUri, idEquals, idArgs);
}
@RobocopTarget
public void removeBookmarksWithURL(ContentResolver cr, String uri) {
Uri contentUri = mBookmarksUriWithProfile;
@ -1062,18 +986,10 @@ public class LocalBrowserDB {
cr.delete(mReadingListUriWithProfile, ReadingListItems.URL + " = ? ", new String[] { uri });
}
public void removeReadingListItem(ContentResolver cr, int id) {
cr.delete(mReadingListUriWithProfile, ReadingListItems._ID + " = ? ", new String[] { String.valueOf(id) });
}
public void registerBookmarkObserver(ContentResolver cr, ContentObserver observer) {
cr.registerContentObserver(mBookmarksUriWithProfile, false, observer);
}
public void registerHistoryObserver(ContentResolver cr, ContentObserver observer) {
cr.registerContentObserver(mHistoryUriWithProfile, false, observer);
}
@RobocopTarget
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
ContentValues values = new ContentValues();
@ -1523,35 +1439,6 @@ public class LocalBrowserDB {
});
}
public void unpinAllSites(ContentResolver cr) {
cr.delete(mBookmarksUriWithProfile,
Bookmarks.PARENT + " == ?",
new String[] {
String.valueOf(Bookmarks.FIXED_PINNED_LIST_ID)
});
}
public boolean isVisited(ContentResolver cr, String uri) {
int count = 0;
Cursor c = null;
try {
c = cr.query(historyUriWithLimit(1),
new String[] { History._ID },
History.URL + " = ?",
new String[] { uri },
History.URL);
count = c.getCount();
} catch (NullPointerException e) {
Log.e(LOGTAG, "NullPointerException in isVisited");
} finally {
if (c != null)
c.close();
}
return (count > 0);
}
@RobocopTarget
public Cursor getBookmarkForUrl(ContentResolver cr, String url) {
Cursor c = cr.query(bookmarksUriWithLimit(1),