Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: ash/common/system/tray/tray_notification_view.cc

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/tray/tray_notification_view.cc
diff --git a/ash/common/system/tray/tray_notification_view.cc b/ash/common/system/tray/tray_notification_view.cc
index f6a16a8a49257fbda4c8ba0e88e987c5fa33a18c..da1a89870d41415216f389fded3497074a51950d 100644
--- a/ash/common/system/tray/tray_notification_view.cc
+++ b/ash/common/system/tray/tray_notification_view.cc
@@ -29,8 +29,6 @@ const gfx::VectorIcon& ResourceIdToVectorIcon(int resource_id) {
switch (resource_id) {
case IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK:
return kSystemMenuAccessibilityIcon;
- case IDR_AURA_UBER_TRAY_SMS:
- return kSystemMenuSmsIcon;
default:
NOTREACHED();
break;
@@ -41,8 +39,8 @@ const gfx::VectorIcon& ResourceIdToVectorIcon(int resource_id) {
} // namespace
-TrayNotificationView::TrayNotificationView(SystemTrayItem* owner, int icon_id)
- : owner_(owner), icon_id_(icon_id), icon_(NULL), autoclose_delay_(0) {}
+TrayNotificationView::TrayNotificationView(int icon_id)
+ : icon_id_(icon_id), icon_(NULL) {}
TrayNotificationView::~TrayNotificationView() {}
@@ -52,12 +50,11 @@ void TrayNotificationView::InitView(views::View* contents) {
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- views::ImageButton* close_button = new views::ImageButton(this);
+ views::ImageView* close_button = new views::ImageView();
close_button->SetImage(
- views::CustomButton::STATE_NORMAL,
ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MESSAGE_CLOSE));
- close_button->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
- views::ImageButton::ALIGN_MIDDLE);
+ close_button->SetHorizontalAlignment(views::ImageView::CENTER);
+ close_button->SetVerticalAlignment(views::ImageView::CENTER);
icon_ = new views::ImageView;
if (icon_id_ != 0) {
@@ -105,68 +102,4 @@ void TrayNotificationView::InitView(views::View* contents) {
layout->AddPaddingRow(0, kTrayPopupPaddingBetweenItems);
}
-void TrayNotificationView::UpdateView(views::View* new_contents) {
tdanderson 2017/01/26 22:19:07 I'm a bit confused why you're deleting all of this
yiyix 2017/02/02 20:43:57 My understanding is that SystemTrayBubble::CreateI
tdanderson 2017/02/07 00:15:45 AccessibilityPopupView is a subclass of TrayNotifi
yiyix 2017/02/07 22:03:22 I have tried and AccessibilityPopupView is auto cl
- RemoveAllChildViews(true);
- InitView(new_contents);
- Layout();
- PreferredSizeChanged();
- SchedulePaint();
-}
-
-void TrayNotificationView::StartAutoCloseTimer(int seconds) {
- autoclose_.Stop();
- autoclose_delay_ = seconds;
- if (autoclose_delay_) {
- autoclose_.Start(FROM_HERE, base::TimeDelta::FromSeconds(autoclose_delay_),
- this, &TrayNotificationView::HandleClose);
- }
-}
-
-void TrayNotificationView::StopAutoCloseTimer() {
- autoclose_.Stop();
-}
-
-void TrayNotificationView::RestartAutoCloseTimer() {
- if (autoclose_delay_)
- StartAutoCloseTimer(autoclose_delay_);
-}
-
-void TrayNotificationView::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- HandleClose();
-}
-
-bool TrayNotificationView::OnMousePressed(const ui::MouseEvent& event) {
- HandleClickAction();
- return true;
-}
-
-void TrayNotificationView::OnGestureEvent(ui::GestureEvent* event) {
- SlideOutView::OnGestureEvent(event);
- if (event->handled())
- return;
- if (event->type() != ui::ET_GESTURE_TAP)
- return;
- HandleClickAction();
- event->SetHandled();
-}
-
-void TrayNotificationView::OnClose() {}
-
-void TrayNotificationView::OnClickAction() {}
-
-void TrayNotificationView::OnSlideOut() {
- owner_->HideNotificationView();
-}
-
-void TrayNotificationView::HandleClose() {
- OnClose();
- owner_->HideNotificationView();
-}
-
-void TrayNotificationView::HandleClickAction() {
- HandleClose();
- OnClickAction();
-}
-
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698