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( ...@@ -112,13 +112,15 @@ void DesktopNotificationHandler::OnClick(
} }
void DesktopNotificationHandler::DisplaySendingConfirmation( 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(); const GURL& url = entry.GetURL();
message_center::Notification notification( message_center::Notification notification(
message_center::NOTIFICATION_TYPE_SIMPLE, message_center::NOTIFICATION_TYPE_SIMPLE,
kDesktopNotificationSharedPrefix + entry.GetGUID(), kDesktopNotificationSharedPrefix + entry.GetGUID(), confirm_str,
l10n_util::GetStringUTF16(
IDS_MESSAGE_NOTIFICATION_SEND_TAB_TO_SELF_CONFIRMATION_SUCCESS),
base::UTF8ToUTF16(entry.GetTitle()), GetImageForNotification(), base::UTF8ToUTF16(entry.GetTitle()), GetImageForNotification(),
base::UTF8ToUTF16(url.host()), url, message_center::NotifierId(url), base::UTF8ToUTF16(url.host()), url, message_center::NotifierId(url),
message_center::RichNotificationData(), /*delegate=*/nullptr); message_center::RichNotificationData(), /*delegate=*/nullptr);
......
...@@ -47,7 +47,8 @@ class DesktopNotificationHandler : public NotificationHandler, ...@@ -47,7 +47,8 @@ class DesktopNotificationHandler : public NotificationHandler,
// When the user share a tab, a confirmation notification will be shown. // When the user share a tab, a confirmation notification will be shown.
// Displays a notification telling the user that the tab was successfully // Displays a notification telling the user that the tab was successfully
// sent. // 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. // Displays a notification telling the user that the tab could not be sent.
void DisplayFailureMessage(const GURL& url); void DisplayFailureMessage(const GURL& url);
......
...@@ -36,7 +36,8 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) { ...@@ -36,7 +36,8 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) {
base::Time navigation_time = navigation_entry->GetTimestamp(); base::Time navigation_time = navigation_entry->GetTimestamp();
// TODO(crbug/946804) Add target device. // TODO(crbug/946804) Add target device.
std::string target_device; std::string target_device_guid;
std::string target_device_name;
SendTabToSelfModel* model = SendTabToSelfModel* model =
SendTabToSelfSyncServiceFactory::GetForProfile(profile) SendTabToSelfSyncServiceFactory::GetForProfile(profile)
->GetSendTabToSelfModel(); ->GetSendTabToSelfModel();
...@@ -51,13 +52,14 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) { ...@@ -51,13 +52,14 @@ void CreateNewEntry(content::WebContents* tab, const GURL& link_url) {
const SendTabToSelfEntry* entry; const SendTabToSelfEntry* entry;
if (link_url.is_valid()) { if (link_url.is_valid()) {
// When share a link. // When share a link.
entry = model->AddEntry(link_url, "", base::Time(), target_device); entry = model->AddEntry(link_url, "", base::Time(), target_device_guid);
} else { } else {
// When share a tab. // 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) { if (entry) {
DesktopNotificationHandler(profile).DisplaySendingConfirmation(*entry); DesktopNotificationHandler(profile).DisplaySendingConfirmation(
*entry, target_device_name);
} else { } else {
DesktopNotificationHandler(profile).DisplayFailureMessage(url); DesktopNotificationHandler(profile).DisplayFailureMessage(url);
} }
......
...@@ -768,7 +768,7 @@ need to be translated for each locale.--> ...@@ -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> Shared from <ph name="DEVICE_NAME">$1<ex>Ted's Pixel 2</ex></ph>
</message> </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."> <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>
<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."> <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 Failed to send
......
81ac47988e7b25274c7281f2ccb43b3e12f7ecfb 54efb176961f4a490a8a9d231694b23568fe5278
\ No newline at end of file \ 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