Bug 965453 - Add submenu for bookmarks. r=wesj

This commit is contained in:
Brian Nicholson
2014-02-20 21:27:04 -08:00
parent 66a4633a25
commit a8dc4c0198
10 changed files with 191 additions and 112 deletions

View File

@@ -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);
}
}