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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.physicalweb; 5 package org.chromium.chrome.browser.physicalweb;
6 6
7 import android.content.Intent;
7 import android.os.Build; 8 import android.os.Build;
8 9
9 import org.chromium.chrome.browser.ChromeActivity; 10 import org.chromium.chrome.browser.ChromeActivity;
10 import org.chromium.chrome.browser.share.ShareActivity; 11 import org.chromium.chrome.browser.share.ShareActivity;
11 12
12 /** 13 /**
13 * A simple activity that allows Chrome to start the physical web sharing servic e. 14 * A simple activity that allows Chrome to start the physical web sharing servic e.
14 */ 15 */
15 public class PhysicalWebShareActivity extends ShareActivity { 16 public class PhysicalWebShareActivity extends ShareActivity {
16 @Override 17 @Override
17 protected void handleShareAction(ChromeActivity triggeringActivity) { 18 protected void handleShareAction(ChromeActivity triggeringActivity) {
18 // TODO(iankc): implement this. 19 String url = triggeringActivity.getActivityTab().getUrl();
20
21 Intent intent = new Intent(this, PhysicalWebBroadcastService.class);
22 intent.putExtra(PhysicalWebBroadcastService.DISPLAY_URL_KEY, url);
23 startService(intent);
19 } 24 }
20 25
26 /**
27 * Returns whether we should show this sharing option in the share sheet.
28 * Pre-conditions for Physical Web Sharing to be enabled:
29 * Device is Marshmallow or above.
30 * Device has sharing feature enabled.
31 * @return {@code true} if the feature should be enabled.
32 */
21 public static boolean featureIsAvailable() { 33 public static boolean featureIsAvailable() {
22 return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build. VERSION_CODES.M; 34 return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build. VERSION_CODES.M;
23 } 35 }
24 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698