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/detached_panel_strip.h" | 5 #include "chrome/browser/ui/panels/detached_panel_strip.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 9 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 return; | 27 return; |
28 | 28 |
29 RefreshLayout(); | 29 RefreshLayout(); |
30 } | 30 } |
31 | 31 |
32 void DetachedPanelStrip::RefreshLayout() { | 32 void DetachedPanelStrip::RefreshLayout() { |
33 NOTIMPLEMENTED(); | 33 NOTIMPLEMENTED(); |
34 } | 34 } |
35 | 35 |
36 void DetachedPanelStrip::AddPanel(Panel* panel) { | 36 void DetachedPanelStrip::AddPanel(Panel* panel) { |
37 DCHECK_EQ(this, panel->panel_strip()); | 37 DCHECK_NE(this, panel->panel_strip()); |
| 38 panel->set_panel_strip(this); |
38 panels_.insert(panel); | 39 panels_.insert(panel); |
39 } | 40 } |
40 | 41 |
41 bool DetachedPanelStrip::RemovePanel(Panel* panel) { | 42 void DetachedPanelStrip::RemovePanel(Panel* panel) { |
42 return panels_.erase(panel) != 0; | 43 DCHECK_EQ(this, panel->panel_strip()); |
| 44 panel->set_panel_strip(NULL); |
| 45 panels_.erase(panel); |
43 } | 46 } |
44 | 47 |
45 void DetachedPanelStrip::CloseAll() { | 48 void DetachedPanelStrip::CloseAll() { |
46 // Make a copy as closing panels can modify the iterator. | 49 // Make a copy as closing panels can modify the iterator. |
47 Panels panels_copy = panels_; | 50 Panels panels_copy = panels_; |
48 | 51 |
49 for (Panels::const_iterator iter = panels_copy.begin(); | 52 for (Panels::const_iterator iter = panels_copy.begin(); |
50 iter != panels_copy.end(); ++iter) | 53 iter != panels_copy.end(); ++iter) |
51 (*iter)->Close(); | 54 (*iter)->Close(); |
52 } | 55 } |
(...skipping 16 matching lines...) Expand all Loading... |
69 void DetachedPanelStrip::MinimizePanel(Panel* panel) { | 72 void DetachedPanelStrip::MinimizePanel(Panel* panel) { |
70 DCHECK_EQ(this, panel->panel_strip()); | 73 DCHECK_EQ(this, panel->panel_strip()); |
71 NOTIMPLEMENTED(); | 74 NOTIMPLEMENTED(); |
72 } | 75 } |
73 | 76 |
74 void DetachedPanelStrip::RestorePanel(Panel* panel) { | 77 void DetachedPanelStrip::RestorePanel(Panel* panel) { |
75 DCHECK_EQ(this, panel->panel_strip()); | 78 DCHECK_EQ(this, panel->panel_strip()); |
76 NOTIMPLEMENTED(); | 79 NOTIMPLEMENTED(); |
77 } | 80 } |
78 | 81 |
| 82 bool DetachedPanelStrip::IsPanelMinimized(const Panel* panel) const { |
| 83 DCHECK_EQ(this, panel->panel_strip()); |
| 84 NOTIMPLEMENTED(); |
| 85 return false; |
| 86 } |
| 87 |
79 bool DetachedPanelStrip::CanShowPanelAsActive(const Panel* panel) const { | 88 bool DetachedPanelStrip::CanShowPanelAsActive(const Panel* panel) const { |
80 // All detached panels can be shown as active. | 89 // All detached panels can be shown as active. |
81 return true; | 90 return true; |
82 } | 91 } |
83 | 92 |
84 bool DetachedPanelStrip::CanDragPanel(const Panel* panel) const { | 93 bool DetachedPanelStrip::CanDragPanel(const Panel* panel) const { |
85 // All detached panels are draggable. | 94 // All detached panels are draggable. |
86 return true; | 95 return true; |
87 } | 96 } |
88 | 97 |
(...skipping 11 matching lines...) Expand all Loading... |
100 gfx::Rect new_bounds(panel->GetBounds()); | 109 gfx::Rect new_bounds(panel->GetBounds()); |
101 new_bounds.set_origin( | 110 new_bounds.set_origin( |
102 panel_manager_->drag_controller()->dragging_panel_original_position()); | 111 panel_manager_->drag_controller()->dragging_panel_original_position()); |
103 panel->SetPanelBounds(new_bounds); | 112 panel->SetPanelBounds(new_bounds); |
104 } | 113 } |
105 } | 114 } |
106 | 115 |
107 bool DetachedPanelStrip::HasPanel(Panel* panel) const { | 116 bool DetachedPanelStrip::HasPanel(Panel* panel) const { |
108 return panels_.find(panel) != panels_.end(); | 117 return panels_.find(panel) != panels_.end(); |
109 } | 118 } |
OLD | NEW |