summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/content_settings_dialog_controller.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:37:59 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:37:59 +0000
commitb5366c1298343e62ce0dc3aea10b44089526eeba (patch)
tree95c5ff2cfad20cc9e425fb3c360a9ac570df2264 /chrome/browser/cocoa/content_settings_dialog_controller.mm
parent1e9499c21c23b52391d952572bd9059df532efcb (diff)
downloadchromium_src-b5366c1298343e62ce0dc3aea10b44089526eeba.zip
chromium_src-b5366c1298343e62ce0dc3aea10b44089526eeba.tar.gz
chromium_src-b5366c1298343e62ce0dc3aea10b44089526eeba.tar.bz2
Mac: Improve content settings dialog in some languages.
xib changes: * Get rid of all GTMWidthBasedTweakers in the xib * Change labels from "clip" to "wrap" BUG=39390 TEST=See bug Review URL: http://codereview.chromium.org/1605013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/content_settings_dialog_controller.mm')
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.mm33
1 files changed, 32 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index c3b50d8..88034ff 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm
@@ -13,6 +13,7 @@
#import "chrome/browser/cocoa/content_exceptions_window_controller.h"
#import "chrome/browser/cocoa/cookies_window_controller.h"
#import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h"
+#import "chrome/browser/cocoa/l10n_util.h"
#import "chrome/browser/geolocation/geolocation_content_settings_map.h"
#import "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/pref_service.h"
@@ -22,7 +23,6 @@
#include "chrome/common/url_constants.h"
#include "grit/locale_settings.h"
-
namespace {
// Index of the "enabled" and "disabled" radio group settings in all tabs except
@@ -43,6 +43,25 @@ const NSInteger kGeolocationEnabledIndex = 0;
const NSInteger kGeolocationAskIndex = 1;
const NSInteger kGeolocationDisabledIndex = 2;
+// Walks views in top-down order, wraps each to their current width, and moves
+// the latter ones down to prevernt overlaps.
+CGFloat VerticallyReflowGroup(NSArray* views) {
+ views = [views sortedArrayUsingFunction:cocoa_l10n_util::CompareFrameY
+ context:NULL];
+ CGFloat localVerticalShift = 0;
+ for (NSInteger index = [views count] - 1; index >= 0; --index) {
+ NSView* view = [views objectAtIndex:index];
+ NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(view);
+ localVerticalShift += delta.height;
+ if (localVerticalShift) {
+ NSPoint origin = [view frame].origin;
+ origin.y -= localVerticalShift;
+ [view setFrameOrigin:origin];
+ }
+ }
+ return localVerticalShift;
+}
+
} // namespace
@@ -142,6 +161,18 @@ class PrefObserverBridge : public NotificationObserver {
- (void)awakeFromNib {
DCHECK([self window]);
DCHECK_EQ(self, [[self window] delegate]);
+
+ // Adapt views to potentially long localized strings.
+ CGFloat windowDelta = 0;
+ for (NSTabViewItem* tab in [tabView_ tabViewItems]) {
+ windowDelta = MAX(windowDelta,
+ VerticallyReflowGroup([[tab view] subviews]));
+ }
+
+ NSRect frame = [[self window] frame];
+ frame.origin.y -= windowDelta;
+ frame.size.height += windowDelta;
+ [[self window] setFrame:frame display:NO];
}
// NSWindowDelegate method.