Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 const int PanelStrip::kPanelMinWidth = 100; | 50 const int PanelStrip::kPanelMinWidth = 100; |
| 51 const int PanelStrip::kPanelMinHeight = 20; | 51 const int PanelStrip::kPanelMinHeight = 20; |
| 52 | 52 |
| 53 PanelStrip::PanelStrip(PanelManager* panel_manager) | 53 PanelStrip::PanelStrip(PanelManager* panel_manager) |
| 54 : panel_manager_(panel_manager), | 54 : panel_manager_(panel_manager), |
| 55 minimized_panel_count_(0), | 55 minimized_panel_count_(0), |
| 56 are_titlebars_up_(false), | 56 are_titlebars_up_(false), |
| 57 dragging_panel_index_(kInvalidPanelIndex), | 57 dragging_panel_index_(kInvalidPanelIndex), |
| 58 dragging_panel_original_x_(0), | 58 dragging_panel_original_x_(0), |
| 59 delayed_titlebar_action_(NO_ACTION), | 59 delayed_titlebar_action_(NO_ACTION), |
| 60 remove_delays_for_testing_(false), | |
| 61 titlebar_action_factory_(this) { | 60 titlebar_action_factory_(this) { |
| 62 } | 61 } |
| 63 | 62 |
| 64 PanelStrip::~PanelStrip() { | 63 PanelStrip::~PanelStrip() { |
| 65 DCHECK(panels_.empty()); | 64 DCHECK(panels_.empty()); |
| 66 DCHECK(panels_pending_to_remove_.empty()); | 65 DCHECK(panels_pending_to_remove_.empty()); |
| 67 DCHECK_EQ(0, minimized_panel_count_); | 66 DCHECK_EQ(0, minimized_panel_count_); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void PanelStrip::SetDisplayArea(const gfx::Rect& new_area) { | 69 void PanelStrip::SetDisplayArea(const gfx::Rect& new_area) { |
| 71 if (display_area_ == new_area) | 70 if (display_area_ == new_area) |
| 72 return; | 71 return; |
| 73 | 72 |
| 74 gfx::Rect old_area = display_area_; | 73 gfx::Rect old_area = display_area_; |
| 75 display_area_ = new_area; | 74 display_area_ = new_area; |
| 76 | 75 |
| 77 if (panels_.empty()) | 76 if (panels_.empty()) |
| 78 return; | 77 return; |
| 79 | 78 |
| 80 Rearrange(); | 79 Rearrange(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void PanelStrip::AddPanel(Panel* panel) { | 82 void PanelStrip::AddPanel(Panel* panel) { |
| 83 DCHECK_EQ(Panel::EXPANDED, panel->expansion_state()); | |
| 84 | |
| 84 // Always update limits, even for exiting panels, in case the maximums changed | 85 // Always update limits, even for exiting panels, in case the maximums changed |
| 85 // while panel was out of the strip. | 86 // while panel was out of the strip. |
| 86 int max_panel_width = GetMaxPanelWidth(); | 87 int max_panel_width = GetMaxPanelWidth(); |
| 87 int max_panel_height = GetMaxPanelHeight(); | 88 int max_panel_height = GetMaxPanelHeight(); |
| 88 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), | 89 panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight), |
| 89 gfx::Size(max_panel_width, max_panel_height)); | 90 gfx::Size(max_panel_width, max_panel_height)); |
| 90 | 91 |
| 91 gfx::Size restored_size = panel->restored_size(); | 92 gfx::Size restored_size = panel->restored_size(); |
| 92 int height = restored_size.height(); | 93 int height = restored_size.height(); |
| 93 int width = restored_size.width(); | 94 int width = restored_size.width(); |
| 94 | 95 |
| 95 if (panel->initialized()) { | 96 if (panel->initialized()) { |
| 96 // Bump panels in the strip to make room for this panel. | 97 // Bump panels in the strip to make room for this panel. |
| 97 int x; | 98 int x; |
| 98 while ((x = GetRightMostAvailablePosition() - width) < display_area_.x()) { | 99 while ((x = GetRightMostAvailablePosition() - width) < display_area_.x()) { |
| 99 DCHECK(!panels_.empty()); | 100 DCHECK(!panels_.empty()); |
| 100 MovePanelToOverflow(panels_.back(), false); | 101 panels_.back()->SetExpansionState(Panel::IN_OVERFLOW); |
| 101 } | 102 } |
| 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 panel->SetExpansionState(Panel::EXPANDED); | |
| 105 } else { | 105 } else { |
| 106 // 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. |
| 107 if (height == 0 && width == 0) { | 107 if (height == 0 && width == 0) { |
| 108 // Auto resizable is enabled only if no initial size is provided. | 108 // Auto resizable is enabled only if no initial size is provided. |
| 109 panel->SetAutoResizable(true); | 109 panel->SetAutoResizable(true); |
| 110 } else { | 110 } else { |
| 111 if (height == 0) | 111 if (height == 0) |
| 112 height = width / kPanelDefaultWidthToHeightRatio; | 112 height = width / kPanelDefaultWidthToHeightRatio; |
| 113 if (width == 0) | 113 if (width == 0) |
| 114 width = height * kPanelDefaultWidthToHeightRatio; | 114 width = height * kPanelDefaultWidthToHeightRatio; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 129 int x = GetRightMostAvailablePosition() - width; | 129 int x = GetRightMostAvailablePosition() - width; |
| 130 int y = display_area_.bottom() - height; | 130 int y = display_area_.bottom() - height; |
| 131 | 131 |
| 132 // Keep panel visible in the strip even if overlap would occur. | 132 // Keep panel visible in the strip even if overlap would occur. |
| 133 // Panel is moved to overflow from the strip after a delay. | 133 // Panel is moved to overflow from the strip after a delay. |
| 134 // TODO(jianli): remove the guard when overflow support is enabled on other | 134 // TODO(jianli): remove the guard when overflow support is enabled on other |
| 135 // platforms. http://crbug.com/105073 | 135 // platforms. http://crbug.com/105073 |
| 136 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
| 137 if (x < display_area_.x()) { | 137 if (x < display_area_.x()) { |
| 138 x = display_area_.x(); | 138 x = display_area_.x(); |
| 139 int delay_ms = remove_delays_for_testing_ ? 0 : | 139 panel->set_temporary_layout(true); |
| 140 kMoveNewPanelToOverflowDelayMilliseconds; | |
| 141 MessageLoop::current()->PostDelayedTask( | 140 MessageLoop::current()->PostDelayedTask( |
| 142 FROM_HERE, | 141 FROM_HERE, |
| 143 base::Bind(&PanelStrip::MovePanelToOverflow, | 142 base::Bind(&PanelStrip::MovePanelToOverflowAfterDelay, |
| 144 base::Unretained(this), | 143 base::Unretained(this), |
| 145 panel, | 144 panel), |
| 146 true), // new panel | 145 kMoveNewPanelToOverflowDelayMilliseconds); |
| 147 delay_ms); | |
| 148 } | 146 } |
| 149 #endif | 147 #endif |
| 150 panel->Initialize(gfx::Rect(x, y, width, height)); | 148 panel->Initialize(gfx::Rect(x, y, width, height)); |
| 151 } | 149 } |
| 152 | 150 |
| 153 DCHECK(panel->expansion_state() == Panel::EXPANDED); | |
| 154 panels_.push_back(panel); | 151 panels_.push_back(panel); |
| 155 } | 152 } |
| 156 | 153 |
| 157 int PanelStrip::GetMaxPanelWidth() const { | 154 int PanelStrip::GetMaxPanelWidth() const { |
| 158 return static_cast<int>(display_area_.width() * kPanelMaxWidthFactor); | 155 return static_cast<int>(display_area_.width() * kPanelMaxWidthFactor); |
| 159 } | 156 } |
| 160 | 157 |
| 161 int PanelStrip::GetMaxPanelHeight() const { | 158 int PanelStrip::GetMaxPanelHeight() const { |
| 162 return display_area_.height(); | 159 return display_area_.height(); |
| 163 } | 160 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 191 DoRemove(panels_pending_to_remove_[i]); | 188 DoRemove(panels_pending_to_remove_[i]); |
| 192 panels_pending_to_remove_.clear(); | 189 panels_pending_to_remove_.clear(); |
| 193 Rearrange(); | 190 Rearrange(); |
| 194 } | 191 } |
| 195 | 192 |
| 196 bool PanelStrip::DoRemove(Panel* panel) { | 193 bool PanelStrip::DoRemove(Panel* panel) { |
| 197 Panels::iterator iter = find(panels_.begin(), panels_.end(), panel); | 194 Panels::iterator iter = find(panels_.begin(), panels_.end(), panel); |
| 198 if (iter == panels_.end()) | 195 if (iter == panels_.end()) |
| 199 return false; | 196 return false; |
| 200 | 197 |
| 201 if (panel->expansion_state() != Panel::EXPANDED) | 198 if (panel->expansion_state() == Panel::TITLE_ONLY || |
| 199 panel->expansion_state() == Panel::MINIMIZED) | |
| 202 DecrementMinimizedPanels(); | 200 DecrementMinimizedPanels(); |
| 203 | 201 |
| 204 panels_.erase(iter); | 202 panels_.erase(iter); |
| 205 panel_manager_->OnPanelRemoved(panel); | 203 panel_manager_->OnPanelRemoved(panel); |
| 206 return true; | 204 return true; |
| 207 } | 205 } |
| 208 | 206 |
| 209 void PanelStrip::StartDragging(Panel* panel) { | 207 void PanelStrip::StartDragging(Panel* panel) { |
| 210 for (size_t i = 0; i < panels_.size(); ++i) { | 208 for (size_t i = 0; i < panels_.size(); ++i) { |
| 211 if (panels_[i] == panel) { | 209 if (panels_[i] == panel) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 | 334 |
| 337 DelayedRemove(); | 335 DelayedRemove(); |
| 338 } | 336 } |
| 339 | 337 |
| 340 void PanelStrip::OnPanelExpansionStateChanged( | 338 void PanelStrip::OnPanelExpansionStateChanged( |
| 341 Panel* panel, Panel::ExpansionState old_state) { | 339 Panel* panel, Panel::ExpansionState old_state) { |
| 342 gfx::Size size = panel->restored_size(); | 340 gfx::Size size = panel->restored_size(); |
| 343 Panel::ExpansionState expansion_state = panel->expansion_state(); | 341 Panel::ExpansionState expansion_state = panel->expansion_state(); |
| 344 switch (expansion_state) { | 342 switch (expansion_state) { |
| 345 case Panel::EXPANDED: | 343 case Panel::EXPANDED: |
| 346 if (old_state == Panel::TITLE_ONLY || old_state == Panel::MINIMIZED) | 344 if (old_state == Panel::TITLE_ONLY || old_state == Panel::MINIMIZED) { |
| 347 DecrementMinimizedPanels(); | 345 DecrementMinimizedPanels(); |
| 346 } else if (old_state == Panel::IN_OVERFLOW) { | |
| 347 panel_manager_->panel_overflow_strip()->Remove(panel); | |
| 348 AddPanel(panel); | |
| 349 panel->SetAppIconVisibility(true); | |
| 350 } | |
| 348 break; | 351 break; |
| 349 case Panel::TITLE_ONLY: | 352 case Panel::TITLE_ONLY: |
| 350 size.set_height(panel->TitleOnlyHeight()); | 353 size.set_height(panel->TitleOnlyHeight()); |
| 351 if (old_state == Panel::EXPANDED) | 354 if (old_state == Panel::EXPANDED) |
| 352 IncrementMinimizedPanels(); | 355 IncrementMinimizedPanels(); |
| 353 break; | 356 break; |
| 354 case Panel::MINIMIZED: | 357 case Panel::MINIMIZED: |
| 355 size.set_height(Panel::kMinimizedPanelHeight); | 358 size.set_height(Panel::kMinimizedPanelHeight); |
| 356 if (old_state == Panel::EXPANDED) | 359 if (old_state == Panel::EXPANDED) |
| 357 IncrementMinimizedPanels(); | 360 IncrementMinimizedPanels(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 bool PanelStrip::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const { | 436 bool PanelStrip::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const { |
| 434 // We should always bring up the titlebar if the mouse is over the | 437 // We should always bring up the titlebar if the mouse is over the |
| 435 // visible auto-hiding bottom bar. | 438 // visible auto-hiding bottom bar. |
| 436 AutoHidingDesktopBar* desktop_bar = panel_manager_->auto_hiding_desktop_bar(); | 439 AutoHidingDesktopBar* desktop_bar = panel_manager_->auto_hiding_desktop_bar(); |
| 437 if (desktop_bar->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM) && | 440 if (desktop_bar->IsEnabled(AutoHidingDesktopBar::ALIGN_BOTTOM) && |
| 438 desktop_bar->GetVisibility(AutoHidingDesktopBar::ALIGN_BOTTOM) == | 441 desktop_bar->GetVisibility(AutoHidingDesktopBar::ALIGN_BOTTOM) == |
| 439 AutoHidingDesktopBar::VISIBLE && | 442 AutoHidingDesktopBar::VISIBLE && |
| 440 mouse_y >= display_area_.bottom()) | 443 mouse_y >= display_area_.bottom()) |
| 441 return true; | 444 return true; |
| 442 | 445 |
| 446 // Bring up titlebars if any panel needs the titlebar up. | |
| 443 for (Panels::const_iterator iter = panels_.begin(); | 447 for (Panels::const_iterator iter = panels_.begin(); |
| 444 iter != panels_.end(); ++iter) { | 448 iter != panels_.end(); ++iter) { |
| 445 if ((*iter)->ShouldBringUpTitlebar(mouse_x, mouse_y)) | 449 Panel* panel = *iter; |
| 450 Panel::ExpansionState state = panel->expansion_state(); | |
| 451 // Skip the expanded panel. | |
| 452 if (state == Panel::EXPANDED) | |
| 453 continue; | |
| 454 | |
| 455 // If the panel is showing titlebar only, we want to keep it up when it is | |
| 456 // being dragged. | |
| 457 if (state == Panel::TITLE_ONLY && is_dragging_panel()) | |
| 458 return true; | |
| 459 | |
| 460 // We do not want to bring up other minimized panels if the mouse is over | |
| 461 // the panel that pops up the titlebar to attract attention. | |
| 462 if (panel->IsDrawingAttention()) | |
| 463 continue; | |
| 464 | |
| 465 gfx::Rect bounds = panel->GetBounds(); | |
| 466 if (bounds.x() <= mouse_x && mouse_x <= bounds.right() && | |
| 467 mouse_y >= bounds.y()) | |
| 446 return true; | 468 return true; |
| 447 } | 469 } |
| 448 return false; | 470 return false; |
| 449 } | 471 } |
| 450 | 472 |
| 451 void PanelStrip::BringUpOrDownTitlebars(bool bring_up) { | 473 void PanelStrip::BringUpOrDownTitlebars(bool bring_up) { |
| 452 if (are_titlebars_up_ == bring_up) | 474 if (are_titlebars_up_ == bring_up) |
| 453 return; | 475 return; |
| 454 are_titlebars_up_ = bring_up; | 476 are_titlebars_up_ = bring_up; |
| 455 | 477 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 484 // taskbar will cover the panel in title hover mode, leaving it up for a few | 506 // taskbar will cover the panel in title hover mode, leaving it up for a few |
| 485 // seconds would allow the user to be able to click on it. | 507 // seconds would allow the user to be able to click on it. |
| 486 // | 508 // |
| 487 // Currently, no platforms use both delays. | 509 // Currently, no platforms use both delays. |
| 488 DCHECK(task_delay_milliseconds == 0); | 510 DCHECK(task_delay_milliseconds == 0); |
| 489 if (!bring_up) | 511 if (!bring_up) |
| 490 task_delay_milliseconds = kMillisecondsBeforeCollapsingFromTitleOnlyState; | 512 task_delay_milliseconds = kMillisecondsBeforeCollapsingFromTitleOnlyState; |
| 491 | 513 |
| 492 // OnAutoHidingDesktopBarVisibilityChanged will handle this. | 514 // OnAutoHidingDesktopBarVisibilityChanged will handle this. |
| 493 delayed_titlebar_action_ = bring_up ? BRING_UP : BRING_DOWN; | 515 delayed_titlebar_action_ = bring_up ? BRING_UP : BRING_DOWN; |
| 494 if (remove_delays_for_testing_) | |
| 495 task_delay_milliseconds = 0; | |
| 496 | 516 |
| 497 // If user moves the mouse in and out of mouse tracking area, we might have | 517 // If user moves the mouse in and out of mouse tracking area, we might have |
| 498 // previously posted but not yet dispatched task in the queue. New action | 518 // previously posted but not yet dispatched task in the queue. New action |
| 499 // should always 'reset' the delays so cancel any tasks that haven't run yet | 519 // should always 'reset' the delays so cancel any tasks that haven't run yet |
| 500 // and post a new one. | 520 // and post a new one. |
| 501 titlebar_action_factory_.InvalidateWeakPtrs(); | 521 titlebar_action_factory_.InvalidateWeakPtrs(); |
| 502 MessageLoop::current()->PostDelayedTask( | 522 MessageLoop::current()->PostDelayedTask( |
| 503 FROM_HERE, | 523 FROM_HERE, |
| 504 base::Bind(&PanelStrip::DelayedBringUpOrDownTitlebarsCheck, | 524 base::Bind(&PanelStrip::DelayedBringUpOrDownTitlebarsCheck, |
| 505 titlebar_action_factory_.GetWeakPtr()), | 525 titlebar_action_factory_.GetWeakPtr()), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 | 609 |
| 590 size_t panel_index = 0; | 610 size_t panel_index = 0; |
| 591 for (; panel_index < panels_.size(); ++panel_index) { | 611 for (; panel_index < panels_.size(); ++panel_index) { |
| 592 Panel* panel = panels_[panel_index]; | 612 Panel* panel = panels_[panel_index]; |
| 593 gfx::Rect new_bounds(panel->GetBounds()); | 613 gfx::Rect new_bounds(panel->GetBounds()); |
| 594 int x = rightmost_position - new_bounds.width(); | 614 int x = rightmost_position - new_bounds.width(); |
| 595 | 615 |
| 596 // TODO(jianli): remove the guard when overflow support is enabled on other | 616 // TODO(jianli): remove the guard when overflow support is enabled on other |
| 597 // platforms. http://crbug.com/105073 | 617 // platforms. http://crbug.com/105073 |
| 598 #if defined(OS_WIN) | 618 #if defined(OS_WIN) |
| 599 if (x < display_area_.x()) { | 619 if (x < display_area_.x()) |
| 600 MovePanelsToOverflow(panel_index); | |
| 601 break; | 620 break; |
| 602 } | |
| 603 #endif | 621 #endif |
| 604 | 622 |
| 605 new_bounds.set_x(x); | 623 new_bounds.set_x(x); |
| 606 new_bounds.set_y( | 624 new_bounds.set_y( |
| 607 GetBottomPositionForExpansionState(panel->expansion_state()) - | 625 GetBottomPositionForExpansionState(panel->expansion_state()) - |
| 608 new_bounds.height()); | 626 new_bounds.height()); |
| 609 panel->SetPanelBounds(new_bounds); | 627 panel->SetPanelBounds(new_bounds); |
| 610 | 628 |
| 611 rightmost_position = new_bounds.x() - kPanelsHorizontalSpacing; | 629 rightmost_position = new_bounds.x() - kPanelsHorizontalSpacing; |
| 612 } | 630 } |
| 613 | 631 |
| 614 // TODO(jianli): remove the guard when overflow support is enabled on other | 632 // TODO(jianli): remove the guard when overflow support is enabled on other |
| 615 // platforms. http://crbug.com/105073 | 633 // platforms. http://crbug.com/105073 |
| 616 #if defined(OS_WIN) | 634 #if defined(OS_WIN) |
| 617 if (panel_index == panels_.size()) | 635 if (panel_index < panels_.size()) { |
| 618 MovePanelsFromOverflowIfNeeded(); | 636 // Move panels to overflow in reverse to maintain their order. |
| 637 for (size_t overflow_index = panels_.size() - 1; | |
| 638 overflow_index >= panel_index; --overflow_index) | |
| 639 panels_[overflow_index]->SetExpansionState(Panel::IN_OVERFLOW); | |
| 640 } else { | |
| 641 // Attempt to add more panels from overflow to the strip. | |
| 642 PanelOverflowStrip* overflow_strip = panel_manager_->panel_overflow_strip(); | |
| 643 Panel* overflow_panel; | |
| 644 while ((overflow_panel = overflow_strip->first_panel()) && | |
| 645 GetRightMostAvailablePosition() - | |
| 646 overflow_panel->restored_size().width() >= display_area_.x()) { | |
| 647 overflow_panel->SetExpansionState(Panel::EXPANDED); | |
| 648 } | |
| 649 } | |
| 619 #endif | 650 #endif |
| 620 } | 651 } |
| 621 | 652 |
| 622 void PanelStrip::MovePanelsToOverflow(size_t overflow_point) { | 653 void PanelStrip::MovePanelToOverflowAfterDelay(Panel* panel) { |
| 623 DCHECK(overflow_point >= 0); | 654 // Make sure panel still exists in the strip. |
| 624 // Move panels in reverse to maintain their order. | 655 // Search in reverse as new panels are at the end of the strip. |
| 625 for (size_t i = panels_.size() - 1; i >= overflow_point; --i) | 656 DCHECK(panel->temporary_layout()); |
|
jennb
2011/12/07 20:04:11
Oops. will move this dcheck into the loop in case
| |
| 626 MovePanelToOverflow(panels_[i], false); | 657 for (Panels::reverse_iterator iter = panels_.rbegin(); |
| 627 } | 658 iter != panels_.rend(); ++iter) { |
| 628 | 659 if (*iter == panel) { |
| 629 void PanelStrip::MovePanelToOverflow(Panel* panel, bool is_new) { | 660 panel->SetExpansionState(Panel::IN_OVERFLOW); |
| 630 if (!DoRemove(panel)) | 661 break; |
| 631 return; | 662 } |
| 632 | |
| 633 panel_manager_->panel_overflow_strip()->AddPanel(panel, is_new); | |
| 634 } | |
| 635 | |
| 636 void PanelStrip::MovePanelsFromOverflowIfNeeded() { | |
| 637 PanelOverflowStrip* overflow_strip = panel_manager_->panel_overflow_strip(); | |
| 638 Panel* overflow_panel; | |
| 639 while ((overflow_panel = overflow_strip->first_panel()) && | |
| 640 GetRightMostAvailablePosition() - | |
| 641 overflow_panel->restored_size().width() >= display_area_.x()) { | |
| 642 overflow_strip->Remove(overflow_panel); | |
| 643 AddPanel(overflow_panel); | |
| 644 } | 663 } |
| 645 } | 664 } |
| 646 | 665 |
| 647 void PanelStrip::RemoveAll() { | 666 void PanelStrip::RemoveAll() { |
| 648 // This should not be called when we're in the process of dragging. | 667 // This should not be called when we're in the process of dragging. |
| 649 DCHECK(dragging_panel_index_ == kInvalidPanelIndex); | 668 DCHECK(dragging_panel_index_ == kInvalidPanelIndex); |
| 650 | 669 |
| 651 // Make a copy of the iterator as closing panels can modify the vector. | 670 // Make a copy of the iterator as closing panels can modify the vector. |
| 652 Panels panels_copy = panels_; | 671 Panels panels_copy = panels_; |
| 653 | 672 |
| 654 // Start from the bottom to avoid reshuffling. | 673 // Start from the bottom to avoid reshuffling. |
| 655 for (Panels::reverse_iterator iter = panels_copy.rbegin(); | 674 for (Panels::reverse_iterator iter = panels_copy.rbegin(); |
| 656 iter != panels_copy.rend(); ++iter) | 675 iter != panels_copy.rend(); ++iter) |
| 657 (*iter)->Close(); | 676 (*iter)->Close(); |
| 658 } | 677 } |
| 659 | 678 |
| 660 bool PanelStrip::is_dragging_panel() const { | 679 bool PanelStrip::is_dragging_panel() const { |
| 661 return dragging_panel_index_ != kInvalidPanelIndex; | 680 return dragging_panel_index_ != kInvalidPanelIndex; |
| 662 } | 681 } |
| OLD | NEW |