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_collection.h" | 5 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 754 |
755 // Start from the bottom to avoid reshuffling. | 755 // Start from the bottom to avoid reshuffling. |
756 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 756 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
757 iter != panels_copy.rend(); ++iter) | 757 iter != panels_copy.rend(); ++iter) |
758 (*iter)->Close(); | 758 (*iter)->Close(); |
759 } | 759 } |
760 | 760 |
761 void DockedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { | 761 void DockedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { |
762 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); | 762 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); |
763 panel->SetAlwaysOnTop(true); | 763 panel->SetAlwaysOnTop(true); |
| 764 panel->SetHasShadow(true); |
764 panel->EnableResizeByMouse(true); | 765 panel->EnableResizeByMouse(true); |
765 panel->UpdateMinimizeRestoreButtonVisibility(); | 766 panel->UpdateMinimizeRestoreButtonVisibility(); |
766 panel->SetWindowCornerStyle(panel::TOP_ROUNDED); | 767 panel->SetWindowCornerStyle(panel::TOP_ROUNDED); |
767 } | 768 } |
768 | 769 |
769 void DockedPanelCollection::ScheduleLayoutRefresh() { | 770 void DockedPanelCollection::ScheduleLayoutRefresh() { |
770 refresh_action_factory_.InvalidateWeakPtrs(); | 771 refresh_action_factory_.InvalidateWeakPtrs(); |
771 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 772 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
772 base::Bind(&DockedPanelCollection::RefreshLayout, | 773 base::Bind(&DockedPanelCollection::RefreshLayout, |
773 refresh_action_factory_.GetWeakPtr()), | 774 refresh_action_factory_.GetWeakPtr()), |
774 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( | 775 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( |
775 kRefreshLayoutAfterActivePanelChangeDelayMs))); | 776 kRefreshLayoutAfterActivePanelChangeDelayMs))); |
776 } | 777 } |
777 | 778 |
778 void DockedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { | 779 void DockedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { |
779 // Refresh layout, but wait till active states settle. | 780 // Refresh layout, but wait till active states settle. |
780 // This lets us avoid refreshing too many times when one panel loses | 781 // This lets us avoid refreshing too many times when one panel loses |
781 // focus and another gains it. | 782 // focus and another gains it. |
782 ScheduleLayoutRefresh(); | 783 ScheduleLayoutRefresh(); |
783 } | 784 } |
784 | 785 |
785 bool DockedPanelCollection::HasPanel(Panel* panel) const { | 786 bool DockedPanelCollection::HasPanel(Panel* panel) const { |
786 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); | 787 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); |
787 } | 788 } |
OLD | NEW |