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

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: Fix per feedback 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (find(panels_.begin(), panels_.end(), panel) == panels_.end()) 172 if (find(panels_.begin(), panels_.end(), panel) == panels_.end())
173 return false; 173 return false;
174 174
175 // If we're in the process of dragging, delay the removal. 175 // If we're in the process of dragging, delay the removal.
176 if (dragging_panel_index_ != kInvalidPanelIndex) { 176 if (dragging_panel_index_ != kInvalidPanelIndex) {
177 panels_pending_to_remove_.push_back(panel); 177 panels_pending_to_remove_.push_back(panel);
178 return true; 178 return true;
179 } 179 }
180 180
181 DoRemove(panel); 181 DoRemove(panel);
182 Rearrange(); 182
183 // Don't rearrange the strip if a panel is being moved from the panel strip
184 // to the overflow strip.
185 if (panel->expansion_state() != Panel::IN_OVERFLOW)
186 Rearrange();
187
183 return true; 188 return true;
184 } 189 }
185 190
186 void PanelStrip::DelayedRemove() { 191 void PanelStrip::DelayedRemove() {
187 for (size_t i = 0; i < panels_pending_to_remove_.size(); ++i) 192 for (size_t i = 0; i < panels_pending_to_remove_.size(); ++i)
188 DoRemove(panels_pending_to_remove_[i]); 193 DoRemove(panels_pending_to_remove_[i]);
189 panels_pending_to_remove_.clear(); 194 panels_pending_to_remove_.clear();
190 Rearrange(); 195 Rearrange();
191 } 196 }
192 197
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 680
676 // Start from the bottom to avoid reshuffling. 681 // Start from the bottom to avoid reshuffling.
677 for (Panels::reverse_iterator iter = panels_copy.rbegin(); 682 for (Panels::reverse_iterator iter = panels_copy.rbegin();
678 iter != panels_copy.rend(); ++iter) 683 iter != panels_copy.rend(); ++iter)
679 (*iter)->Close(); 684 (*iter)->Close();
680 } 685 }
681 686
682 bool PanelStrip::is_dragging_panel() const { 687 bool PanelStrip::is_dragging_panel() const {
683 return dragging_panel_index_ != kInvalidPanelIndex; 688 return dragging_panel_index_ != kInvalidPanelIndex;
684 } 689 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698