Commit 23288e45 authored by Curt Clemens's avatar Curt Clemens Committed by Chromium LUCI CQ

[Nearby] Handle clicking success notification body

If the body of a success notification is clicked, then the primary
action should be taken instead of doing nothing.

Fixed: 1168293
Change-Id: I494bcf53ec1bb1cd615a30e417c95e01877c9431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2643856Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Curt Clemens <cclem@google.com>
Cr-Commit-Position: refs/heads/master@{#846168}
parent 91616862
......@@ -376,20 +376,21 @@ class SuccessNotificationDelegate : public NearbyNotificationDelegate {
// NearbyNotificationDelegate:
void OnClick(const std::string& notification_id,
const base::Optional<int>& action_index) override {
// Ignore clicks on notification body.
if (!action_index)
return;
switch (type_) {
case NearbyNotificationManager::ReceivedContentType::kText:
DCHECK_EQ(0, *action_index);
CopyTextToClipboard();
if (action_index.has_value() && action_index.value() == 0) {
// Don't overwrite clipboard if user clicks notification body
CopyTextToClipboard();
}
break;
case NearbyNotificationManager::ReceivedContentType::kSingleUrl:
DCHECK_EQ(0, *action_index);
OpenTextLink();
break;
case NearbyNotificationManager::ReceivedContentType::kSingleImage:
if (!action_index.has_value()) {
OpenDownloadsFolder();
break;
}
switch (*action_index) {
case 0:
OpenDownloadsFolder();
......@@ -403,7 +404,6 @@ class SuccessNotificationDelegate : public NearbyNotificationDelegate {
}
break;
case NearbyNotificationManager::ReceivedContentType::kFiles:
DCHECK_EQ(0, *action_index);
OpenDownloadsFolder();
break;
}
......
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