Bug 825505 - Allow cancelling pinning sites from the Awesomescreen. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Wed, 02 Jan 2013 11:49:41 -0800
changeset 117340 0515eda1f932f00bcb9adc1fe51f35eeb77fff36
parent 117339 001b109e68c46353d6c7f4b943225088eb593eac
child 117341 86204e3d7ce68643c7572d3f0f47be7aa99667e4
push id24097
push userryanvm@gmail.com
push dateThu, 03 Jan 2013 02:02:24 +0000
treeherdermozilla-central@4e18ac9b51e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs825505
milestone20.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 825505 - Allow cancelling pinning sites from the Awesomescreen. r=mfinkle
mobile/android/base/AboutHomeContent.java
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -19,16 +19,17 @@ import org.mozilla.gecko.util.GeckoAsync
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.OnAccountsUpdateListener;
+import android.app.Activity;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
@@ -975,25 +976,27 @@ public class AboutHomeContent extends Sc
         intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
         intent.putExtra(AwesomeBar.TARGET_KEY, AwesomeBar.Target.PICK_SITE.toString());
         if (url != null && !TextUtils.isEmpty(url)) {
             intent.putExtra(AwesomeBar.CURRENT_URL_KEY, url);
         }
 
         int requestCode = GeckoAppShell.sActivityHelper.makeRequestCode(new ActivityResultHandler() {
             public void onActivityResult(int resultCode, Intent data) {
+                if (resultCode == Activity.RESULT_CANCELED || data == null)
+                    return;
+
                 final String title = data.getStringExtra(AwesomeBar.TITLE_KEY);
                 final String url = data.getStringExtra(AwesomeBar.URL_KEY);
 
                 // update the database on a background thread
                 (new GeckoAsyncTask<Void, Void, Void>(GeckoApp.mAppContext, GeckoAppShell.getHandler()) {
                     @Override
                     public Void doInBackground(Void... params) {
                         final ContentResolver resolver = mActivity.getContentResolver();
-                        Log.i(LOGTAG, "Pin : " + url + " and " + title);
                         BrowserDB.pinSite(resolver, url, (title == null ? url : title), position);
                         return null;
                     }
         
                     @Override
                     public void onPostExecute(Void v) {
                         update(EnumSet.of(UpdateFlags.TOP_SITES));
                     }