From 2e9a628b4aa11edfc00f562faaaa97b6d8bdb94a Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 4 May 2012 12:52:13 -0700 Subject: [PATCH] Bug 752001 - Remove unnecessary indirection for stop/reload/forward actions. r=mfinkle --- mobile/android/base/BrowserToolbar.java | 8 +++--- mobile/android/base/GeckoApp.java | 35 +++++-------------------- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/mobile/android/base/BrowserToolbar.java b/mobile/android/base/BrowserToolbar.java index ab5d0b4b4c17..bb93e5ff2056 100644 --- a/mobile/android/base/BrowserToolbar.java +++ b/mobile/android/base/BrowserToolbar.java @@ -190,7 +190,9 @@ public class BrowserToolbar { mStop = (ImageButton) mLayout.findViewById(R.id.stop); mStop.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { - doStop(); + Tab tab = Tabs.getInstance().getSelectedTab(); + if (tab != null) + tab.doStop(); } }); @@ -221,10 +223,6 @@ public class BrowserToolbar { GeckoApp.mAppContext.showTabs(); } - private void doStop() { - GeckoApp.mAppContext.doStop(); - } - public int getHighlightColor() { return mColor; } diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index fd1211e8e44e..cfa331aa4f5d 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -509,10 +509,14 @@ abstract public class GeckoApp } return true; case R.id.reload: - doReload(); + tab = Tabs.getInstance().getSelectedTab(); + if (tab != null) + tab.doReload(); return true; case R.id.forward: - doForward(); + tab = Tabs.getInstance().getSelectedTab(); + if (tab != null) + tab.doForward(); return true; case R.id.save_as_pdf: GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SaveAs:PDF", null)); @@ -2533,33 +2537,6 @@ abstract public class GeckoApp return true; } - public boolean doReload() { - Log.i(LOGTAG, "Reload requested"); - Tab tab = Tabs.getInstance().getSelectedTab(); - if (tab == null) - return false; - - return tab.doReload(); - } - - public boolean doForward() { - Log.i(LOGTAG, "Forward requested"); - Tab tab = Tabs.getInstance().getSelectedTab(); - if (tab == null) - return false; - - return tab.doForward(); - } - - public boolean doStop() { - Log.i(LOGTAG, "Stop requested"); - Tab tab = Tabs.getInstance().getSelectedTab(); - if (tab == null) - return false; - - return tab.doStop(); - } - @Override public void onBackPressed() { if (mDoorHangerPopup.isShowing()) {