Bug 800332 - Use loadUrl() to open remote tabs. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Mon, 15 Oct 2012 12:51:54 -0700
changeset 110453 4e9d97c921276a69bfdec4a4d6f86890f2c19fc3
parent 110452 f8e52edff71e0f3cb5c9d6530838763c4049fbec
child 110454 5ced91531316b79e42ec1645d0f77ada840d993b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmfinkle
bugs800332
milestone19.0a1
Bug 800332 - Use loadUrl() to open remote tabs. r=mfinkle
mobile/android/base/AboutHomeContent.java.in
mobile/android/base/RemoteTabs.java
--- a/mobile/android/base/AboutHomeContent.java.in
+++ b/mobile/android/base/AboutHomeContent.java.in
@@ -133,28 +133,17 @@ public class AboutHomeContent extends Sc
             public void onAccountsUpdated(Account[] accounts) {
                 updateLayoutForSync();
             }
         }, GeckoAppShell.getHandler(), false);
 
         mRemoteTabClickListener = new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                String url = ((String) v.getTag());
-                JSONObject args = new JSONObject();
-                try {
-                    args.put("url", url);
-                    args.put("engine", null);
-                    args.put("userEntered", false);
-                } catch (Exception e) {
-                    Log.e(LOGTAG, "error building JSON arguments");
-                }
-    
-                Log.d(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
-                GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
+                Tabs.getInstance().loadUrl((String) v.getTag(), Tabs.LOADURL_NEW_TAB);
             }
         };
 
         mPrelimPromoBoxType = (new Random()).nextFloat() < 0.5 ? AboutHomePromoBox.Type.SYNC :
                 AboutHomePromoBox.Type.APPS;
     }
 
     private void inflate() {
--- a/mobile/android/base/RemoteTabs.java
+++ b/mobile/android/base/RemoteTabs.java
@@ -84,28 +84,17 @@ public class RemoteTabs extends LinearLa
     @Override
     public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) {
         HashMap <String, String> tab = mTabsList.get(groupPosition).get(childPosition);
         if (tab == null) {
             autoHidePanel();
             return true;
         }
 
-        String url = tab.get("url");
-        JSONObject args = new JSONObject();
-        try {
-            args.put("url", url);
-            args.put("engine", null);
-            args.put("userEntered", false);
-        } catch (Exception e) {
-            Log.e(LOGTAG, "error building JSON arguments");
-        }
-
-        Log.d(LOGTAG, "Sending message to Gecko: " + SystemClock.uptimeMillis() + " - Tab:Add");
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Tab:Add", args.toString()));
+        Tabs.getInstance().loadUrl(tab.get("url"), Tabs.LOADURL_NEW_TAB);
         autoHidePanel();
         return true;
     }
 
     @Override
     public void onQueryTabsComplete(List<TabsAccessor.RemoteTab> remoteTabsList) {
         ArrayList<TabsAccessor.RemoteTab> remoteTabs = new ArrayList<TabsAccessor.RemoteTab> (remoteTabsList);
         if (remoteTabs == null || remoteTabs.size() == 0) {