Index: ash/common/system/chromeos/network/tray_sms.cc |
diff --git a/ash/common/system/chromeos/network/tray_sms.cc b/ash/common/system/chromeos/network/tray_sms.cc |
index 45781d3f1fdedb31c44c4d560e95dc031e9a56b4..24194b5feac0707053d32259ef8022aef08e591f 100644 |
--- a/ash/common/system/chromeos/network/tray_sms.cc |
+++ b/ash/common/system/chromeos/network/tray_sms.cc |
@@ -5,6 +5,7 @@ |
#include "ash/common/system/chromeos/network/tray_sms.h" |
#include "ash/common/material_design/material_design_controller.h" |
+#include "ash/common/metrics/user_metrics_action.h" |
#include "ash/common/system/tray/fixed_sized_scroll_view.h" |
#include "ash/common/system/tray/system_tray_bubble.h" |
#include "ash/common/system/tray/tray_constants.h" |
@@ -13,6 +14,7 @@ |
#include "ash/common/system/tray/tray_item_view.h" |
#include "ash/common/system/tray/tray_notification_view.h" |
#include "ash/common/system/tray/view_click_listener.h" |
+#include "ash/common/wm_shell.h" |
#include "ash/system/tray/system_tray.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -123,7 +125,10 @@ class TraySms::SmsMessageView : public views::View, |
// Overridden from ButtonListener. |
void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
- owner_->RemoveMessage(index_); |
+ if (owner_->RemoveMessage(index_)) { |
+ WmShell::Get()->RecordUserMetricsAction( |
+ UMA_STATUS_AREA_SMS_DISMISS_MSG_DETAILED_VIEW); |
+ } |
owner_->Update(false); |
} |
@@ -271,7 +276,12 @@ class TraySms::SmsNotificationView : public TrayNotificationView { |
} |
// Overridden from TrayNotificationView: |
- void OnClose() override { tray_sms()->RemoveMessage(message_index_); } |
+ void OnClose() override { |
+ if (tray_sms()->RemoveMessage(message_index_)) { |
+ WmShell::Get()->RecordUserMetricsAction( |
+ UMA_STATUS_AREA_SMS_DISMISS_MSG_NOTIFICATION_VIEW); |
+ } |
+ } |
void OnClickAction() override { owner()->PopupDetailedView(0, true); } |
@@ -315,6 +325,7 @@ views::View* TraySms::CreateDetailedView(LoginStatus status) { |
if (messages_.empty()) |
return NULL; |
detailed_ = new SmsDetailedView(this); |
+ WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_DETAILED_SMS_VIEW); |
return detailed_; |
} |
@@ -388,9 +399,11 @@ bool TraySms::GetLatestMessage(size_t* index, |
return true; |
} |
-void TraySms::RemoveMessage(size_t index) { |
- if (index < messages_.GetSize()) |
- messages_.Remove(index, NULL); |
+bool TraySms::RemoveMessage(size_t index) { |
+ if (index >= messages_.GetSize()) |
+ return false; |
+ messages_.Remove(index, NULL); |
stevenjb
2016/07/07 17:54:36
NULL -> nullptr throughout the file
bruthig
2016/07/07 18:01:38
Done.
|
+ return true; |
} |
void TraySms::Update(bool notify) { |