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

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

Issue 10260001: Remove panel size limit when user resizes it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cr feedback Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/panels/detached_panel_strip.cc ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33ae670e71415142a9f974b8fa0fff39fcf808e4..2c55172c431f0e6c47e49c14050beaf6c3592260 100644
--- a/chrome/browser/ui/panels/docked_panel_strip.cc
+++ b/chrome/browser/ui/panels/docked_panel_strip.cc
@@ -50,12 +50,13 @@ const int kDelayBeforeCollapsingFromTitleOnlyStateMs = 0;
// we refresh layout with a delay.
const int kRefreshLayoutAfterActivePanelChangeDelayMs = 200; // arbitrary
-// The minimum panel width when it is "squeezed" in the docked strip
-// due to lack of space.
-const int kMinPanelWidthForDisplay = 26;
} // namespace
// static
+// These numbers are semi-arbitrary.
+// Motivation for 'width' is to make main buttons on the titlebar functional.
+// Motivation for height is to allow autosized tightly-wrapped panel with a
+// single line of text.
const int DockedPanelStrip::kPanelMinWidth = 100;
const int DockedPanelStrip::kPanelMinHeight = 20;
@@ -161,6 +162,9 @@ void DockedPanelStrip::InsertNewlyCreatedPanel(Panel* panel) {
panel->Initialize(gfx::Rect(pt.x(), pt.y(), width, height));
+ panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight),
+ gfx::Size(max_panel_width, max_panel_height));
+
InsertExistingPanelAtDefaultPosition(panel, true /*update_bounds*/);
}
@@ -572,7 +576,7 @@ void DockedPanelStrip::ResizePanelWindow(
// Make sure the new size does not violate panel's size restrictions.
gfx::Size new_size(preferred_window_size.width(),
preferred_window_size.height());
- panel->ClampSize(&new_size);
+ new_size = panel->ClampSize(new_size);
if (new_size == panel->full_size())
return;
@@ -851,7 +855,7 @@ int DockedPanelStrip::WidthToDisplayPanelInStrip(bool is_for_active_panel,
int full_width) const {
if (is_for_active_panel)
return full_width;
- return std::max(kMinPanelWidthForDisplay,
+ return std::max(kPanelMinWidth,
static_cast<int>(floor(full_width * squeeze_factor)));
}
@@ -868,13 +872,15 @@ void DockedPanelStrip::CloseAll() {
}
void DockedPanelStrip::UpdatePanelOnStripChange(Panel* panel) {
- // Always update limits, even on existing panels, in case the limits changed
- // while panel was out of the strip.
- int max_panel_width = GetMaxPanelWidth();
- int max_panel_height = GetMaxPanelHeight();
- panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight),
- gfx::Size(max_panel_width, max_panel_height));
-
+ // Update limits if panel is still autosizable, in case the limit has changed.
+ // If panels is not autoresizable, then it's either resized by the user or
jennb 2012/04/28 03:38:02 nit: s/If panels is/If panel is
+ // by the API.
+ if (panel->auto_resizable()) {
+ int max_panel_width = GetMaxPanelWidth();
+ int max_panel_height = GetMaxPanelHeight();
+ panel->SetSizeRange(gfx::Size(kPanelMinWidth, kPanelMinHeight),
+ gfx::Size(max_panel_width, max_panel_height));
+ }
panel->set_attention_mode(Panel::USE_PANEL_ATTENTION);
panel->SetAppIconVisibility(true);
panel->SetAlwaysOnTop(true);
« no previous file with comments | « chrome/browser/ui/panels/detached_panel_strip.cc ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698