Commit 57fc7ab0 authored by mihaip@chromium.org's avatar mihaip@chromium.org

When sizing to fit the extension install dialog title, expand the height instead of the width.

This prevents the re-enable prompt (and/or long app/extension names) from making
the dialog too wide.

BUG=118279

Review URL: http://codereview.chromium.org/9700043

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126924 0039d316-1c4b-4281-b951-d872f2087c98
parent e70cf0ed
...@@ -177,15 +177,15 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { ...@@ -177,15 +177,15 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) {
if (![self isBundleInstall]) if (![self isBundleInstall])
[iconView_ setImage:prompt_->icon().ToNSImage()]; [iconView_ setImage:prompt_->icon().ToNSImage()];
// Resize |titleField_| to fit the title. // The dialog is laid out in the NIB exactly how we want it assuming that
CGFloat originalTitleWidth = [titleField_ frame].size.width; // each label fits on one line. However, for each label, we want to allow
[titleField_ sizeToFit]; // wrapping onto multiple lines. So we accumulate an offset by measuring how
CGFloat newTitleWidth = [titleField_ frame].size.width; // big each label wants to be, and comparing it to how big it actually is.
if (newTitleWidth > originalTitleWidth) { // Then we shift each label down and resize by the appropriate amount, then
NSRect frame = [[self window] frame]; // finally resize the window.
frame.size.width += newTitleWidth - originalTitleWidth; CGFloat totalOffset = 0.0;
[[self window] setFrame:frame display:NO];
} OffsetControlVerticallyToFitContent(titleField_, &totalOffset);
// Resize |okButton_| and |cancelButton_| to fit the button labels, but keep // Resize |okButton_| and |cancelButton_| to fit the button labels, but keep
// them right-aligned. // them right-aligned.
...@@ -201,14 +201,6 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { ...@@ -201,14 +201,6 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) {
-buttonDelta.width, 0)]; -buttonDelta.width, 0)];
} }
// The dialog is laid out in the NIB exactly how we want it assuming that
// each label fits on one line. However, for each label, we want to allow
// wrapping onto multiple lines. So we accumulate an offset by measuring how
// big each label wants to be, and comparing it to how big it actually is.
// Then we shift each label down and resize by the appropriate amount, then
// finally resize the window.
CGFloat totalOffset = 0.0;
if ([self isBundleInstall]) { if ([self isBundleInstall]) {
[subtitleField_ setStringValue:base::SysUTF16ToNSString( [subtitleField_ setStringValue:base::SysUTF16ToNSString(
prompt_->GetPermissionsHeading())]; prompt_->GetPermissionsHeading())];
...@@ -228,7 +220,6 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { ...@@ -228,7 +220,6 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) {
[itemsField_ setStringValue:joinedItems]; [itemsField_ setStringValue:joinedItems];
// Adjust the controls to fit the list of extensions. // Adjust the controls to fit the list of extensions.
OffsetControlVerticallyToFitContent(titleField_, &totalOffset);
OffsetControlVerticallyToFitContent(itemsField_, &totalOffset); OffsetControlVerticallyToFitContent(itemsField_, &totalOffset);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment