Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4603)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java

Issue 2872353004: [Android] Implement copy and open in background of Browser Actions (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java
index 794c7b1b0bb4b40f0f9e38a45ff11ef997051ffb..0c0f775c285db2fa0ddb146bcab885e8b5406614 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/browseractions/BrowserActionsContextMenuItemDelegate.java
@@ -7,6 +7,8 @@ package org.chromium.chrome.browser.browseractions;
import android.app.Activity;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
+import android.content.ClipData;
+import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -14,9 +16,11 @@ import android.provider.Browser;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
+import org.chromium.chrome.R;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.util.IntentUtils;
+import org.chromium.ui.widget.Toast;
/**
* A delegate responsible for taking actions based on browser action context menu selections.
@@ -39,7 +43,14 @@ public class BrowserActionsContextMenuItemDelegate {
* Called when the {@code text} should be saved to the clipboard.
* @param text The text to save to the clipboard.
*/
- public void onSaveToClipboard(String text) {}
+ public void onSaveToClipboard(String text) {
+ ClipboardManager clipboardManager =
+ (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
+ ClipData data = ClipData.newPlainText("url", text);
+ clipboardManager.setPrimaryClip(data);
+ Toast.makeText(mContext, R.string.browser_actions_copy_toast_message, Toast.LENGTH_SHORT)
+ .show();
+ }
/**
* Called when the {@code linkUrl} should be opened in Chrome incognito tab.

Powered by Google App Engine
This is Rietveld 408576698