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..11bb49f73e813153cac0dec598935685f23baa44 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,19 @@ import org.chromium.chrome.browser.share.ShareActivity; |
public class PhysicalWebShareActivity extends ShareActivity { |
@Override |
protected void handleShareAction(ChromeActivity triggeringActivity) { |
nyquist
2017/03/06 22:34:14
Should this be protected by some finch flag? Or is
iankc
2017/03/07 02:10:39
This is protected in the featureIsAvailable() meth
nyquist
2017/03/07 06:58:33
Acknowledged.
|
- // TODO(iankc): implement this. |
+ String url = triggeringActivity.getActivityTab().getUrl(); |
nyquist
2017/03/06 22:34:14
Can the activity tab ever be null? Say the user ta
iankc
2017/03/07 02:10:40
Yes, the activity tab can be null! However, in the
nyquist
2017/03/07 06:58:33
Acknowledged.
|
+ |
+ Intent intent = new Intent(this, PhysicalWebBroadcastService.class); |
+ intent.putExtra(PhysicalWebBroadcastService.DISPLAY_URL_KEY, url); |
+ startService(intent); |
nyquist
2017/03/06 22:34:14
Is this guaranteed to only pinky-promise be called
iankc
2017/03/07 02:10:39
This should only be called when chrome is in the f
nyquist
2017/03/07 06:58:33
Acknowledged.
|
} |
+ /** |
+ * 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. |
+ */ |
nyquist
2017/03/06 22:34:14
Would probably be helpful with a @return here. (re
iankc
2017/03/07 02:10:39
Done.
|
public static boolean featureIsAvailable() { |
return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; |
} |