Commit a3f885f3 authored by Azeem Arshad's avatar Azeem Arshad Committed by Chromium LUCI CQ

[Nearby Share] Add Manage Contacts row in settings.

This CL adds a Contacts row with a external link button
that opens contacts.google.com.
Screenshot: https://screenshot.googleplex.com/AYwk6LF83yVHdpZ.png

Fixed: 1154832
Change-Id: I460752f2c3aef18389c99ac370d19da6299d118d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574973
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835373}
parent d44838f7
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,9 @@
<message name="IDS_SETTINGS_NEARBY_SHARE_DEVICE_NAME_ARIA_DESCRIPTION" desc="Description for screen readers, not displayed in UI, specifying the current device name which is shown to other devices for the Nearby Share feature." is_accessibility_with_no_ui="true"> <message name="IDS_SETTINGS_NEARBY_SHARE_DEVICE_NAME_ARIA_DESCRIPTION" desc="Description for screen readers, not displayed in UI, specifying the current device name which is shown to other devices for the Nearby Share feature." is_accessibility_with_no_ui="true">
Current device name is <ph name="DEVICE_NAME">$1<ex>Michael's Chromebook</ex></ph> Current device name is <ph name="DEVICE_NAME">$1<ex>Michael's Chromebook</ex></ph>
</message> </message>
<message name="IDS_SETTINGS_NEARBY_SHARE_MANAGE_CONTACTS_ROW_TITLE" desc="Text for row in settings that allows user to manage contacts for the Nearby Share feature.">
Contacts
</message>
<message name="IDS_SETTINGS_NEARBY_SHARE_EDIT_DATA_USAGE" desc="Label for the button that brings up a dialog to allow a user to edit the data usage setting for the Nearby Share feature."> <message name="IDS_SETTINGS_NEARBY_SHARE_EDIT_DATA_USAGE" desc="Label for the button that brings up a dialog to allow a user to edit the data usage setting for the Nearby Share feature.">
Edit Edit
</message> </message>
......
b3925a11b10c709900c164067a9a6349b766e30f
\ No newline at end of file
...@@ -273,8 +273,10 @@ js_library("nearby_share_subpage.m") { ...@@ -273,8 +273,10 @@ js_library("nearby_share_subpage.m") {
"//chrome/browser/resources/nearby_share/shared:nearby_onboarding_page.m", "//chrome/browser/resources/nearby_share/shared:nearby_onboarding_page.m",
"//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior.m", "//chrome/browser/resources/nearby_share/shared:nearby_share_settings_behavior.m",
"//chrome/browser/resources/nearby_share/shared:nearby_visibility_page.m", "//chrome/browser/resources/nearby_share/shared:nearby_visibility_page.m",
"//ui/webui/resources/cr_elements/cr_link_row:cr_link_row.m",
"//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js:load_time_data",
] ]
extra_deps = [ ":nearby_share_subpage_module" ] extra_deps = [ ":nearby_share_subpage_module" ]
} }
......
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../controls/settings_toggle_button.html"> <link rel="import" href="../../controls/settings_toggle_button.html">
...@@ -101,6 +102,10 @@ ...@@ -101,6 +102,10 @@
id="visibilityDialog" on-close="onVisibilityDialogClose_"> id="visibilityDialog" on-close="onVisibilityDialogClose_">
</nearby-share-contact-visibility-dialog> </nearby-share-contact-visibility-dialog>
</template> </template>
<cr-link-row class="hr" external on-click="onManageContactsTap_"
label="$i18n{nearbyShareManageContactsRowTitle}"
sub-label="[[getManageContactsSubLabel_(manageContactsUrl_)]]">
</cr-link-row>
<div class="settings-box two-line"> <div class="settings-box two-line">
<div class="start"> <div class="start">
<div aria-hidden="true"> <div aria-hidden="true">
......
...@@ -59,6 +59,12 @@ Polymer({ ...@@ -59,6 +59,12 @@ Polymer({
value: false, value: false,
}, },
/** @private */
manageContactsUrl_: {
type: String,
value: () => loadTimeData.getString('nearbyShareManageContactsUrl')
},
/** /**
* Used by DeepLinkingBehavior to focus this page's deep links. * Used by DeepLinkingBehavior to focus this page's deep links.
* @type {!Set<!chromeos.settings.mojom.Setting>} * @type {!Set<!chromeos.settings.mojom.Setting>}
...@@ -148,6 +154,23 @@ Polymer({ ...@@ -148,6 +154,23 @@ Polymer({
this.showReceiveDialog_ = false; this.showReceiveDialog_ = false;
}, },
/**
* @param {!Event} event
* @private
*/
onManageContactsTap_(event) {
window.open(this.manageContactsUrl_);
},
/**
* @private
* @return {string} Sublabel for manage contacts row.
*/
getManageContactsSubLabel_() {
// Remove the protocol part of the contacts url.
return this.manageContactsUrl_.replace(/(^\w+:|^)\/\//, '');
},
/** /**
* @param {boolean} state boolean state that determines which string to show * @param {boolean} state boolean state that determines which string to show
* @param {string} onstr string to show when state is true * @param {string} onstr string to show when state is true
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "ui/base/webui/web_ui_util.h" #include "ui/base/webui/web_ui_util.h"
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/nearby_sharing/common/nearby_share_features.h" #include "chrome/browser/nearby_sharing/common/nearby_share_features.h"
#include "chrome/common/url_constants.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
namespace settings { namespace settings {
...@@ -255,6 +256,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) { ...@@ -255,6 +256,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) {
{"nearbyShareEditDeviceName", IDS_SETTINGS_NEARBY_SHARE_EDIT_DEVICE_NAME}, {"nearbyShareEditDeviceName", IDS_SETTINGS_NEARBY_SHARE_EDIT_DEVICE_NAME},
{"nearbyShareDeviceNameAriaDescription", {"nearbyShareDeviceNameAriaDescription",
IDS_SETTINGS_NEARBY_SHARE_DEVICE_NAME_ARIA_DESCRIPTION}, IDS_SETTINGS_NEARBY_SHARE_DEVICE_NAME_ARIA_DESCRIPTION},
{"nearbyShareManageContactsRowTitle",
IDS_SETTINGS_NEARBY_SHARE_MANAGE_CONTACTS_ROW_TITLE},
{"nearbyShareEditDataUsage", IDS_SETTINGS_NEARBY_SHARE_EDIT_DATA_USAGE}, {"nearbyShareEditDataUsage", IDS_SETTINGS_NEARBY_SHARE_EDIT_DATA_USAGE},
{"nearbyShareUpdateDataUsage", {"nearbyShareUpdateDataUsage",
IDS_SETTINGS_NEARBY_SHARE_UPDATE_DATA_USAGE}, IDS_SETTINGS_NEARBY_SHARE_UPDATE_DATA_USAGE},
...@@ -286,6 +289,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) { ...@@ -286,6 +289,8 @@ void AddNearbyShareData(content::WebUIDataSource* html_source) {
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddString("nearbyShareManageContactsUrl",
chrome::kNearbyShareManageContactsURL);
html_source->AddBoolean( html_source->AddBoolean(
"nearbySharingFeatureFlag", "nearbySharingFeatureFlag",
base::FeatureList::IsEnabled(features::kNearbySharing)); base::FeatureList::IsEnabled(features::kNearbySharing));
......
...@@ -418,6 +418,9 @@ const char kTabletModeGesturesLearnMoreURL[] = ...@@ -418,6 +418,9 @@ const char kTabletModeGesturesLearnMoreURL[] =
const char kWifiSyncLearnMoreURL[] = const char kWifiSyncLearnMoreURL[] =
"https://support.google.com/chromebook/?p=wifisync"; "https://support.google.com/chromebook/?p=wifisync";
extern const char kNearbyShareManageContactsURL[] =
"https://contacts.google.com";
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_MAC) #if defined(OS_MAC)
......
...@@ -381,6 +381,9 @@ extern const char kTabletModeGesturesLearnMoreURL[]; ...@@ -381,6 +381,9 @@ extern const char kTabletModeGesturesLearnMoreURL[];
// The URL for the help center article about Wi-Fi sync. // The URL for the help center article about Wi-Fi sync.
extern const char kWifiSyncLearnMoreURL[]; extern const char kWifiSyncLearnMoreURL[];
// The URL for contacts management in Nearby Share feature.
extern const char kNearbyShareManageContactsURL[];
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_MAC) #if defined(OS_MAC)
......
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