OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 5 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } else { | 466 } else { |
467 // Maybe bring down the titlebar now that panel is not drawing attention. | 467 // Maybe bring down the titlebar now that panel is not drawing attention. |
468 if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_) | 468 if (panel->expansion_state() == Panel::TITLE_ONLY && !are_titlebars_up_) |
469 panel->SetExpansionState(Panel::MINIMIZED); | 469 panel->SetExpansionState(Panel::MINIMIZED); |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel, | 473 void DockedPanelStrip::OnPanelTitlebarClicked(Panel* panel, |
474 panel::ClickModifier modifier) { | 474 panel::ClickModifier modifier) { |
475 DCHECK_EQ(this, panel->panel_strip()); | 475 DCHECK_EQ(this, panel->panel_strip()); |
| 476 if (!IsPanelMinimized(panel)) |
| 477 return; |
| 478 |
476 if (modifier == panel::APPLY_TO_ALL) | 479 if (modifier == panel::APPLY_TO_ALL) |
477 ToggleMinimizeAll(panel); | 480 ToggleMinimizeAll(panel); |
478 | 481 else |
479 // TODO(jennb): Move all other titlebar click handling here. | 482 RestorePanel(panel); |
480 // (http://crbug.com/118431) | |
481 } | 483 } |
482 | 484 |
483 void DockedPanelStrip::ActivatePanel(Panel* panel) { | 485 void DockedPanelStrip::ActivatePanel(Panel* panel) { |
484 DCHECK_EQ(this, panel->panel_strip()); | 486 DCHECK_EQ(this, panel->panel_strip()); |
485 | 487 |
486 // Make sure the panel is expanded when activated so the user input | 488 // Make sure the panel is expanded when activated so the user input |
487 // does not go into a collapsed window. | 489 // does not go into a collapsed window. |
488 panel->SetExpansionState(Panel::EXPANDED); | 490 panel->SetExpansionState(Panel::EXPANDED); |
489 | 491 |
490 // If the layout needs to be refreshed, it will happen in response to | 492 // If the layout needs to be refreshed, it will happen in response to |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 FROM_HERE, | 886 FROM_HERE, |
885 base::Bind(&DockedPanelStrip::RefreshLayout, | 887 base::Bind(&DockedPanelStrip::RefreshLayout, |
886 refresh_action_factory_.GetWeakPtr()), | 888 refresh_action_factory_.GetWeakPtr()), |
887 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( | 889 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( |
888 kRefreshLayoutAfterActivePanelChangeDelayMs))); | 890 kRefreshLayoutAfterActivePanelChangeDelayMs))); |
889 } | 891 } |
890 | 892 |
891 bool DockedPanelStrip::HasPanel(Panel* panel) const { | 893 bool DockedPanelStrip::HasPanel(Panel* panel) const { |
892 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); | 894 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); |
893 } | 895 } |
OLD | NEW |