Bug 972306 - Rename HomePanels:Remove to HomePanels:Uninstall (r=margaret)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 21 Feb 2014 10:33:58 +0000
changeset 170371 80d462f5ad1bf9d04efb1f3b2a3b84e75ac2b08a
parent 170370 5d896e33c6a6fa7c382d6a1c6b544675d9857ee9
child 170372 c1020c48b5b257ab4f9ea632f6db21726e5d4590
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmargaret
bugs972306
milestone30.0a1
Bug 972306 - Rename HomePanels:Remove to HomePanels:Uninstall (r=margaret)
mobile/android/base/home/HomeConfigInvalidator.java
mobile/android/modules/Home.jsm
--- a/mobile/android/base/home/HomeConfigInvalidator.java
+++ b/mobile/android/base/home/HomeConfigInvalidator.java
@@ -33,23 +33,23 @@ public class HomeConfigInvalidator imple
     public static final String LOGTAG = "HomeConfigInvalidator";
 
     private static final HomeConfigInvalidator sInstance = new HomeConfigInvalidator();
 
     private static final int INVALIDATION_DELAY_MSEC = 500;
     private static final int PANEL_INFO_TIMEOUT_MSEC = 1000;
 
     private static final String EVENT_HOMEPANELS_INSTALL = "HomePanels:Install";
-    private static final String EVENT_HOMEPANELS_REMOVE = "HomePanels:Remove";
+    private static final String EVENT_HOMEPANELS_UNINSTALL = "HomePanels:Uninstall";
     private static final String EVENT_HOMEPANELS_REFRESH = "HomePanels:Refresh";
 
     private static final String JSON_KEY_PANEL = "panel";
 
     private enum ChangeType {
-        REMOVE,
+        UNINSTALL,
         INSTALL,
         REFRESH
     }
 
     private static class ConfigChange {
         private final ChangeType type;
         private final PanelConfig target;
 
@@ -69,36 +69,36 @@ public class HomeConfigInvalidator imple
         return sInstance;
     }
 
     public void init(Context context) {
         mContext = context;
         mHomeConfig = HomeConfig.getDefault(context);
 
         GeckoAppShell.getEventDispatcher().registerEventListener(EVENT_HOMEPANELS_INSTALL, this);
-        GeckoAppShell.getEventDispatcher().registerEventListener(EVENT_HOMEPANELS_REMOVE, this);
+        GeckoAppShell.getEventDispatcher().registerEventListener(EVENT_HOMEPANELS_UNINSTALL, this);
         GeckoAppShell.getEventDispatcher().registerEventListener(EVENT_HOMEPANELS_REFRESH, this);
     }
 
     public void refreshAll() {
         handlePanelRefresh(null);
     }
 
     @Override
     public void handleMessage(String event, JSONObject message) {
         try {
             final JSONObject json = message.getJSONObject(JSON_KEY_PANEL);
             final PanelConfig panelConfig = new PanelConfig(json);
 
             if (event.equals(EVENT_HOMEPANELS_INSTALL)) {
                 Log.d(LOGTAG, EVENT_HOMEPANELS_INSTALL);
                 handlePanelInstall(panelConfig);
-            } else if (event.equals(EVENT_HOMEPANELS_REMOVE)) {
-                Log.d(LOGTAG, EVENT_HOMEPANELS_REMOVE);
-                handlePanelRemove(panelConfig);
+            } else if (event.equals(EVENT_HOMEPANELS_UNINSTALL)) {
+                Log.d(LOGTAG, EVENT_HOMEPANELS_UNINSTALL);
+                handlePanelUninstall(panelConfig);
             } else if (event.equals(EVENT_HOMEPANELS_REFRESH)) {
                 Log.d(LOGTAG, EVENT_HOMEPANELS_REFRESH);
                 handlePanelRefresh(panelConfig);
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "Failed to handle event " + event, e);
         }
     }
@@ -111,19 +111,19 @@ public class HomeConfigInvalidator imple
         Log.d(LOGTAG, "handlePanelInstall: " + mPendingChanges.size());
 
         scheduleInvalidation();
     }
 
     /**
      * Runs in the gecko thread.
      */
-    private void handlePanelRemove(PanelConfig panelConfig) {
-        mPendingChanges.offer(new ConfigChange(ChangeType.REMOVE, panelConfig));
-        Log.d(LOGTAG, "handlePanelRemove: " + mPendingChanges.size());
+    private void handlePanelUninstall(PanelConfig panelConfig) {
+        mPendingChanges.offer(new ConfigChange(ChangeType.UNINSTALL, panelConfig));
+        Log.d(LOGTAG, "handlePanelUninstall: " + mPendingChanges.size());
 
         scheduleInvalidation();
     }
 
     /**
      * Schedules a panel refresh in HomeConfig. Runs in the gecko thread.
      *
      * @param panelConfig the target PanelConfig instance or NULL to refresh
@@ -170,17 +170,17 @@ public class HomeConfigInvalidator imple
     private List<PanelConfig> executePendingChanges(List<PanelConfig> panelConfigs) {
         boolean shouldRefreshAll = false;
 
         while (!mPendingChanges.isEmpty()) {
             final ConfigChange pendingChange = mPendingChanges.poll();
             final PanelConfig panelConfig = pendingChange.target;
 
             switch (pendingChange.type) {
-                case REMOVE:
+                case UNINSTALL:
                     if (panelConfigs.remove(panelConfig)) {
                         Log.d(LOGTAG, "executePendingChanges: removed panel " + panelConfig.getId());
                     }
                     break;
 
                 case INSTALL:
                     if (!replacePanelConfig(panelConfigs, panelConfig)) {
                         panelConfigs.add(panelConfig);
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -316,17 +316,17 @@ let HomePanels = (function () {
       if (!(id in _panels)) {
         throw "Home.panels: Panel doesn't exist: id = " + id;
       }
 
       let panel = _panels[id];
       delete _panels[id];
 
       sendMessageToJava({
-        type: "HomePanels:Remove",
+        type: "HomePanels:Uninstall",
         panel: _panelToJSON(panel)
       });
     }
   });
 })();
 
 // Public API
 this.Home = Object.freeze({