// Edit the site at position. Provide a url to start editing with
  public void editSite(String url, final int position) {
    Intent intent = new Intent(mContext, AwesomeBar.class);
    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 View v = mTopSitesGrid.getChildAt(position);
                final TopSitesViewHolder holder = (TopSitesViewHolder) v.getTag();

                final String title = data.getStringExtra(AwesomeBar.TITLE_KEY);
                final String url = data.getStringExtra(AwesomeBar.URL_KEY);
                clearThumbnailsWithUrl(url);

                holder.setUrl(url);
                holder.setTitle(title);
                holder.setPinned(true);

                // update the database on a background thread
                (new GeckoAsyncTask<Void, Void, Bitmap>(
                        GeckoApp.mAppContext, GeckoAppShell.getHandler()) {
                      @Override
                      public Bitmap doInBackground(Void... params) {
                        final ContentResolver resolver = mActivity.getContentResolver();
                        BrowserDB.pinSite(resolver, holder.getUrl(), holder.getTitle(), position);

                        List<String> urls = new ArrayList<String>();
                        urls.add(holder.getUrl());

                        Cursor c = BrowserDB.getThumbnailsForUrls(resolver, urls);
                        if (c == null || !c.moveToFirst()) {
                          return null;
                        }

                        final byte[] b = c.getBlob(c.getColumnIndexOrThrow(Thumbnails.DATA));
                        if (b != null) {
                          return BitmapFactory.decodeByteArray(b, 0, b.length);
                        }

                        return null;
                      }

                      @Override
                      public void onPostExecute(Bitmap b) {
                        displayThumbnail(v, b);
                      }
                    })
                    .execute();
              }
            });

    mActivity.startActivityForResult(intent, requestCode);
  }
  // Edit the site at position. Provide a url to start editing with
  public void editSite(String url, final int position) {
    Intent intent = new Intent(mContext, AwesomeBar.class);
    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();
                        BrowserDB.pinSite(resolver, url, (title == null ? url : title), position);
                        return null;
                      }

                      @Override
                      public void onPostExecute(Void v) {
                        update(EnumSet.of(UpdateFlags.TOP_SITES));
                      }
                    })
                    .execute();
              }
            });

    mActivity.startActivityForResult(intent, requestCode);
  }