Commit 28e5fe5c authored by Ben Chan's avatar Ben Chan Committed by Commit Bot

Collapse whitespaces when showing an SMS message in notification.

The notification view for SMS messages is limited to show at most 3
lines, which is not sufficient to show the full content of a SMS message
with multiple line breaks. As a workaround, this CL collapses
whitespaces in a SMS message to minimize the number of lines needed to
show the SMS message in the notification view.

Bug: 775786
Change-Id: I807a50c888a1d36439b19805e946d7fb261de633
Reviewed-on: https://chromium-review.googlesource.com/821850
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523546}
parent 1fdf0702
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/system/system_notifier.h" #include "ash/system/system_notifier.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromeos/network/network_event_log.h" #include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_handler.h" #include "chromeos/network/network_handler.h"
...@@ -38,7 +39,9 @@ void ShowNotification(const base::DictionaryValue* message, ...@@ -38,7 +39,9 @@ void ShowNotification(const base::DictionaryValue* message,
notification = system_notifier::CreateSystemNotification( notification = system_notifier::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, message_center::NOTIFICATION_TYPE_SIMPLE,
kNotificationId + std::to_string(message_id), kNotificationId + std::to_string(message_id),
base::ASCIIToUTF16(message_number), base::UTF8ToUTF16(message_text), base::ASCIIToUTF16(message_number),
base::CollapseWhitespace(base::UTF8ToUTF16(message_text),
false /* trim_sequences_with_line_breaks */),
gfx::Image(gfx::CreateVectorIcon(kSystemMenuSmsIcon, kMenuIconSize, gfx::Image(gfx::CreateVectorIcon(kSystemMenuSmsIcon, kMenuIconSize,
kMenuIconColor)), kMenuIconColor)),
base::string16(), GURL(), base::string16(), GURL(),
......
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