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

Unified Diff: chrome/browser/ui/panels/docked_panel_strip.cc

Issue 9353002: Created new PanelStrip base class and make DockedPanelStrip and OverflowPanelStrip its subclasses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added the new files - d'oh! Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/docked_panel_strip.cc
diff --git a/chrome/browser/ui/panels/docked_panel_strip.cc b/chrome/browser/ui/panels/docked_panel_strip.cc
index c59682dd5e8e59959b1b10dbadcffbc277695393..ecb31c27348c5d951a0510c1d1468ffca9166706 100644
--- a/chrome/browser/ui/panels/docked_panel_strip.cc
+++ b/chrome/browser/ui/panels/docked_panel_strip.cc
@@ -57,7 +57,8 @@ const int DockedPanelStrip::kPanelMinWidth = 100;
const int DockedPanelStrip::kPanelMinHeight = 20;
DockedPanelStrip::DockedPanelStrip(PanelManager* panel_manager)
- : panel_manager_(panel_manager),
+ : PanelStrip(PanelStrip::DOCKED),
+ panel_manager_(panel_manager),
minimized_panel_count_(0),
are_titlebars_up_(false),
dragging_panel_index_(kInvalidPanelIndex),
@@ -73,17 +74,17 @@ DockedPanelStrip::~DockedPanelStrip() {
DCHECK_EQ(0, minimized_panel_count_);
}
-void DockedPanelStrip::SetDisplayArea(const gfx::Rect& new_area) {
- if (display_area_ == new_area)
+void DockedPanelStrip::SetDisplayArea(const gfx::Rect& display_area) {
+ if (display_area_ == display_area)
return;
gfx::Rect old_area = display_area_;
- display_area_ = new_area;
+ display_area_ = display_area;
if (panels_.empty())
return;
- Rearrange();
+ RefreshLayout();
}
void DockedPanelStrip::AddPanel(Panel* panel) {
@@ -180,7 +181,7 @@ int DockedPanelStrip::GetRightMostAvailablePosition() const {
(panels_.back()->GetBounds().x() - kPanelsHorizontalSpacing);
}
-bool DockedPanelStrip::Remove(Panel* panel) {
+bool DockedPanelStrip::RemovePanel(Panel* panel) {
if (panel->has_temporary_layout()) {
panels_in_temporary_layout_.erase(panel);
return true;
@@ -200,7 +201,7 @@ bool DockedPanelStrip::Remove(Panel* panel) {
// Don't rearrange the strip if a panel is being moved from the panel strip
// to the overflow strip.
if (panel->expansion_state() != Panel::IN_OVERFLOW)
- Rearrange();
+ RefreshLayout();
return true;
}
@@ -209,7 +210,7 @@ void DockedPanelStrip::DelayedRemove() {
for (size_t i = 0; i < panels_pending_to_remove_.size(); ++i)
DoRemove(panels_pending_to_remove_[i]);
panels_pending_to_remove_.clear();
- Rearrange();
+ RefreshLayout();
}
bool DockedPanelStrip::DoRemove(Panel* panel) {
@@ -237,7 +238,7 @@ void DockedPanelStrip::StartDragging(Panel* panel) {
}
}
-void DockedPanelStrip::Drag(int delta_x) {
+void DockedPanelStrip::Drag(int delta_x, int delta_y) {
DCHECK(dragging_panel_index_ != kInvalidPanelIndex);
if (!delta_x)
@@ -346,7 +347,8 @@ void DockedPanelStrip::EndDragging(bool cancelled) {
if (cancelled) {
Drag(dragging_panel_original_x_ -
- panels_[dragging_panel_index_]->GetBounds().x());
+ panels_[dragging_panel_index_]->GetBounds().x(),
+ 0); // TODO(jennb): pass delta_y
} else {
panels_[dragging_panel_index_]->SetPanelBounds(
dragging_panel_bounds_);
@@ -362,7 +364,7 @@ void DockedPanelStrip::OnPanelExpansionStateChanged(Panel* panel) {
Panel::ExpansionState expansion_state = panel->expansion_state();
Panel::ExpansionState old_state = panel->old_expansion_state();
if (old_state == Panel::IN_OVERFLOW) {
- panel_manager_->overflow_strip()->Remove(panel);
+ panel_manager_->overflow_strip()->RemovePanel(panel);
AddPanel(panel);
panel->SetAppIconVisibility(true);
panel->set_draggable(true);
@@ -426,7 +428,7 @@ void DockedPanelStrip::DecrementMinimizedPanels() {
panel_manager_->mouse_watcher()->RemoveObserver(this);
}
-void DockedPanelStrip::OnWindowSizeChanged(
+void DockedPanelStrip::ResizePanelWindow(
Panel* panel, const gfx::Size& preferred_window_size) {
// The panel width:
// * cannot grow or shrink to go beyond [min_width, max_width]
@@ -470,7 +472,7 @@ void DockedPanelStrip::OnWindowSizeChanged(
// Only need to rearrange if panel's width changed.
if (delta_x != 0)
- Rearrange();
+ RefreshLayout();
}
bool DockedPanelStrip::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const {
@@ -642,7 +644,7 @@ void DockedPanelStrip::OnFullScreenModeChanged(bool is_full_screen) {
panels_[i]->FullScreenModeChanged(is_full_screen);
}
-void DockedPanelStrip::Rearrange() {
+void DockedPanelStrip::RefreshLayout() {
int rightmost_position = StartingRightPosition();
size_t panel_index = 0;
@@ -705,7 +707,7 @@ void DockedPanelStrip::DelayedMovePanelToOverflow(Panel* panel) {
}
}
-void DockedPanelStrip::RemoveAll() {
+void DockedPanelStrip::CloseAll() {
// This should only be called at the end of tests to clean up.
DCHECK(dragging_panel_index_ == kInvalidPanelIndex);
DCHECK(panels_in_temporary_layout_.empty());

Powered by Google App Engine
This is Rietveld 408576698