Bug 965453 - Add submenu for bookmarks. r=wesj
This commit is contained in:
@@ -4,9 +4,12 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
public class ReaderModeUtils {
|
||||
private static final String LOGTAG = "ReaderModeUtils";
|
||||
@@ -45,4 +48,30 @@ public class ReaderModeUtils {
|
||||
|
||||
return aboutReaderUrl;
|
||||
}
|
||||
|
||||
public static void addToReadingList(Tab tab) {
|
||||
if (!tab.getReaderEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
try {
|
||||
json.put("tabID", String.valueOf(tab.getId()));
|
||||
} catch (JSONException e) {
|
||||
Log.e(LOGTAG, "JSON error - failing to add to reading list", e);
|
||||
return;
|
||||
}
|
||||
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Add", json.toString());
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
}
|
||||
|
||||
public static void removeFromReadingList(String url) {
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Remove", url);
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user