Chromium Code Reviews| 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 b26ae8e412083b88356d055e026a580e772d7699..f3c4f48862c4b06e2c59d163c8b015bd439af2b4 100644 |
| --- a/chrome/browser/ui/panels/panel_overflow_strip.cc |
| +++ b/chrome/browser/ui/panels/panel_overflow_strip.cc |
| @@ -41,27 +41,21 @@ void PanelOverflowStrip::SetDisplayArea(const gfx::Rect& display_area) { |
| Refresh(); |
| } |
| -void PanelOverflowStrip::AddPanel(Panel* panel, bool is_new) { |
| +void PanelOverflowStrip::AddPanel(Panel* panel) { |
| // TODO(jianli): consider using other container to improve the perf for |
| // inserting to the front. http://crbug.com/106222 |
| - if (is_new) |
| + DCHECK_EQ(Panel::IN_OVERFLOW, panel->expansion_state()); |
| + if (panel->temporary_layout()) { |
|
jianli
2011/12/07 22:13:26
Could you please add comment to explain why we ins
jennb
2011/12/07 23:35:40
Done.
|
| + panel->set_temporary_layout(false); |
| panels_.push_back(panel); |
| - else |
| - panels_.insert(panels_.begin(), panel); |
| - |
| - if (panels_.size() == 1) |
| - panel_manager_->mouse_watcher()->AddObserver(this); |
| - |
| - panel->SetExpansionState(Panel::IN_OVERFLOW); |
| - |
| - if (is_new) { |
| - // When the overflow panel is added to the back, only need to refresh |
| - // itself. |
| DoRefresh(panels_.size() - 1, panels_.size() - 1); |
| } else { |
| - // When the overflow panel is added to the front, refresh all. |
| + panels_.insert(panels_.begin(), panel); |
| Refresh(); |
| } |
| + |
| + if (panels_.size() == 1) |
| + panel_manager_->mouse_watcher()->AddObserver(this); |
| } |
| bool PanelOverflowStrip::Remove(Panel* panel) { |
| @@ -93,6 +87,9 @@ void PanelOverflowStrip::RemoveAll() { |
| void PanelOverflowStrip::OnPanelExpansionStateChanged( |
| Panel* panel, Panel::ExpansionState old_state) { |
| DCHECK(panel->expansion_state() == Panel::IN_OVERFLOW); |
| + panel_manager_->panel_strip()->Remove(panel); |
| + AddPanel(panel); |
| + panel->SetAppIconVisibility(false); |
| } |
| void PanelOverflowStrip::Refresh() { |