| 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 736 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
| 737 iter != panels_copy.rend(); ++iter) | 737 iter != panels_copy.rend(); ++iter) |
| 738 (*iter)->Close(); | 738 (*iter)->Close(); |
| 739 } | 739 } |
| 740 | 740 |
| 741 void DockedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { | 741 void DockedPanelCollection::UpdatePanelOnCollectionChange(Panel* panel) { |
| 742 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); | 742 panel->set_attention_mode(Panel::USE_PANEL_ATTENTION); |
| 743 panel->SetAlwaysOnTop(true); | 743 panel->SetAlwaysOnTop(true); |
| 744 panel->EnableResizeByMouse(true); | 744 panel->EnableResizeByMouse(true); |
| 745 panel->UpdateMinimizeRestoreButtonVisibility(); | 745 panel->UpdateMinimizeRestoreButtonVisibility(); |
| 746 panel->UpdateStackingProperty(); |
| 746 } | 747 } |
| 747 | 748 |
| 748 void DockedPanelCollection::ScheduleLayoutRefresh() { | 749 void DockedPanelCollection::ScheduleLayoutRefresh() { |
| 749 refresh_action_factory_.InvalidateWeakPtrs(); | 750 refresh_action_factory_.InvalidateWeakPtrs(); |
| 750 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 751 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 751 base::Bind(&DockedPanelCollection::RefreshLayout, | 752 base::Bind(&DockedPanelCollection::RefreshLayout, |
| 752 refresh_action_factory_.GetWeakPtr()), | 753 refresh_action_factory_.GetWeakPtr()), |
| 753 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( | 754 base::TimeDelta::FromMilliseconds(PanelManager::AdjustTimeInterval( |
| 754 kRefreshLayoutAfterActivePanelChangeDelayMs))); | 755 kRefreshLayoutAfterActivePanelChangeDelayMs))); |
| 755 } | 756 } |
| 756 | 757 |
| 757 void DockedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { | 758 void DockedPanelCollection::OnPanelActiveStateChanged(Panel* panel) { |
| 758 // Refresh layout, but wait till active states settle. | 759 // Refresh layout, but wait till active states settle. |
| 759 // This lets us avoid refreshing too many times when one panel loses | 760 // This lets us avoid refreshing too many times when one panel loses |
| 760 // focus and another gains it. | 761 // focus and another gains it. |
| 761 ScheduleLayoutRefresh(); | 762 ScheduleLayoutRefresh(); |
| 762 } | 763 } |
| 763 | 764 |
| 764 bool DockedPanelCollection::HasPanel(Panel* panel) const { | 765 bool DockedPanelCollection::HasPanel(Panel* panel) const { |
| 765 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); | 766 return find(panels_.begin(), panels_.end(), panel) != panels_.end(); |
| 766 } | 767 } |
| OLD | NEW |