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 20 matching lines...) Expand all Loading... |
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_EQ(this, panel->panel_strip()); |
38 panels_.insert(panel); | 38 panels_.insert(panel); |
39 } | 39 } |
40 | 40 |
| 41 void DetachedPanelStrip::AddPanelAtPosition(Panel* panel, |
| 42 const gfx::Point& position) { |
| 43 AddPanel(panel); |
| 44 |
| 45 gfx::Rect new_bounds(panel->GetBounds()); |
| 46 new_bounds.set_origin(position); |
| 47 panel->SetPanelBounds(new_bounds); |
| 48 } |
| 49 |
41 bool DetachedPanelStrip::RemovePanel(Panel* panel) { | 50 bool DetachedPanelStrip::RemovePanel(Panel* panel) { |
42 return panels_.erase(panel) != 0; | 51 return panels_.erase(panel) != 0; |
43 } | 52 } |
44 | 53 |
45 void DetachedPanelStrip::CloseAll() { | 54 void DetachedPanelStrip::CloseAll() { |
46 // Make a copy as closing panels can modify the iterator. | 55 // Make a copy as closing panels can modify the iterator. |
47 Panels panels_copy = panels_; | 56 Panels panels_copy = panels_; |
48 | 57 |
49 for (Panels::const_iterator iter = panels_copy.begin(); | 58 for (Panels::const_iterator iter = panels_copy.begin(); |
50 iter != panels_copy.end(); ++iter) | 59 iter != panels_copy.end(); ++iter) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |