Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Side by Side Diff: chrome/browser/ui/panels/detached_panel_strip.cc

Issue 9560002: Cleanup to keep panel from manipulating its panel strip assignment directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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->SetPanelStrip(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 panels_.erase(panel);
Andrei 2012/03/01 00:08:50 Same comment about SetPaneStrip() as for the docke
43 } 45 }
44 46
45 void DetachedPanelStrip::CloseAll() { 47 void DetachedPanelStrip::CloseAll() {
46 // Make a copy as closing panels can modify the iterator. 48 // Make a copy as closing panels can modify the iterator.
47 Panels panels_copy = panels_; 49 Panels panels_copy = panels_;
48 50
49 for (Panels::const_iterator iter = panels_copy.begin(); 51 for (Panels::const_iterator iter = panels_copy.begin();
50 iter != panels_copy.end(); ++iter) 52 iter != panels_copy.end(); ++iter)
51 (*iter)->Close(); 53 (*iter)->Close();
52 } 54 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 gfx::Rect new_bounds(panel->GetBounds()); 102 gfx::Rect new_bounds(panel->GetBounds());
101 new_bounds.set_origin( 103 new_bounds.set_origin(
102 panel_manager_->drag_controller()->dragging_panel_original_position()); 104 panel_manager_->drag_controller()->dragging_panel_original_position());
103 panel->SetPanelBounds(new_bounds); 105 panel->SetPanelBounds(new_bounds);
104 } 106 }
105 } 107 }
106 108
107 bool DetachedPanelStrip::HasPanel(Panel* panel) const { 109 bool DetachedPanelStrip::HasPanel(Panel* panel) const {
108 return panels_.find(panel) != panels_.end(); 110 return panels_.find(panel) != panels_.end();
109 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698