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

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

Issue 8872044: Add test cases for panel overflow handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final patch to land 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
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_strip.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (find(panels_.begin(), panels_.end(), panel) == panels_.end()) 173 if (find(panels_.begin(), panels_.end(), panel) == panels_.end())
174 return false; 174 return false;
175 175
176 // If we're in the process of dragging, delay the removal. 176 // If we're in the process of dragging, delay the removal.
177 if (dragging_panel_index_ != kInvalidPanelIndex) { 177 if (dragging_panel_index_ != kInvalidPanelIndex) {
178 panels_pending_to_remove_.push_back(panel); 178 panels_pending_to_remove_.push_back(panel);
179 return true; 179 return true;
180 } 180 }
181 181
182 DoRemove(panel); 182 DoRemove(panel);
183 Rearrange(); 183
184 // Don't rearrange the strip if a panel is being moved from the panel strip
185 // to the overflow strip.
186 if (panel->expansion_state() != Panel::IN_OVERFLOW)
187 Rearrange();
188
184 return true; 189 return true;
185 } 190 }
186 191
187 void PanelStrip::DelayedRemove() { 192 void PanelStrip::DelayedRemove() {
188 for (size_t i = 0; i < panels_pending_to_remove_.size(); ++i) 193 for (size_t i = 0; i < panels_pending_to_remove_.size(); ++i)
189 DoRemove(panels_pending_to_remove_[i]); 194 DoRemove(panels_pending_to_remove_[i]);
190 panels_pending_to_remove_.clear(); 195 panels_pending_to_remove_.clear();
191 Rearrange(); 196 Rearrange();
192 } 197 }
193 198
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 677
673 // Start from the bottom to avoid reshuffling. 678 // Start from the bottom to avoid reshuffling.
674 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 679 for (Panels::reverse_iterator iter = panels_copy.rbegin();
675 iter != panels_copy.rend(); ++iter) 680 iter != panels_copy.rend(); ++iter)
676 (*iter)->Close(); 681 (*iter)->Close();
677 } 682 }
678 683
679 bool PanelStrip::is_dragging_panel() const { 684 bool PanelStrip::is_dragging_panel() const {
680 return dragging_panel_index_ != kInvalidPanelIndex; 685 return dragging_panel_index_ != kInvalidPanelIndex;
681 } 686 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_strip.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698