Index: ui/message_center/views/notification_view_md.cc |
diff --git a/ui/message_center/views/notification_view_md.cc b/ui/message_center/views/notification_view_md.cc |
index 93c99752ca17cc12aac05f893aa70fdb9dff38a5..5426c6f889632a8d1da6236046340d5950f5de7a 100644 |
--- a/ui/message_center/views/notification_view_md.cc |
+++ b/ui/message_center/views/notification_view_md.cc |
@@ -117,8 +117,6 @@ |
explicit ItemView(const message_center::NotificationItem& item); |
~ItemView() override; |
- const char* GetClassName() const override; |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(ItemView); |
}; |
@@ -145,10 +143,6 @@ |
ItemView::~ItemView() = default; |
-const char* ItemView::GetClassName() const { |
- return "ItemView"; |
-} |
- |
// CompactTitleMessageView ///////////////////////////////////////////////////// |
// CompactTitleMessageView shows notification title and message in a single |
@@ -158,8 +152,6 @@ |
explicit CompactTitleMessageView(); |
~CompactTitleMessageView() override; |
- const char* GetClassName() const override; |
- |
void OnPaint(gfx::Canvas* canvas) override; |
void set_title(const base::string16& title) { title_ = title; } |
@@ -175,11 +167,7 @@ |
views::Label* message_view_ = nullptr; |
}; |
-CompactTitleMessageView::~CompactTitleMessageView() = default; |
- |
-const char* CompactTitleMessageView::GetClassName() const { |
- return "CompactTitleMessageView"; |
-} |
+CompactTitleMessageView::~CompactTitleMessageView() {} |
CompactTitleMessageView::CompactTitleMessageView() { |
SetLayoutManager(new views::FillLayout()); |
@@ -242,7 +230,6 @@ |
~NotificationButtonMD() override; |
void SetText(const base::string16& text) override; |
- const char* GetClassName() const override; |
std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
const override; |
@@ -273,10 +260,6 @@ |
views::LabelButton::SetText(base::i18n::ToUpper(text)); |
} |
-const char* NotificationButtonMD::GetClassName() const { |
- return "NotificationButtonMD"; |
-} |
- |
std::unique_ptr<views::InkDropHighlight> |
NotificationButtonMD::CreateInkDropHighlight() const { |
std::unique_ptr<views::InkDropHighlight> highlight = |
@@ -332,12 +315,10 @@ |
CreateOrUpdateIconView(notification); |
CreateOrUpdateSmallIconView(notification); |
CreateOrUpdateImageView(notification); |
+ CreateOrUpdateActionButtonViews(notification); |
CreateOrUpdateCloseButtonView(notification); |
CreateOrUpdateSettingsButtonView(notification); |
UpdateViewForExpandedState(expanded_); |
- // Should be called at the last because SynthesizeMouseMoveEvent() requires |
- // everything is in the right location when called. |
- CreateOrUpdateActionButtonViews(notification); |
} |
NotificationViewMD::NotificationViewMD(MessageCenterController* controller, |
@@ -502,10 +483,8 @@ |
void NotificationViewMD::CreateOrUpdateTitleView( |
const Notification& notification) { |
- if (notification.title().empty() || |
- notification.type() == NOTIFICATION_TYPE_PROGRESS) { |
- if (title_view_) |
- left_content_->RemoveChildView(title_view_); |
+ if (notification.type() == NOTIFICATION_TYPE_PROGRESS) { |
+ left_content_->RemoveChildView(title_view_); |
title_view_ = nullptr; |
return; |
} |
@@ -560,8 +539,7 @@ |
void NotificationViewMD::CreateOrUpdateCompactTitleMessageView( |
const Notification& notification) { |
if (notification.type() != NOTIFICATION_TYPE_PROGRESS) { |
- if (compact_title_message_view_) |
- left_content_->RemoveChildView(compact_title_message_view_); |
+ left_content_->RemoveChildView(compact_title_message_view_); |
compact_title_message_view_ = nullptr; |
return; |
} |
@@ -578,8 +556,7 @@ |
void NotificationViewMD::CreateOrUpdateProgressBarView( |
const Notification& notification) { |
if (notification.type() != NOTIFICATION_TYPE_PROGRESS) { |
- if (progress_bar_view_) |
- left_content_->RemoveChildView(progress_bar_view_); |
+ left_content_->RemoveChildView(progress_bar_view_); |
progress_bar_view_ = nullptr; |
header_row_->ClearProgress(); |
return; |
@@ -627,8 +604,7 @@ |
const Notification& notification) { |
if (notification.type() == NOTIFICATION_TYPE_PROGRESS || |
notification.type() == NOTIFICATION_TYPE_MULTIPLE) { |
- if (icon_view_) |
- right_content_->RemoveChildView(icon_view_); |
+ right_content_->RemoveChildView(icon_view_); |
icon_view_ = nullptr; |
return; |
} |
@@ -720,14 +696,11 @@ |
} |
} |
- // Inherit mouse hover state when action button views reset. |
- // If the view is not expanded, there should be no hover state. |
- if (new_buttons && expanded_) { |
+ if (new_buttons) { |
+ // TODO(fukino): Investigate if this Layout() is necessary. |
+ Layout(); |
views::Widget* widget = GetWidget(); |
- if (widget) { |
- // This Layout() is needed because button should be in the right location |
- // in the view hierarchy when SynthesizeMouseMoveEvent() is called. |
- Layout(); |
+ if (widget != NULL) { |
widget->SetSize(widget->GetContentsView()->GetPreferredSize()); |
GetWidget()->SynthesizeMouseMoveEvent(); |
} |