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

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

Issue 2719493003: Add PhysicalWebBroadcastService (Closed)
Patch Set: rebasing with master 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) {
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.
18 // TODO(iankc): implement this. 19 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.
20
21 Intent intent = new Intent(this, PhysicalWebBroadcastService.class);
22 intent.putExtra(PhysicalWebBroadcastService.DISPLAY_URL_KEY, url);
23 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.
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 */
nyquist 2017/03/06 22:34:14 Would probably be helpful with a @return here. (re
iankc 2017/03/07 02:10:39 Done.
21 public static boolean featureIsAvailable() { 32 public static boolean featureIsAvailable() {
22 return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build. VERSION_CODES.M; 33 return PhysicalWeb.sharingIsEnabled() && Build.VERSION.SDK_INT >= Build. VERSION_CODES.M;
23 } 34 }
24 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698