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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareActivity.java

Issue 2719493003: Add PhysicalWebBroadcastService (Closed)
Patch Set: Updating Commit Message Created 3 years, 9 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/physicalweb/PhysicalWebShareActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareActivity.java
index 8c7ca573b0a5f411ec634308cebc19c941add90e..3b6dbcb410a211aa0d46a6b62436de68f77ccd05 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebShareActivity.java
@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.physicalweb;
+import android.content.Intent;
import android.os.Build;
import org.chromium.chrome.browser.ChromeActivity;
@@ -15,9 +16,20 @@ import org.chromium.chrome.browser.share.ShareActivity;
public class PhysicalWebShareActivity extends ShareActivity {
@Override
protected void handleShareAction(ChromeActivity triggeringActivity) {
- // TODO(iankc): implement this.
+ String url = triggeringActivity.getActivityTab().getUrl();
+
+ Intent intent = new Intent(this, PhysicalWebBroadcastService.class);
+ intent.putExtra(PhysicalWebBroadcastService.DISPLAY_URL_KEY, url);
+ startService(intent);
}
+ /**
+ * Returns whether we should show this sharing option in the share sheet.
+ * Pre-conditions for Physical Web Sharing to be enabled:
+ * Device is Marshmallow or above.
+ * Device has sharing feature enabled.
+ * @return {@code true} if the feature should be enabled.
+ */
public static boolean featureIsAvailable() {
return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}

Powered by Google App Engine
This is Rietveld 408576698