| Index: chrome/browser/ui/panels/panel_overflow_strip.cc
|
| diff --git a/chrome/browser/ui/panels/panel_overflow_strip.cc b/chrome/browser/ui/panels/panel_overflow_strip.cc
|
| index 80bb3de3803ccb426bfd64ff16041b5a2d783144..ffdb8f25c5e01398d173a71d62a4dc4a389681d0 100644
|
| --- a/chrome/browser/ui/panels/panel_overflow_strip.cc
|
| +++ b/chrome/browser/ui/panels/panel_overflow_strip.cc
|
| @@ -8,13 +8,11 @@
|
| #include "chrome/browser/ui/panels/panel_manager.h"
|
| #include "chrome/browser/ui/panels/panel_mouse_watcher.h"
|
| #include "chrome/browser/ui/panels/panel_strip.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| +#include "content/public/browser/notification_service.h"
|
| #include "ui/base/animation/slide_animation.h"
|
|
|
| namespace {
|
| -// The width of the overflow area that is expanded to show more info, i.e.
|
| -// titles, when the mouse hovers over the area.
|
| -const int kOverflowAreaHoverWidth = 200;
|
| -
|
| // Maximium number of overflow panels allowed to be shown.
|
| const size_t kMaxVisibleOverflowPanelsAllowed = 6;
|
|
|
| @@ -24,6 +22,7 @@ const int kOverflowHoverAnimationMs = 180;
|
|
|
| PanelOverflowStrip::PanelOverflowStrip(PanelManager* panel_manager)
|
| : panel_manager_(panel_manager),
|
| + max_visible_panels_(kMaxVisibleOverflowPanelsAllowed),
|
| are_overflow_titles_shown_(false),
|
| overflow_hover_animator_start_width_(0),
|
| overflow_hover_animator_end_width_(0) {
|
| @@ -106,7 +105,6 @@ void PanelOverflowStrip::DoRefresh(size_t start_index, size_t end_index) {
|
| if (panels_.empty() || start_index == panels_.size())
|
| return;
|
|
|
| - DCHECK(start_index < panels_.size());
|
| DCHECK(end_index < panels_.size());
|
|
|
| for (size_t index = start_index; index <= end_index; ++index) {
|
| @@ -132,7 +130,7 @@ gfx::Rect PanelOverflowStrip::ComputeLayout(
|
| // area.
|
| bounds.set_width(kOverflowAreaHoverWidth);
|
| bounds.set_height(iconified_size.height());
|
| - } else if (index < kMaxVisibleOverflowPanelsAllowed) {
|
| + } else if (static_cast<int>(index) < max_visible_panels_) {
|
| // Only the icon is visible.
|
| bounds.set_width(iconified_size.width());
|
| bounds.set_height(iconified_size.height());
|
| @@ -162,8 +160,8 @@ bool PanelOverflowStrip::ShouldShowOverflowTitles(
|
| top_visible_panel = panels_.back();
|
| } else {
|
| width = display_area_.width();
|
| - top_visible_panel = panels_.size() >= kMaxVisibleOverflowPanelsAllowed ?
|
| - panels_[kMaxVisibleOverflowPanelsAllowed - 1] : panels_.back();
|
| + top_visible_panel = num_panels() >= max_visible_panels_ ?
|
| + panels_[max_visible_panels_ - 1] : panels_.back();
|
| }
|
| return mouse_position.x() <= display_area_.x() + width &&
|
| top_visible_panel->GetBounds().y() <= mouse_position.y() &&
|
| @@ -202,6 +200,13 @@ void PanelOverflowStrip::ShowOverflowTitles(bool show_overflow_titles) {
|
| overflow_hover_animator_->Show();
|
| }
|
|
|
| +void PanelOverflowStrip::AnimationEnded(const ui::Animation* animation) {
|
| + content::NotificationService::current()->Notify(
|
| + chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
|
| + content::Source<PanelOverflowStrip>(this),
|
| + content::NotificationService::NoDetails());
|
| +}
|
| +
|
| void PanelOverflowStrip::AnimationProgressed(const ui::Animation* animation) {
|
| int current_width = overflow_hover_animator_->CurrentValueBetween(
|
| overflow_hover_animator_start_width_, overflow_hover_animator_end_width_);
|
| @@ -212,7 +217,7 @@ void PanelOverflowStrip::AnimationProgressed(const ui::Animation* animation) {
|
| Panel* overflow_panel = panels_[i];
|
| gfx::Rect bounds = overflow_panel->GetBounds();
|
|
|
| - if (i >= kMaxVisibleOverflowPanelsAllowed && end_of_shrinking) {
|
| + if (static_cast<int>(i) >= max_visible_panels_ && end_of_shrinking) {
|
| bounds.set_width(0);
|
| bounds.set_height(0);
|
| } else {
|
|
|