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

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

Issue 8802021: Fix a couple panel overflow related bugs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/panel_strip.h" 5 #include "chrome/browser/ui/panels/panel_strip.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 int height = restored_size.height(); 92 int height = restored_size.height();
93 int width = restored_size.width(); 93 int width = restored_size.width();
94 94
95 if (panel->initialized()) { 95 if (panel->initialized()) {
96 // Bump panels in the strip to make room for this panel. 96 // Bump panels in the strip to make room for this panel.
97 int x; 97 int x;
98 while ((x = GetRightMostAvailablePosition() - width) < display_area_.x()) { 98 while ((x = GetRightMostAvailablePosition() - width) < display_area_.x()) {
99 DCHECK(!panels_.empty()); 99 DCHECK(!panels_.empty());
100 MovePanelToOverflow(panels_.back(), false); 100 MovePanelToOverflow(panels_.back(), false);
101 } 101 }
102 panel->SetExpansionState(Panel::EXPANDED);
jennb 2011/12/05 21:20:10 Move this after line 104. Seems better than puttin
102 int y = display_area_.bottom() - height; 103 int y = display_area_.bottom() - height;
103 panel->SetPanelBounds(gfx::Rect(x, y, width, height)); 104 panel->SetPanelBounds(gfx::Rect(x, y, width, height));
104 } else { 105 } else {
105 // Initialize the newly created panel. Does not bump any panels from strip. 106 // Initialize the newly created panel. Does not bump any panels from strip.
106 if (height == 0 && width == 0) { 107 if (height == 0 && width == 0) {
107 // Auto resizable is enabled only if no initial size is provided. 108 // Auto resizable is enabled only if no initial size is provided.
108 panel->SetAutoResizable(true); 109 panel->SetAutoResizable(true);
109 } else { 110 } else {
110 if (height == 0) 111 if (height == 0)
111 height = width / kPanelDefaultWidthToHeightRatio; 112 height = width / kPanelDefaultWidthToHeightRatio;
(...skipping 30 matching lines...) Expand all
142 base::Bind(&PanelStrip::MovePanelToOverflow, 143 base::Bind(&PanelStrip::MovePanelToOverflow,
143 base::Unretained(this), 144 base::Unretained(this),
144 panel, 145 panel,
145 true), // new panel 146 true), // new panel
146 delay_ms); 147 delay_ms);
147 } 148 }
148 #endif 149 #endif
149 panel->Initialize(gfx::Rect(x, y, width, height)); 150 panel->Initialize(gfx::Rect(x, y, width, height));
150 } 151 }
151 152
152 panels_.push_back(panel); 153 panels_.push_back(panel);
jennb 2011/12/05 21:20:10 Add DCHECK before this line that expansion state i
153 } 154 }
154 155
155 int PanelStrip::GetMaxPanelWidth() const { 156 int PanelStrip::GetMaxPanelWidth() const {
156 return static_cast<int>(display_area_.width() * kPanelMaxWidthFactor); 157 return static_cast<int>(display_area_.width() * kPanelMaxWidthFactor);
157 } 158 }
158 159
159 int PanelStrip::GetMaxPanelHeight() const { 160 int PanelStrip::GetMaxPanelHeight() const {
160 return display_area_.height(); 161 return display_area_.height();
161 } 162 }
162 163
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 652
652 // Start from the bottom to avoid reshuffling. 653 // Start from the bottom to avoid reshuffling.
653 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 654 for (Panels::reverse_iterator iter = panels_copy.rbegin();
654 iter != panels_copy.rend(); ++iter) 655 iter != panels_copy.rend(); ++iter)
655 (*iter)->Close(); 656 (*iter)->Close();
656 } 657 }
657 658
658 bool PanelStrip::is_dragging_panel() const { 659 bool PanelStrip::is_dragging_panel() const {
659 return dragging_panel_index_ != kInvalidPanelIndex; 660 return dragging_panel_index_ != kInvalidPanelIndex;
660 } 661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698