Commit e91124f4 authored by Michael Checo's avatar Michael Checo Committed by Chromium LUCI CQ

[Nearby] Show description on settings row

Screenshot: http://shortn/_2F4mclWC9p

Bug: 1154764
Test: unit_tests --gtest_filter=NearbySh*
Change-Id: I76b370e10e2b1b2e38b7c33eb29f4b4b36f677a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576635
Commit-Queue: Michael Checo <michaelcheco@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836221}
parent c4ce7d8e
......@@ -165,6 +165,9 @@
<message name="IDS_SETTINGS_NEARBY_SHARE_VISIBILITY_DIALOG_TITLE" desc="Title for the dialog which allows a user to set their preference for the visibility of their device with their contacts for the Nearby Share feature.">
Device visibility
</message>
<message name="IDS_SETTINGS_NEARBY_SHARE_DESCRIPTION" desc="A description of nearby share that helps users understand what the feature is used for.">
Share files with people around you. <ph name="LINK_BEGIN">&lt;a&gt;</ph>Learn more<ph name="LINK_END">&lt;/a&gt;</ph>
</message>
<!-- Personalization Options SubPage (strings used by the <settings-personalization-options> element) -->
<message name="IDS_SETTINGS_ENABLE_URL_KEYED_ANONYMIZED_DATA_COLLECTION" desc="The label of the checkbox to enable/disable url keyed anonymized data collection.">
......
dfef03fd44ab2593e75c79698ad63887069008df
\ No newline at end of file
......@@ -122,10 +122,24 @@
<div id="nearbyShareLabel" class="middle settings-box-text"
aria-hidden="true">
$i18n{nearbyShareTitle}
<div class="secondary" id="nearbyShareSecondary">
[[getOnOffString_(prefs.nearby_sharing.enabled.value,
<template is="dom-if"
if="[[prefs.nearby_sharing.onboarding_complete.value]]"
restamp>
<div class="secondary" id="nearbyShareSecondary">
[[getOnOffString_(prefs.nearby_sharing.enabled.value,
'$i18nPolymer{deviceOn}', '$i18nPolymer{deviceOff}')]]
</div>
</div>
</template>
<template is="dom-if"
if="[[!prefs.nearby_sharing.onboarding_complete.value]]"
restamp>
<div class="secondary" id="nearbyShareSecondary">
<settings-localized-link
localized-string="$i18n{nearbyShareDescription}"
link-url="$i18n{nearbyShareLearnMoreLink}">
</settings-localized-link>
</div>
</template>
</div>
<template is="dom-if" if="[[prefs.nearby_sharing.enabled.value]]"
restamp>
......
......@@ -30,6 +30,7 @@
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/devicetype_utils.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/nearby_sharing/common/nearby_share_features.h"
#include "chrome/common/url_constants.h"
......@@ -287,7 +288,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) {
IDS_SETTINGS_NEARBY_SHARE_CONTACT_VISIBILITY_ROW_TITLE},
{"nearbyShareEditVisibility", IDS_SETTINGS_NEARBY_SHARE_EDIT_VISIBILITY},
{"nearbyShareVisibilityDialogTitle",
IDS_SETTINGS_NEARBY_SHARE_VISIBILITY_DIALOG_TITLE}};
IDS_SETTINGS_NEARBY_SHARE_VISIBILITY_DIALOG_TITLE},
{"nearbyShareDescription", IDS_SETTINGS_NEARBY_SHARE_DESCRIPTION}};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
......@@ -297,6 +299,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) {
"nearbySharingFeatureFlag",
base::FeatureList::IsEnabled(features::kNearbySharing));
html_source->AddString("nearbyShareLearnMoreLink",
base::ASCIIToUTF16(chrome::kNearbyShareLearnMoreURL));
// To use lottie, the worker-src CSP needs to be updated for the web ui that
// is using it. Since as of now there are only a couple of webuis using
// lottie animations, this update has to be performed manually. As the usage
......
......@@ -419,8 +419,12 @@ const char kTabletModeGesturesLearnMoreURL[] =
const char kWifiSyncLearnMoreURL[] =
"https://support.google.com/chromebook/?p=wifisync";
// TODO(michaelcheco): Update temporary url.
const char kNearbyShareLearnMoreURL[] = "https://google.com/";
extern const char kNearbyShareManageContactsURL[] =
"https://contacts.google.com";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_MAC)
......
......@@ -242,6 +242,9 @@ extern const char kSyncLearnMoreURL[];
extern const char kUpgradeHelpCenterBaseURL[];
// The URL for the "Learn more" link for nearby share.
extern const char kNearbyShareLearnMoreURL[];
// Help center URL for who the account administrator is.
extern const char kWhoIsMyAdministratorHelpURL[];
......
......@@ -407,4 +407,20 @@ suite('Multidevice', function() {
assertTrue(test_util.isChildVisible(
multidevicePage, '#nearbySharingToggleButton', false));
});
test('Nearby description shown before onboarding is completed', async () => {
assertTrue(test_util.isChildVisible(
multidevicePage, '#nearbyShareSecondary > settings-localized-link',
false));
multidevicePage.setPrefValue('nearby_sharing.onboarding_complete', true);
Polymer.dom.flush();
assertFalse(test_util.isChildVisible(
multidevicePage, '#nearbyShareSecondary > settings-localized-link',
false));
assertEquals(
multidevicePage.$$('#nearbyShareSecondary').textContent.trim(), 'Off');
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment