diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 17:55:02 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 17:55:02 +0000 |
commit | 46e9f9d97ec029189618f8ff2089948b950e67e7 (patch) | |
tree | 67057ae5be95d6395487c4c804620a679660a427 /chrome/browser/cocoa | |
parent | e8c916abb296015f9b39c8684cb17be6023147e3 (diff) | |
download | chromium_src-46e9f9d97ec029189618f8ff2089948b950e67e7.zip chromium_src-46e9f9d97ec029189618f8ff2089948b950e67e7.tar.gz chromium_src-46e9f9d97ec029189618f8ff2089948b950e67e7.tar.bz2 |
[Mac] Remove the stats and crash report checkbox from the under the hood prefs in non google chrome builds.
BUG=24425
TEST=Chroimum builds don't have the checkbox, chrome builds do. Chromium builds shouldn't have a gap where it was.
Review URL: http://codereview.chromium.org/363005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.h | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 79 |
2 files changed, 61 insertions, 19 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h index 9a94955..8f6351d 100644 --- a/chrome/browser/cocoa/preferences_window_controller.h +++ b/chrome/browser/cocoa/preferences_window_controller.h @@ -88,6 +88,7 @@ class Profile; StringPrefMember defaultDownloadLocation_; BooleanPrefMember askForSaveLocation_; StringPrefMember currentTheme_; + IBOutlet NSButton* enableLoggingCheckbox_; } // Designated initializer. |profile| should not be NULL. diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 3296a3b..8d7eaea 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -226,6 +226,43 @@ NSInteger CompareFrameY(id view1, id view2, void* context) { return NSOrderedSame; } +#if !defined(GOOGLE_CHROME_BUILD) +// Helper to remove a view and move everything above it down to take over the +// space. +void RemoveViewFromView(NSView* view, NSView* toRemove) { + // Sort bottom up so we can spin over what is above it. + NSArray* views = + [[view subviews] sortedArrayUsingFunction:CompareFrameY context:NULL]; + + // Find where |toRemove| was. + NSUInteger idx = [views indexOfObject:toRemove]; + DCHECK_NE(idx, NSNotFound); + if (idx == [views count] - 1) + return; // It was the top item, nothing to do (shouldn't happen). + + // The amount to shift is the bottom of |toRemove| to the bottom of the view + // above it. + CGFloat shiftDown = + NSMinY([[views objectAtIndex:idx + 1] frame]) - NSMinY([toRemove frame]); + + // Now cycle over the views above it moving them down. + for (++idx; idx < [views count]; ++idx) { + NSView* view = [views objectAtIndex:idx]; + NSPoint origin = [view frame].origin; + origin.y -= shiftDown; + [view setFrameOrigin:origin]; + } + + // Remove |toRemove|. + [toRemove removeFromSuperview]; + + // Resize the view. + [GTMUILocalizerAndLayoutTweaker + resizeViewWithoutAutoResizingSubViews:view + delta:NSMakeSize(0, -shiftDown)]; +} +#endif // !defined(GOOGLE_CHROME_BUILD) + // Helper to tweak the layout of the "Under the Hood" content by autosizing all // the views and moving things up vertically. Special case the two controls for // download location as they are horizontal, and should fill the row. @@ -378,6 +415,29 @@ class PrefObserverBridge : public NotificationObserver { - (void)awakeFromNib { + // Validate some assumptions in debug builds. + + // "Basics", "Personal Stuff", and "Under the Hood" views should be the same + // width. They should be the same width so they are laid out to look as good + // as possible at that width with controls just having to wrap if their text + // is too long. + DCHECK_EQ(NSWidth([basicsView_ frame]), NSWidth([personalStuffView_ frame])) + << "Basics and Personal Stuff should be the same widths"; + DCHECK_EQ(NSWidth([basicsView_ frame]), NSWidth([underTheHoodView_ frame])) + << "Basics and Under the Hood should be the same widths"; + // "Under the Hood" content should always be skinnier than the scroller it + // goes into (we resize it). + DCHECK_LE(NSWidth([underTheHoodContentView_ frame]), + [underTheHoodScroller_ contentSize].width) + << "The Under the Hood content should be narrower than the content " + "of the scroller it goes into"; + +#if !defined(GOOGLE_CHROME_BUILD) + // "Enable logging" (breakpad and stats) is only in Google Chrome builds, + // remove the checkbox and slide everything above it down. + RemoveViewFromView(underTheHoodContentView_, enableLoggingCheckbox_); +#endif // !defined(GOOGLE_CHROME_BUILD) + // Do runtime fixup of the "basics" and "personal stuff" pages for the // strings. Work bottom up shifting views up as needed, and then resize the // page. @@ -418,25 +478,6 @@ class PrefObserverBridge : public NotificationObserver { resizeViewWithoutAutoResizingSubViews:personalStuffView_ delta:NSMakeSize(0.0, verticalShift)]; -#ifndef NDEBUG - // Validate some assumptions in debug builds. - - // "Basics", "Personal Stuff", and "Under the Hood" views should be the same - // width. They should be the same width so they are laid out to look as good - // as possible at that width with controls just having to wrap if their text - // is too long. - DCHECK_EQ(NSWidth([basicsView_ frame]), NSWidth([personalStuffView_ frame])) - << "Basics and Personal Stuff should be the same widths"; - DCHECK_EQ(NSWidth([basicsView_ frame]), NSWidth([underTheHoodView_ frame])) - << "Basics and Under the Hood should be the same widths"; - // "Under the Hood" content should always be skinnier than the scroller it - // goes into (we resize it). - DCHECK_LE(NSWidth([underTheHoodContentView_ frame]), - [underTheHoodScroller_ contentSize].width) - << "The Under the Hood content should be narrower than the content " - "of the scroller it goes into"; -#endif // NDEBUG - // Make the window as wide as the views NSWindow* prefsWindow = [self window]; NSRect frame = [prefsWindow frame]; |