diff options
Diffstat (limited to 'chromium/ui/message_center/views/notification_button.cc')
-rw-r--r-- | chromium/ui/message_center/views/notification_button.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/chromium/ui/message_center/views/notification_button.cc b/chromium/ui/message_center/views/notification_button.cc index 7ef5295ad22..75219e8d3dc 100644 --- a/chromium/ui/message_center/views/notification_button.cc +++ b/chromium/ui/message_center/views/notification_button.cc @@ -48,13 +48,13 @@ void NotificationButton::SetIcon(const gfx::ImageSkia& image) { icon_->SetImage(image); icon_->SetHorizontalAlignment(views::ImageView::LEADING); icon_->SetVerticalAlignment(views::ImageView::LEADING); - icon_->set_border(views::Border::CreateEmptyBorder( + icon_->SetBorder(views::Border::CreateEmptyBorder( message_center::kButtonIconTopPadding, 0, 0, 0)); AddChildViewAt(icon_, 0); } } -void NotificationButton::SetTitle(const string16& title) { +void NotificationButton::SetTitle(const base::string16& title) { if (title_ != NULL) delete title_; // This removes the title from this view's children. if (title.empty()) { @@ -64,19 +64,19 @@ void NotificationButton::SetTitle(const string16& title) { title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_->SetEnabledColor(message_center::kRegularTextColor); title_->SetBackgroundColor(kRegularTextBackgroundColor); - title_->set_border(views::Border::CreateEmptyBorder( - kButtonTitleTopPadding, 0, 0, 0)); + title_->SetBorder( + views::Border::CreateEmptyBorder(kButtonTitleTopPadding, 0, 0, 0)); AddChildView(title_); } SetAccessibleName(title); } -gfx::Size NotificationButton::GetPreferredSize() { +gfx::Size NotificationButton::GetPreferredSize() const { return gfx::Size(message_center::kNotificationWidth, message_center::kButtonHeight); } -int NotificationButton::GetHeightForWidth(int width) { +int NotificationButton::GetHeightForWidth(int width) const { return message_center::kButtonHeight; } @@ -98,6 +98,14 @@ void NotificationButton::OnBlur() { SchedulePaint(); } +void NotificationButton::ViewHierarchyChanged( + const ViewHierarchyChangedDetails& details) { + // We disable view hierarchy change detection in the parent + // because it resets the hoverstate, which we do not want + // when we update the view to contain a new label or image. + views::View::ViewHierarchyChanged(details); +} + void NotificationButton::StateChanged() { if (state() == STATE_HOVERED || state() == STATE_PRESSED) { set_background(views::Background::CreateSolidBackground( |