| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 has_deferred_task_ = true; | 342 has_deferred_task_ = true; |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (!clearing_all_views_.empty()) { | 346 if (!clearing_all_views_.empty()) { |
| 347 if (!clear_all_started_) | 347 if (!clear_all_started_) |
| 348 AnimateClearingOneNotification(); | 348 AnimateClearingOneNotification(); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 | 351 |
| 352 int new_height = GetHeightForWidth(child_area.width() + GetInsets().width()); | |
| 353 SetSize(gfx::Size(child_area.width() + GetInsets().width(), new_height)); | |
| 354 | |
| 355 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 352 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 356 switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval)) | 353 switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval)) |
| 357 AnimateNotificationsBelowTarget(); | 354 AnimateNotificationsBelowTarget(); |
| 358 else | 355 else |
| 359 AnimateNotifications(); | 356 AnimateNotifications(); |
| 360 | 357 |
| 358 // Should calculate and set new size after calling AnimateNotifications() |
| 359 // because fixed_height_ may be updated in it. |
| 360 int new_height = GetHeightForWidth(child_area.width() + GetInsets().width()); |
| 361 SetSize(gfx::Size(child_area.width() + GetInsets().width(), new_height)); |
| 362 |
| 361 adding_views_.clear(); | 363 adding_views_.clear(); |
| 362 deleting_views_.clear(); | 364 deleting_views_.clear(); |
| 363 | 365 |
| 364 if (!animator_.IsAnimating() && GetWidget()) | 366 if (!animator_.IsAnimating() && GetWidget()) |
| 365 GetWidget()->SynthesizeMouseMoveEvent(); | 367 GetWidget()->SynthesizeMouseMoveEvent(); |
| 366 } | 368 } |
| 367 | 369 |
| 368 // TODO(yoshiki): Remove this method. It is no longer maintained. | 370 // TODO(yoshiki): Remove this method. It is no longer maintained. |
| 369 void MessageListView::AnimateNotificationsBelowTarget() { | 371 void MessageListView::AnimateNotificationsBelowTarget() { |
| 370 int target_index = -1; | 372 int target_index = -1; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 base::TimeDelta::FromMilliseconds( | 568 base::TimeDelta::FromMilliseconds( |
| 567 kAnimateClearingNextNotificationDelayMS)); | 569 kAnimateClearingNextNotificationDelayMS)); |
| 568 } | 570 } |
| 569 } | 571 } |
| 570 | 572 |
| 571 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { | 573 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { |
| 572 SetRepositionTarget(target_rect); | 574 SetRepositionTarget(target_rect); |
| 573 } | 575 } |
| 574 | 576 |
| 575 } // namespace message_center | 577 } // namespace message_center |
| OLD | NEW |