Bug 696315 - Remove Quit menu option. r=bnicholson@mozilla.com
authorDoug Turner <dougt@dougt.org>
Wed, 02 Nov 2011 22:32:36 -0700
changeset 83357 03c53ee42fc9c1597ac45e987bfedefc2a8c39c8
parent 83356 15595d5edb2c8077b267438622fb68735a3680ca
child 83358 c09a52af4cd8573f602571d96a9254f3f2ecf9a0
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs696315
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 696315 - Remove Quit menu option. r=bnicholson@mozilla.com
embedding/android/GeckoApp.java
embedding/android/GeckoAppShell.java
embedding/android/resources/layout/gecko_menu.xml
other-licenses/android/APKOpen.cpp
toolkit/xre/nsAndroidStartup.cpp
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -474,19 +474,16 @@ abstract public class GeckoApp
     }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         Tab tab = null;
         Tab.HistoryEntry he = null;
         Intent intent = null;
         switch (item.getItemId()) {
-           case R.id.quit:
-               quit();
-               return true;
            case R.id.bookmark:
                tab = Tabs.getInstance().getSelectedTab();
                if (tab != null) {
                    if (item.isChecked()) {
                        tab.removeBookmark();
                        Toast.makeText(this, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
                        item.setIcon(R.drawable.bookmark_add);
                        item.setTitle(R.string.bookmark_add);
@@ -563,24 +560,16 @@ abstract public class GeckoApp
         String lastTitle = prefs.getString("last-title", "");
 
         Log.i(LOG_NAME, "The last uri was: " + lastUri);
         Log.i(LOG_NAME, "The last title was: " + lastTitle);
         
         return true;
     }
 
-    private void quit() {
-        Log.i(LOG_NAME, "pleaseKillMe");
-        rememberLastScreen(true);
-        GeckoAppShell.nativeQuit();
-        finish();
-        System.exit(0);
-    }
-
     void handleLocationChange(final int tabId, final String uri) {
         final Tab tab = Tabs.getInstance().getTab(tabId);
         if (tab == null)
             return;
         
         String oldBaseURI = tab.getURL();
         tab.updateURL(uri);
 
@@ -1138,16 +1127,18 @@ abstract public class GeckoApp
             Log.i(LOG_NAME,"Intent : BOOKMARK - " + args);
         }
     }
 
     @Override
     public void onPause()
     {
         Log.i(LOG_NAME, "pause");
+        rememberLastScreen(true);
+
         GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
         // The user is navigating away from this activity, but nothing
         // has come to the foreground yet; for Gecko, we may want to
         // stop repainting, for example.
 
         // Whatever we do here should be fast, because we're blocking
         // the next activity from showing up until we finish.
 
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -109,17 +109,16 @@ public class GeckoAppShell
 
     private static HashMap<String, ArrayList<GeckoEventListener>> mEventListeners;
 
     /* The Android-side API: API methods that Android calls */
 
     // Initialization methods
     public static native void nativeInit();
     public static native void nativeRun(String args);
-    public static native void nativeQuit();
 
     // helper methods
     public static native void setSurfaceView(GeckoSurfaceView sv);
     public static native void putenv(String map);
     public static native void onResume();
     public static native void onLowMemory();
     public static native void callObserver(String observerKey, String topic, String data);
     public static native void removeObserver(String observerKey);
--- a/embedding/android/resources/layout/gecko_menu.xml
+++ b/embedding/android/resources/layout/gecko_menu.xml
@@ -19,17 +19,13 @@
 
     <item android:id="@+id/share"
           android:icon="@drawable/share"
           android:title="@string/share" /> 
 
     <item android:id="@+id/saveaspdf"
           android:title="@string/saveaspdf" />
 
-    <item android:id="@+id/quit"
-          android:icon="@drawable/quit"
-          android:title="@string/quit" />
-
     <item android:id="@+id/addons"
           android:icon="@drawable/addons"
           android:title="@string/addons"
           android:showAsAction="ifRoom"/>
 </menu>
--- a/other-licenses/android/APKOpen.cpp
+++ b/other-licenses/android/APKOpen.cpp
@@ -225,17 +225,16 @@ static name ## _t f_ ## name; \
 extern "C" NS_EXPORT void JNICALL \
 Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one, type2 two, type3 three) \
 { \
   f_ ## name(jenv, jc, one, two, three); \
 }
 
 SHELL_WRAPPER0(nativeInit)
 SHELL_WRAPPER1(nativeRun, jstring)
-SHELL_WRAPPER0(nativeQuit)
 SHELL_WRAPPER1(notifyGeckoOfEvent, jobject)
 SHELL_WRAPPER0(processNextNativeEvent)
 SHELL_WRAPPER1(setSurfaceView, jobject)
 SHELL_WRAPPER0(onResume)
 SHELL_WRAPPER0(onLowMemory)
 SHELL_WRAPPER3(callObserver, jstring, jstring, jstring)
 SHELL_WRAPPER1(removeObserver, jstring)
 SHELL_WRAPPER1(onChangeNetworkLinkStatus, jstring)
@@ -632,17 +631,16 @@ loadLibs(const char *apkName)
 #endif
 
   if (!xul_handle)
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't get a handle to libxul!");
 
 #define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(xul_handle, "Java_org_mozilla_gecko_GeckoAppShell_" #name)
   GETFUNC(nativeInit);
   GETFUNC(nativeRun);
-  GETFUNC(nativeQuit);
   GETFUNC(notifyGeckoOfEvent);
   GETFUNC(processNextNativeEvent);
   GETFUNC(setSurfaceView);
   GETFUNC(onResume);
   GETFUNC(onLowMemory);
   GETFUNC(callObserver);
   GETFUNC(removeObserver);
   GETFUNC(onChangeNetworkLinkStatus);
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -49,18 +49,16 @@
 
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsILocalFile.h"
 #include "nsAppRunner.h"
 #include "AndroidBridge.h"
 #include "APKOpen.h"
 #include "nsExceptionHandler.h"
-#include "nsIAppStartup.h"
-#include "nsToolkitCompsCID.h"
 
 #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args)
 
 #define _STR(s) # s
 #define STR(s) _STR(s)
 
 struct AutoAttachJavaThread {
     AutoAttachJavaThread() {
@@ -165,16 +163,8 @@ Java_org_mozilla_gecko_GeckoAppShell_nat
     int len = jenv->GetStringLength(jargs);
     wargs.SetLength(jenv->GetStringLength(jargs));
     jenv->GetStringRegion(jargs, 0, len, wargs.BeginWriting());
     char *args = ToNewUTF8String(wargs);
 
     GeckoStart(args);
 }
 
-extern "C" NS_EXPORT void JNICALL
-Java_org_mozilla_gecko_GeckoAppShell_nativeQuit(JNIEnv*, jclass)
-{
-    nsCOMPtr<nsIAppStartup> appStartup =
-        do_GetService(NS_APPSTARTUP_CONTRACTID);
-    if (appStartup)
-        appStartup->Quit(nsIAppStartup::eAttemptQuit);
-}