Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Unified Diff: chrome/browser/ui/panels/docked_panel_strip.cc

Issue 10173035: Add key modifier on minimize/restore button click to minimize/restore all Panels for Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed IsActive checks from new test Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_strip.h ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..33ae670e71415142a9f974b8fa0fff39fcf808e4 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,36 @@ void DockedPanelStrip::RestorePanel(Panel* panel) {
panel->SetExpansionState(Panel::EXPANDED);
}
+void DockedPanelStrip::MinimizeAll() {
+ // Set minimizing_all_ to prevent deactivation of each panel when it
+ // is minimized. See comments in OnPanelExpansionStateChanged.
+ AutoReset<bool> pin(&minimizing_all_, true);
+ 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) {
+ 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 +565,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) {
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_strip.h ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698