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

Unified Diff: ui/message_center/views/message_center_view.cc

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments applied Created 7 years, 6 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: ui/message_center/views/message_center_view.cc
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 59679d5e8e985ea805112ae3183243b31336f8bb..8fd5d630cb94c75d55f0c151bb05f9e3bb2f4de6 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -847,9 +847,11 @@ void MessageCenterButtonBar::SetCloseAllVisible(bool visible) {
MessageCenterView::MessageCenterView(MessageCenter* message_center,
MessageCenterTray* tray,
int max_height,
- bool initially_settings_visible)
+ bool initially_settings_visible,
+ bool buttons_at_top)
: message_center_(message_center),
tray_(tray),
+ buttons_at_top_(buttons_at_top),
settings_visible_(initially_settings_visible) {
message_center_->AddObserver(this);
set_notify_enter_exit_on_child(true);
@@ -979,13 +981,17 @@ void MessageCenterView::Layout() {
if (settings_transition_animation_ &&
settings_transition_animation_->is_animating() &&
settings_transition_animation_->current_part_index() == 0) {
- button_bar_->SetBounds(0, height() - button_height, width(), button_height);
return;
}
- scroller_->SetBounds(0, 0, width(), height() - button_height - between_child);
- settings_view_->SetBounds(
- 0, 0, width(), height() - button_height - between_child);
+ scroller_->SetBounds(0,
+ buttons_at_top_ ? button_height : 0,
+ width(),
+ height() - button_height - between_child);
+ settings_view_->SetBounds(0,
+ buttons_at_top_ ? button_height : 0,
+ width(),
+ height() - button_height - between_child);
bool is_scrollable = false;
if (scroller_->visible())
@@ -1002,7 +1008,10 @@ void MessageCenterView::Layout() {
button_bar_->SchedulePaint();
}
- button_bar_->SetBounds(0, height() - button_height, width(), button_height);
+ button_bar_->SetBounds(0,
+ buttons_at_top_ ? 0 : height() - button_height,
+ width(),
+ button_height);
if (GetWidget())
GetWidget()->GetRootView()->SchedulePaint();
}
@@ -1135,32 +1144,33 @@ void MessageCenterView::OnNotificationUpdated(const std::string& id) {
}
void MessageCenterView::AnimationEnded(const ui::Animation* animation) {
- DCHECK_EQ(animation, settings_transition_animation_.get());
-
- source_view_->SetVisible(false);
- target_view_->SetVisible(true);
- if (source_view_->layer())
- source_view_->layer()->SetOpacity(1.0);
- if (target_view_->layer())
- target_view_->layer()->SetOpacity(1.0);
- settings_transition_animation_.reset();
- PreferredSizeChanged();
- Layout();
+ if (animation == settings_transition_animation_.get()) {
dewittj 2013/07/02 18:43:32 Why remove the DCHECK?
sidharthms 2013/07/02 21:01:16 Done.
+ source_view_->SetVisible(false);
+ target_view_->SetVisible(true);
+ if (source_view_->layer())
+ source_view_->layer()->SetOpacity(1.0);
+ if (target_view_->layer())
+ target_view_->layer()->SetOpacity(1.0);
+ settings_transition_animation_.reset();
+ PreferredSizeChanged();
+ Layout();
+ }
}
void MessageCenterView::AnimationProgressed(const ui::Animation* animation) {
- DCHECK_EQ(animation, settings_transition_animation_.get());
- PreferredSizeChanged();
- if (settings_transition_animation_->current_part_index() == 1 &&
- source_view_->layer()) {
- source_view_->layer()->SetOpacity(
- 1.0 - settings_transition_animation_->GetCurrentValue());
- SchedulePaint();
- } else if (settings_transition_animation_->current_part_index() == 2 &&
- target_view_->layer()) {
- target_view_->layer()->SetOpacity(
- settings_transition_animation_->GetCurrentValue());
- SchedulePaint();
+ if (animation == settings_transition_animation_.get()) {
dewittj 2013/07/02 18:43:32 why remove the DCHECK?
sidharthms 2013/07/02 21:01:16 Done.
+ PreferredSizeChanged();
+ if (settings_transition_animation_->current_part_index() == 1 &&
+ source_view_->layer()) {
+ source_view_->layer()->SetOpacity(
+ 1.0 - settings_transition_animation_->GetCurrentValue());
+ SchedulePaint();
+ } else if (settings_transition_animation_->current_part_index() == 2 &&
+ target_view_->layer()) {
+ target_view_->layer()->SetOpacity(
+ settings_transition_animation_->GetCurrentValue());
+ SchedulePaint();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698