Chromium Code Reviews| Index: chrome/browser/ui/panels/docked_panel_strip.cc |
| diff --git a/chrome/browser/ui/panels/docked_panel_strip.cc b/chrome/browser/ui/panels/docked_panel_strip.cc |
| index 35edf43b7933de68408f15c890b86249afa31012..ac7b41f662ea4abda71ea673462a9ece2e7fd575 100644 |
| --- a/chrome/browser/ui/panels/docked_panel_strip.cc |
| +++ b/chrome/browser/ui/panels/docked_panel_strip.cc |
| @@ -477,7 +477,7 @@ void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel, |
| return; |
| if (modifier == panel::APPLY_TO_ALL) |
| - ToggleMinimizeAll(panel); |
| + RestoreAll(); |
| else |
| RestorePanel(panel); |
| } |
| @@ -508,6 +508,34 @@ void DockedPanelStrip::RestorePanel(Panel* panel) { |
| panel->SetExpansionState(Panel::EXPANDED); |
| } |
| +void DockedPanelStrip::MinimizeAll() { |
| + AutoReset<bool> pin(&minimizing_all_, true); |
|
jianli
2012/04/26 18:06:57
nit: please add comment for this.
jennb
2012/04/27 00:30:11
Done.
|
| + Panel* minimized_active_panel = NULL; |
| + for (Panels::const_iterator iter = panels_.begin(); |
| + iter != panels_.end(); ++iter) { |
| + if ((*iter)->IsActive()) |
| + minimized_active_panel = *iter; |
| + MinimizePanel(*iter); |
| + } |
| + |
| + // When a single panel is minimized, it is deactivated to ensure that |
| + // a minimized panel does not have focus. However, when minimizing all, |
| + // the deactivation is only done once after all panels are minimized, |
| + // rather than per minimized panel, both for efficiency and to avoid |
| + // temporary activations of random not-yet-minimized panels. |
| + if (minimized_active_panel) { |
|
jianli
2012/04/26 18:06:57
I think it might be a little bit safer to iterate
jennb
2012/04/27 00:30:11
If another panel is activated by the system while
jianli
2012/04/27 00:39:04
What if minimized_active_panel is closed before we
jennb
2012/04/27 16:47:45
The closure would happen on a separate pass of the
|
| + minimized_active_panel->Deactivate(); |
| + // Layout will be refreshed in response to (de)activation notification. |
| + } |
| +} |
| + |
| +void DockedPanelStrip::RestoreAll() { |
| + for (Panels::const_iterator iter = panels_.begin(); |
| + iter != panels_.end(); ++iter) { |
| + RestorePanel(*iter); |
| + } |
| +} |
| + |
| bool DockedPanelStrip::CanMinimizePanel(const Panel* panel) const { |
| DCHECK_EQ(this, panel->panel_strip()); |
| // Docked panels can be minimized. |
| @@ -535,32 +563,6 @@ void DockedPanelStrip::UpdateMinimizedPanelCount() { |
| DCHECK_LE(minimized_panel_count_, num_panels()); |
| } |
| -void DockedPanelStrip::ToggleMinimizeAll(Panel* panel) { |
| - DCHECK_EQ(this, panel->panel_strip()); |
| - AutoReset<bool> pin(&minimizing_all_, IsPanelMinimized(panel) ? false : true); |
| - Panel* minimized_active_panel = NULL; |
| - for (Panels::const_iterator iter = panels_.begin(); |
| - iter != panels_.end(); ++iter) { |
| - if (minimizing_all_) { |
| - if ((*iter)->IsActive()) |
| - minimized_active_panel = *iter; |
| - MinimizePanel(*iter); |
| - } else { |
| - RestorePanel(*iter); |
| - } |
| - } |
| - |
| - // When a single panel is minimized, it is deactivated to ensure that |
| - // a minimized panel does not have focus. However, when minimizing all, |
| - // the deactivation is only done once after all panels are minimized, |
| - // rather than per minimized panel, both for efficiency and to avoid |
| - // temporary activations of random not-yet-minimized panels. |
| - if (minimized_active_panel) { |
| - minimized_active_panel->Deactivate(); |
| - // Layout will be refreshed in response to (de)activation notification. |
| - } |
| -} |
| - |
| void DockedPanelStrip::ResizePanelWindow( |
| Panel* panel, |
| const gfx::Size& preferred_window_size) { |