| Index: chrome/browser/ui/panels/panel_strip.cc
|
| diff --git a/chrome/browser/ui/panels/panel_strip.cc b/chrome/browser/ui/panels/panel_strip.cc
|
| index 03289f1c2a6ba81c00d3936ebec19fbe4017e302..71f8a287392fc4180348d58543bd6b62ffbb589e 100644
|
| --- a/chrome/browser/ui/panels/panel_strip.cc
|
| +++ b/chrome/browser/ui/panels/panel_strip.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/panels/panel_manager.h"
|
| #include "chrome/browser/ui/panels/panel_mouse_watcher.h"
|
| +#include "chrome/browser/ui/panels/panel_overflow_strip.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_source.h"
|
| @@ -139,7 +140,8 @@ void PanelStrip::AddNewPanel(Panel* panel) {
|
| overflow_action_factory_.GetWeakPtr(),
|
| panel,
|
| true), // new panel
|
| - kMoveNewPanelToOverflowDelayMilliseconds);
|
| + remove_delays_for_testing_ ?
|
| + 0 : kMoveNewPanelToOverflowDelayMilliseconds);
|
| }
|
| panel->Initialize(gfx::Rect(x, y, width, height));
|
| }
|
| @@ -205,6 +207,7 @@ bool PanelStrip::DoRemove(Panel* panel) {
|
| DecrementMinimizedPanels();
|
|
|
| panels_.erase(iter);
|
| + panel_manager_->OnPanelRemoved(panel);
|
| return true;
|
| }
|
|
|
| @@ -340,20 +343,37 @@ void PanelStrip::EndDragging(bool cancelled) {
|
| }
|
|
|
| void PanelStrip::OnPanelExpansionStateChanged(
|
| - Panel::ExpansionState old_state, Panel::ExpansionState new_state) {
|
| - DCHECK_NE(new_state, old_state);
|
| - switch (new_state) {
|
| + Panel* panel, Panel::ExpansionState old_state) {
|
| + DCHECK(panel->expansion_state() != Panel::IN_OVERFLOW);
|
| +
|
| + gfx::Size size = panel->restored_size();
|
| + switch (panel->expansion_state()) {
|
| case Panel::EXPANDED:
|
| - DecrementMinimizedPanels();
|
| + if (old_state == Panel::TITLE_ONLY || old_state == Panel::MINIMIZED)
|
| + DecrementMinimizedPanels();
|
| break;
|
| - case Panel::MINIMIZED:
|
| case Panel::TITLE_ONLY:
|
| + size.set_height(panel->TitleOnlyHeight());
|
| + if (old_state == Panel::EXPANDED)
|
| + IncrementMinimizedPanels();
|
| + break;
|
| + case Panel::MINIMIZED:
|
| + size.set_height(Panel::kMinimizedPanelHeight);
|
| if (old_state == Panel::EXPANDED)
|
| IncrementMinimizedPanels();
|
| break;
|
| default:
|
| + NOTREACHED();
|
| break;
|
| }
|
| +
|
| + int bottom = GetBottomPositionForExpansionState(panel->expansion_state());
|
| + gfx::Rect bounds = panel->GetBounds();
|
| + panel->SetPanelBounds(
|
| + gfx::Rect(bounds.right() - size.width(),
|
| + bottom - size.height(),
|
| + size.width(),
|
| + size.height()));
|
| }
|
|
|
| void PanelStrip::IncrementMinimizedPanels() {
|
| @@ -603,20 +623,18 @@ void PanelStrip::MovePanelToOverflow(Panel* panel, bool is_new) {
|
| if (!DoRemove(panel))
|
| return;
|
|
|
| - // TODO(jianli): Replace with the real code using overflow strip.
|
| - // panel_manager_->panel_overflow_strip()->AddPanel(panel, is_new);
|
| + panel_manager_->panel_overflow_strip()->AddPanel(panel, is_new);
|
| }
|
|
|
| void PanelStrip::MovePanelsFromOverflowIfNeeded() {
|
| - // TODO(jianli): Replace with the real code using overflow strip.
|
| - // PanelOverflowStrip* overflow = panel_manager_->panel_overflow_strip();
|
| - // Panel* candidate;
|
| - // while (candidate = overflow->FirstPanel() &&
|
| - // GetRightMostAvailablePosition -
|
| - // candidate->GetRestoredSize().width() >= display_area_.x()) {
|
| - // overflow->Remove(candidate);
|
| - // AddPanel(candidate);
|
| - // }
|
| + PanelOverflowStrip* overflow_strip = panel_manager_->panel_overflow_strip();
|
| + Panel* overflow_panel;
|
| + while ((overflow_panel = overflow_strip->first_panel()) &&
|
| + GetRightMostAvailablePosition() -
|
| + overflow_panel->restored_size().width() >= display_area_.x()) {
|
| + overflow_strip->Remove(overflow_panel);
|
| + AddPanel(overflow_panel);
|
| + }
|
| }
|
|
|
| void PanelStrip::RemoveAll() {
|
|
|