mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 724756 - removeBookmark can remove an arbitrary number of bookmarks. r=lucasr
This commit is contained in:
parent
ae85a7084c
commit
b40c38d30f
@ -76,6 +76,7 @@ import android.widget.Toast;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
import org.mozilla.gecko.db.BrowserContract.Bookmarks;
|
||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
|
||||
@ -472,16 +473,19 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
|
||||
if (mContextMenuSubject == null)
|
||||
return false;
|
||||
|
||||
final int id;
|
||||
final String url;
|
||||
byte[] b = null;
|
||||
String title = "";
|
||||
if (mContextMenuSubject instanceof Cursor) {
|
||||
Cursor cursor = (Cursor)mContextMenuSubject;
|
||||
id = cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks._ID));
|
||||
url = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.URL));
|
||||
b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
|
||||
title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
|
||||
} else if (mContextMenuSubject instanceof Map) {
|
||||
Map map = (Map)mContextMenuSubject;
|
||||
id = -1;
|
||||
url = (String)map.get(URLColumns.URL);
|
||||
b = (byte[]) map.get(URLColumns.FAVICON);
|
||||
title = (String)map.get(URLColumns.TITLE);
|
||||
@ -500,7 +504,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
|
||||
case R.id.remove_bookmark: {
|
||||
GeckoAppShell.getHandler().post(new Runnable() {
|
||||
public void run() {
|
||||
BrowserDB.removeBookmark(mResolver, url);
|
||||
BrowserDB.removeBookmark(mResolver, id);
|
||||
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -552,7 +552,9 @@ public final class Tab {
|
||||
@Override
|
||||
protected Void doInBackground(Void... unused) {
|
||||
ContentResolver resolver = Tabs.getInstance().getContentResolver();
|
||||
BrowserDB.removeBookmark(resolver, getURL());
|
||||
|
||||
// We want to remove all bookmarks with this URL
|
||||
BrowserDB.removeBookmarksWithURL(resolver, getURL());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,11 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
public void removeBookmark(ContentResolver cr, String uri) {
|
||||
public void removeBookmark(ContentResolver cr, int id) {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
public void removeBookmarksWithURL(ContentResolver cr, String uri) {
|
||||
if (Build.VERSION.SDK_INT >= 11)
|
||||
removeBookmarkPost11(cr, uri);
|
||||
else
|
||||
|
@ -88,7 +88,9 @@ public class BrowserDB {
|
||||
|
||||
public void addBookmark(ContentResolver cr, String title, String uri);
|
||||
|
||||
public void removeBookmark(ContentResolver cr, String uri);
|
||||
public void removeBookmark(ContentResolver cr, int id);
|
||||
|
||||
public void removeBookmarksWithURL(ContentResolver cr, String uri);
|
||||
|
||||
public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword);
|
||||
|
||||
@ -167,8 +169,12 @@ public class BrowserDB {
|
||||
sDb.addBookmark(cr, title, uri);
|
||||
}
|
||||
|
||||
public static void removeBookmark(ContentResolver cr, String uri) {
|
||||
sDb.removeBookmark(cr, uri);
|
||||
public static void removeBookmark(ContentResolver cr, int id) {
|
||||
sDb.removeBookmark(cr, id);
|
||||
}
|
||||
|
||||
public static void removeBookmarksWithURL(ContentResolver cr, String uri) {
|
||||
sDb.removeBookmarksWithURL(cr, uri);
|
||||
}
|
||||
|
||||
public static void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
|
||||
|
@ -380,7 +380,13 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
cr.insert(appendProfile(Bookmarks.CONTENT_URI), values);
|
||||
}
|
||||
|
||||
public void removeBookmark(ContentResolver cr, String uri) {
|
||||
public void removeBookmark(ContentResolver cr, int id) {
|
||||
cr.delete(appendProfile(Bookmarks.CONTENT_URI),
|
||||
Bookmarks._ID + " = ?",
|
||||
new String[] { String.valueOf(id) });
|
||||
}
|
||||
|
||||
public void removeBookmarksWithURL(ContentResolver cr, String uri) {
|
||||
cr.delete(appendProfile(Bookmarks.CONTENT_URI),
|
||||
Bookmarks.URL + " = ?",
|
||||
new String[] { uri });
|
||||
|
Loading…
Reference in New Issue
Block a user