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

Side by Side Diff: ui/message_center/views/notification_view.cc

Issue 2620133003: Set slide_out_enabled property for CustomNotification (Closed)
Patch Set: Addressed comment and added tests 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 views::Widget* widget = GetWidget(); 659 views::Widget* widget = GetWidget();
660 if (widget != NULL) { 660 if (widget != NULL) {
661 widget->SetSize(widget->GetContentsView()->GetPreferredSize()); 661 widget->SetSize(widget->GetContentsView()->GetPreferredSize());
662 GetWidget()->SynthesizeMouseMoveEvent(); 662 GetWidget()->SynthesizeMouseMoveEvent();
663 } 663 }
664 } 664 }
665 } 665 }
666 666
667 void NotificationView::CreateOrUpdateCloseButtonView( 667 void NotificationView::CreateOrUpdateCloseButtonView(
668 const Notification& notification) { 668 const Notification& notification) {
669 set_slide_out_enabled(!notification.pinned());
670
671 if (!notification.pinned() && !close_button_) { 669 if (!notification.pinned() && !close_button_) {
672 PaddedButton* close = new PaddedButton(this); 670 PaddedButton* close = new PaddedButton(this);
673 close->SetPadding(-kCloseIconRightPadding, kCloseIconTopPadding); 671 close->SetPadding(-kCloseIconRightPadding, kCloseIconTopPadding);
674 close->SetNormalImage(IDR_NOTIFICATION_CLOSE); 672 close->SetNormalImage(IDR_NOTIFICATION_CLOSE);
675 close->SetHoveredImage(IDR_NOTIFICATION_CLOSE_HOVER); 673 close->SetHoveredImage(IDR_NOTIFICATION_CLOSE_HOVER);
676 close->SetPressedImage(IDR_NOTIFICATION_CLOSE_PRESSED); 674 close->SetPressedImage(IDR_NOTIFICATION_CLOSE_PRESSED);
677 close->set_animate_on_state_change(false); 675 close->set_animate_on_state_change(false);
678 close->SetAccessibleName(l10n_util::GetStringUTF16( 676 close->SetAccessibleName(l10n_util::GetStringUTF16(
679 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); 677 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME));
680 close->SetTooltipText(l10n_util::GetStringUTF16( 678 close->SetTooltipText(l10n_util::GetStringUTF16(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 720
723 return message_line_limit; 721 return message_line_limit;
724 } 722 }
725 723
726 int NotificationView::GetMessageHeight(int width, int limit) const { 724 int NotificationView::GetMessageHeight(int width, int limit) const {
727 return message_view_ ? 725 return message_view_ ?
728 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 726 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
729 } 727 }
730 728
731 } // namespace message_center 729 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698