Bug 1011714 - Clean up removal of Reading List items. r=liuche
authorAlex Deaconu <alexandru.deaconu@ebsromania.ro>
Mon, 02 Jun 2014 10:22:28 +0300
changeset 198723 4c3e918570c0baaa1c92cfabb1c2a1f1592872cb
parent 198722 5d9621220437aecf2155f88a847e0ff1fff74e49
child 198724 6042fe5242058f5484fd6ce2e42ec0d445837e26
push id5990
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:40:24 +0000
treeherdermozilla-aurora@0796197efbc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1011714
milestone32.0a1
Bug 1011714 - Clean up removal of Reading List items. r=liuche
mobile/android/base/BrowserApp.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -411,29 +411,16 @@ abstract public class BrowserApp extends
         final ContentValues values = new ContentValues();
         values.put(ReadingListItems.URL, message.optString("url"));
         values.put(ReadingListItems.TITLE, message.optString("title"));
         values.put(ReadingListItems.LENGTH, message.optInt("length"));
         values.put(ReadingListItems.EXCERPT, message.optString("excerpt"));
         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
             public String doInBackground(Void... params) {
                 return Favicons.getFaviconURLForPageURL(url);
             }
 
             @Override
@@ -537,17 +524,16 @@ abstract public class BrowserApp extends
             "CharEncoding:Data",
             "CharEncoding:State",
             "Feedback:LastUrl",
             "Feedback:MaybeLater",
             "Feedback:OpenPlayStore",
             "Menu:Add",
             "Menu:Remove",
             "Reader:ListStatusRequest",
-            "Reader:Removed",
             "Reader:Share",
             "Settings:Show",
             "Telemetry:Gather",
             "Updater:Launch");
 
         Distribution.init(this);
         JavaAddonManager.getInstance().init(getApplicationContext());
         mSharedPreferencesHelper = new SharedPreferencesHelper(getApplicationContext());
@@ -895,17 +881,16 @@ abstract public class BrowserApp extends
             "CharEncoding:Data",
             "CharEncoding:State",
             "Feedback:LastUrl",
             "Feedback:MaybeLater",
             "Feedback:OpenPlayStore",
             "Menu:Add",
             "Menu:Remove",
             "Reader:ListStatusRequest",
-            "Reader:Removed",
             "Reader:Share",
             "Settings:Show",
             "Telemetry:Gather",
             "Updater:Launch");
 
         if (AppConstants.MOZ_ANDROID_BEAM && Build.VERSION.SDK_INT >= 14) {
             NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
             if (nfc != null) {
@@ -1226,20 +1211,16 @@ abstract public class BrowserApp extends
                 public void run() {
                     removeAddonMenuItem(id);
                 }
             });
 
         } 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");
             GeckoAppShell.openUriExternal(url, "text/plain", "", "", Intent.ACTION_SEND, title);
 
         } else if ("Settings:Show".equals(event)) {
             final String resource =
                     message.optString(GeckoPreferences.INTENT_EXTRA_RESOURCES, null);
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -7518,23 +7518,16 @@ let Reader = {
         }.bind(this));
         break;
       }
 
       case "Reader:Remove": {
         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;
       }
 
       case "nsPref:changed": {
         if (aData.startsWith("reader.parse-on-load.")) {
           this.isEnabledForParseOnLoad = this.getStateForParseOnLoad();
         }