Bug 1022238 - Part 1: Back out bug 1011714. r=margaret

This commit is contained in:
Chenxia Liu 2014-06-10 15:03:46 -07:00
parent 519fd87722
commit 330aca79c6
2 changed files with 26 additions and 0 deletions

View File

@ -416,6 +416,19 @@ abstract public class BrowserApp extends GeckoApp
return values;
}
void handleReaderRemoved(final String url) {
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
BrowserDB.removeReadingListItemWithURL(getContentResolver(), url);
showToast(R.string.page_removed, Toast.LENGTH_SHORT);
final int count = BrowserDB.getReadingListCount(getContentResolver());
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Reader:ListCountUpdated", Integer.toString(count)));
}
});
}
private void handleReaderFaviconRequest(final String url) {
(new UiAsyncTask<Void, Void, String>(ThreadUtils.getBackgroundHandler()) {
@Override
@ -529,6 +542,7 @@ abstract public class BrowserApp extends GeckoApp
"Menu:Add",
"Menu:Remove",
"Reader:ListStatusRequest",
"Reader:Removed",
"Reader:Share",
"Settings:Show",
"Telemetry:Gather",
@ -881,6 +895,7 @@ abstract public class BrowserApp extends GeckoApp
"Menu:Add",
"Menu:Remove",
"Reader:ListStatusRequest",
"Reader:Removed",
"Reader:Share",
"Settings:Show",
"Telemetry:Gather",
@ -1211,6 +1226,10 @@ abstract public class BrowserApp extends GeckoApp
} else if ("Reader:ListStatusRequest".equals(event)) {
handleReaderListStatusRequest(message.getString("url"));
} else if ("Reader:Removed".equals(event)) {
final String url = message.getString("url");
handleReaderRemoved(url);
} else if ("Reader:Share".equals(event)) {
final String title = message.getString("title");
final String url = message.getString("url");

View File

@ -7323,6 +7323,13 @@ let Reader = {
let url = aData;
this.removeArticleFromCache(url, function(success) {
this.log("Reader:Remove success=" + success + ", url=" + url);
if (success) {
sendMessageToJava({
type: "Reader:Removed",
url: url
});
}
}.bind(this));
break;
}