| Index: chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionActivity.java
|
| index 3f963c9312124bc2387c6e2ae0e14ffa443fa7ab..c611ca60c6b322e82a6d977fafb3bf8fd432459c 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionActivity.java
|
| @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.browseractions;
|
|
|
| import android.app.PendingIntent;
|
| import android.content.Intent;
|
| -import android.graphics.Bitmap;
|
| import android.graphics.Point;
|
| import android.net.Uri;
|
| import android.os.Bundle;
|
| @@ -31,12 +30,13 @@ import java.util.List;
|
| * A transparent {@link AsyncInitializationActivity} that displays the Browser Actions context menu.
|
| */
|
| public class BrowserActionActivity extends AsyncInitializationActivity {
|
| - private static final String TAG = "BrowserActions";
|
| + private static final String TAG = "cr_BrowserActions";
|
|
|
| private int mType;
|
| private Uri mUri;
|
| private String mCreatorPackageName;
|
| private List<BrowserActionItem> mActions = new ArrayList<>();
|
| + private PendingIntent mOnBrowserActionSelectedCallback;
|
| private BrowserActionsContextMenuHelper mHelper;
|
|
|
| @Override
|
| @@ -57,10 +57,12 @@ public class BrowserActionActivity extends AsyncInitializationActivity {
|
| mType = IntentUtils.safeGetIntExtra(
|
| intent, BrowserActionsIntent.EXTRA_TYPE, BrowserActionsIntent.URL_TYPE_NONE);
|
| mCreatorPackageName = BrowserActionsIntent.getCreatorPackageName(intent);
|
| + mOnBrowserActionSelectedCallback = IntentUtils.safeGetParcelableExtra(
|
| + intent, BrowserActionsIntent.EXTRA_SELECTED_ACTION_PENDING_INTENT);
|
| ArrayList<Bundle> bundles = IntentUtils.getParcelableArrayListExtra(
|
| intent, BrowserActionsIntent.EXTRA_MENU_ITEMS);
|
| if (bundles != null) {
|
| - parseBrowserActionItems(bundles);
|
| + mActions = BrowserActionsIntent.parseBrowserActionItems(bundles);
|
| }
|
| if (mUri == null) {
|
| Log.e(TAG, "Missing url");
|
| @@ -89,7 +91,8 @@ public class BrowserActionActivity extends AsyncInitializationActivity {
|
| @Override
|
| public void openContextMenu(View view) {
|
| ContextMenuParams params = createContextMenuParams();
|
| - mHelper = new BrowserActionsContextMenuHelper(this, params, mActions, mCreatorPackageName);
|
| + mHelper = new BrowserActionsContextMenuHelper(
|
| + this, params, mActions, mCreatorPackageName, mOnBrowserActionSelectedCallback);
|
| mHelper.displayBrowserActionsMenu(view);
|
| return;
|
| }
|
| @@ -122,33 +125,6 @@ public class BrowserActionActivity extends AsyncInitializationActivity {
|
| return true;
|
| }
|
|
|
| - /**
|
| - * Gets custom item list for browser action menu.
|
| - * @param bundles Data for custom items from {@link BrowserActionsIntent}.
|
| - */
|
| - private void parseBrowserActionItems(ArrayList<Bundle> bundles) {
|
| - for (int i = 0; i < bundles.size(); i++) {
|
| - Bundle bundle = bundles.get(i);
|
| - String title = IntentUtils.safeGetString(bundle, BrowserActionsIntent.KEY_TITLE);
|
| - PendingIntent action =
|
| - IntentUtils.safeGetParcelable(bundle, BrowserActionsIntent.KEY_ACTION);
|
| - Bitmap icon = IntentUtils.safeGetParcelable(bundle, BrowserActionsIntent.KEY_ICON);
|
| - if (title != null && action != null) {
|
| - BrowserActionItem item = new BrowserActionItem(title, action);
|
| - if (icon != null) {
|
| - item.setIcon(icon);
|
| - }
|
| - mActions.add(item);
|
| - } else if (title != null) {
|
| - Log.e(TAG, "Missing action for item: " + i);
|
| - } else if (action != null) {
|
| - Log.e(TAG, "Missing title for item: " + i);
|
| - } else {
|
| - Log.e(TAG, "Missing title and action for item: " + i);
|
| - }
|
| - }
|
| - }
|
| -
|
| /**
|
| * Callback when Browser Actions menu dialog is shown.
|
| */
|
| @@ -163,11 +139,4 @@ public class BrowserActionActivity extends AsyncInitializationActivity {
|
| mHelper.onContextMenuClosed();
|
| }
|
| }
|
| -
|
| - /**
|
| - * @return the package name of the requesting app.
|
| - */
|
| - public String getCreatorPackageName() {
|
| - return mCreatorPackageName;
|
| - }
|
| }
|
|
|