summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 02:15:37 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 02:15:37 +0000
commitedb2cd3f0f88b06c6a73380110692bf201ac8472 (patch)
tree5b316347ecaf3a0a6b82fc5fb3b0401d7091346b /chrome/browser
parent8d3f1d5056a621bed3dd431bd33a1fb535b27d81 (diff)
downloadchromium_src-edb2cd3f0f88b06c6a73380110692bf201ac8472.zip
chromium_src-edb2cd3f0f88b06c6a73380110692bf201ac8472.tar.gz
chromium_src-edb2cd3f0f88b06c6a73380110692bf201ac8472.tar.bz2
[Mac] Automatically wrap the Customize Sync dialog to fit contents
xib changes: Adjusted customize sync text field to be as wide as the content view and made it wrap. Created customizeSyncDescriptionTextField_ outlet and hooked it up. BUG=43945 TEST=manual with French Review URL: http://codereview.chromium.org/2001018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/sync_customize_controller.h2
-rw-r--r--chrome/browser/cocoa/sync_customize_controller.mm18
2 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/sync_customize_controller.h b/chrome/browser/cocoa/sync_customize_controller.h
index 07b5e58..32f626e 100644
--- a/chrome/browser/cocoa/sync_customize_controller.h
+++ b/chrome/browser/cocoa/sync_customize_controller.h
@@ -18,6 +18,8 @@ class ProfileSyncService;
@private
ProfileSyncService* syncService_; // weak
+ IBOutlet NSTextField* customizeSyncDescriptionTextField_;
+
// The member variables below are connected to the dialog with KVO.
// The registered flags indicate which model types are enabled for
diff --git a/chrome/browser/cocoa/sync_customize_controller.mm b/chrome/browser/cocoa/sync_customize_controller.mm
index dffbc1b..5ceface 100644
--- a/chrome/browser/cocoa/sync_customize_controller.mm
+++ b/chrome/browser/cocoa/sync_customize_controller.mm
@@ -13,6 +13,7 @@
#import "base/stl_util-inl.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/syncable/model_type.h"
+#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
@implementation SyncCustomizeController
@@ -75,6 +76,23 @@
DCHECK([self window]);
[[self window] setDelegate:self];
+ CGFloat viewHeightChange =
+ [GTMUILocalizerAndLayoutTweaker
+ sizeToFitFixedWidthTextField:customizeSyncDescriptionTextField_];
+ if (viewHeightChange > 0) {
+ // Resize the window. No need to move the controls as they're all
+ // bottom-anchored.
+ NSSize viewSizeChange = NSMakeSize(0, viewHeightChange);
+ NSSize windowSizeChange =
+ [customizeSyncDescriptionTextField_ convertSize:viewSizeChange
+ toView:nil];
+ CGFloat windowHeightChange = windowSizeChange.height;
+ NSRect frame = [[self window] frame];
+ frame.origin.y -= windowHeightChange;
+ frame.size.height += windowHeightChange;
+ [[self window] setFrame:frame display:NO];
+ }
+
syncable::ModelTypeSet registered_types;
syncService_->GetRegisteredDataTypes(&registered_types);
const syncable::ModelType expected_types[] = {