Commit 4c3aedc0 authored by Tina Wang's avatar Tina Wang Committed by Commit Bot

[SendTabToSelf] Change confirmation notification string

Change the confirmation string from "Sending tab..." to
"Sending to [target device name]".

Bug: 953357
Change-Id: I5a0083859c17c8fd318158510749a863bc442b47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1616944Reviewed-by: default avatarJeffrey Cohen <jeffreycohen@chromium.org>
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660916}
parent a36bff3b
......@@ -112,13 +112,15 @@ void DesktopNotificationHandler::OnClick(
}
void DesktopNotificationHandler::DisplaySendingConfirmation(
const SendTabToSelfEntry& entry) {
const SendTabToSelfEntry& entry,
const std::string& target_device_name) {
const base::string16 confirm_str = l10n_util::GetStringFUTF16(
IDS_MESSAGE_NOTIFICATION_SEND_TAB_TO_SELF_CONFIRMATION_SUCCESS,
base::UTF8ToUTF16(target_device_name));
const GURL& url = entry.GetURL();
message_center::Notification notification(
message_center::NOTIFICATION_TYPE_SIMPLE,
kDesktopNotificationSharedPrefix + entry.GetGUID(),
l10n_util::GetStringUTF16(
IDS_MESSAGE_NOTIFICATION_SEND_TAB_TO_SELF_CONFIRMATION_SUCCESS),
kDesktopNotificationSharedPrefix + entry.GetGUID(), confirm_str,
base::UTF8ToUTF16(entry.GetTitle()), GetImageForNotification(),
base::UTF8ToUTF16(url.host()), url, message_center::NotifierId(url),
message_center::RichNotificationData(), /*delegate=*/nullptr);
......
......@@ -47,7 +47,8 @@ class DesktopNotificationHandler : public NotificationHandler,
// When the user share a tab, a confirmation notification will be shown.
// Displays a notification telling the user that the tab was successfully
// sent.
void DisplaySendingConfirmation(const SendTabToSelfEntry& entry);
void DisplaySendingConfirmation(const SendTabToSelfEntry& entry,
const std::string& target_device_name);
// Displays a notification telling the user that the tab could not be sent.
void DisplayFailureMessage(const GURL& url);
......
......@@ -36,7 +36,8 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) {
base::Time navigation_time = navigation_entry->GetTimestamp();
// TODO(crbug/946804) Add target device.
std::string target_device;
std::string target_device_guid;
std::string target_device_name;
SendTabToSelfModel* model =
SendTabToSelfSyncServiceFactory::GetForProfile(profile)
->GetSendTabToSelfModel();
......@@ -51,13 +52,14 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) {
const SendTabToSelfEntry* entry;
if (link_url.is_valid()) {
// When share a link.
entry = model->AddEntry(link_url, "", base::Time(), target_device);
entry = model->AddEntry(link_url, "", base::Time(), target_device_guid);
} else {
// When share a tab.
entry = model->AddEntry(url, title, navigation_time, target_device);
entry = model->AddEntry(url, title, navigation_time, target_device_guid);
}
if (entry) {
DesktopNotificationHandler(profile).DisplaySendingConfirmation(*entry);
DesktopNotificationHandler(profile).DisplaySendingConfirmation(
*entry, target_device_name);
} else {
DesktopNotificationHandler(profile).DisplayFailureMessage(url);
}
......
......@@ -768,7 +768,7 @@ need to be translated for each locale.-->
Shared from <ph name="DEVICE_NAME">$1<ex>Ted's Pixel 2</ex></ph>
</message>
<message name="IDS_MESSAGE_NOTIFICATION_SEND_TAB_TO_SELF_CONFIRMATION_SUCCESS" desc="The title text for the comformation notification when the user successfully share a tab to other devices.">
Sending tab...
Sending to <ph name="DEVICE_NAME">$1<ex>Ted's Pixel 2</ex></ph>
</message>
<message name="IDS_MESSAGE_NOTIFICATION_SEND_TAB_TO_SELF_CONFIRMATION_FAILURE_TITLE" desc="The title text for the comformation notification when the user failed to share a tab to other devices.">
Failed to send
......
81ac47988e7b25274c7281f2ccb43b3e12f7ecfb
\ No newline at end of file
54efb176961f4a490a8a9d231694b23568fe5278
\ No newline at end of file
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