diff options
-rw-r--r-- | chrome/app/nibs/AutoFillAddressFormView.xib | 60 | ||||
-rw-r--r-- | chrome/app/nibs/AutoFillCreditCardFormView.xib | 36 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_text_field_mac.h | 18 | ||||
-rw-r--r-- | chrome/browser/autofill/autofill_text_field_mac.mm | 23 | ||||
-rw-r--r-- | chrome/browser/cocoa/disclosure_view_controller.h | 11 | ||||
-rw-r--r-- | chrome/browser/cocoa/disclosure_view_controller.mm | 65 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 2 |
7 files changed, 202 insertions, 13 deletions
diff --git a/chrome/app/nibs/AutoFillAddressFormView.xib b/chrome/app/nibs/AutoFillAddressFormView.xib index 68ece4c..cd81344 100644 --- a/chrome/app/nibs/AutoFillAddressFormView.xib +++ b/chrome/app/nibs/AutoFillAddressFormView.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="3"/> + <integer value="101"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1097,6 +1097,14 @@ </object> <int key="connectionID">212</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">detailedView_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="556992356"/> + </object> + <int key="connectionID">214</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -1686,18 +1694,22 @@ <string>10.IBPluginDependency</string> <string>11.IBPluginDependency</string> <string>12.IBPluginDependency</string> + <string>13.CustomClassName</string> <string>13.IBPluginDependency</string> <string>14.IBPluginDependency</string> <string>160.IBPluginDependency</string> <string>17.IBPluginDependency</string> + <string>18.CustomClassName</string> <string>18.IBPluginDependency</string> <string>19.IBPluginDependency</string> <string>20.IBPluginDependency</string> <string>21.IBPluginDependency</string> + <string>22.CustomClassName</string> <string>22.IBPluginDependency</string> <string>23.IBPluginDependency</string> <string>24.IBPluginDependency</string> <string>25.IBPluginDependency</string> + <string>26.CustomClassName</string> <string>26.IBPluginDependency</string> <string>27.IBPluginDependency</string> <string>28.IBPluginDependency</string> @@ -1705,8 +1717,10 @@ <string>3.IBPluginDependency</string> <string>3.IBUserGuides</string> <string>46.IBPluginDependency</string> + <string>47.CustomClassName</string> <string>47.IBPluginDependency</string> <string>48.IBPluginDependency</string> + <string>49.CustomClassName</string> <string>49.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>50.IBPluginDependency</string> @@ -1714,17 +1728,21 @@ <string>52.IBPluginDependency</string> <string>53.IBPluginDependency</string> <string>54.IBPluginDependency</string> + <string>55.CustomClassName</string> <string>55.IBPluginDependency</string> <string>56.IBPluginDependency</string> <string>57.IBPluginDependency</string> <string>58.IBPluginDependency</string> + <string>59.CustomClassName</string> <string>59.IBPluginDependency</string> <string>6.IBPluginDependency</string> <string>60.IBPluginDependency</string> <string>61.IBPluginDependency</string> <string>62.IBPluginDependency</string> + <string>63.CustomClassName</string> <string>63.IBPluginDependency</string> <string>64.IBPluginDependency</string> + <string>65.CustomClassName</string> <string>65.IBPluginDependency</string> <string>66.IBPluginDependency</string> <string>67.IBPluginDependency</string> @@ -1732,26 +1750,34 @@ <string>69.IBPluginDependency</string> <string>7.IBPluginDependency</string> <string>70.IBPluginDependency</string> + <string>71.CustomClassName</string> <string>71.IBPluginDependency</string> <string>72.IBPluginDependency</string> <string>73.IBPluginDependency</string> <string>74.IBPluginDependency</string> + <string>75.CustomClassName</string> <string>75.IBPluginDependency</string> <string>76.IBPluginDependency</string> <string>77.IBPluginDependency</string> <string>78.IBPluginDependency</string> + <string>79.CustomClassName</string> <string>79.IBPluginDependency</string> <string>8.IBPluginDependency</string> <string>80.IBPluginDependency</string> <string>81.IBPluginDependency</string> + <string>84.CustomClassName</string> <string>84.IBPluginDependency</string> <string>85.IBPluginDependency</string> + <string>86.CustomClassName</string> <string>86.IBPluginDependency</string> <string>87.IBPluginDependency</string> <string>88.IBPluginDependency</string> + <string>89.CustomClassName</string> <string>89.IBPluginDependency</string> <string>9.IBPluginDependency</string> + <string>91.CustomClassName</string> <string>91.IBPluginDependency</string> + <string>92.CustomClassName</string> <string>92.IBPluginDependency</string> <string>93.IBPluginDependency</string> <string>94.IBPluginDependency</string> @@ -1766,18 +1792,22 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1787,8 +1817,10 @@ <bool key="EncodedWithXMLCoder">YES</bool> </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1796,17 +1828,21 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1814,26 +1850,34 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1861,7 +1905,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">212</int> + <int key="maxID">214</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1875,6 +1919,14 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">AutoFillTextField</string> + <string key="superclassName">NSTextField</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/autofill/autofill_text_field_mac.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">ChromeUILocalizer</string> <string key="superclassName">GTMUILocalizer</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -1885,6 +1937,10 @@ <object class="IBPartialClassDescription"> <string key="className">DisclosureViewController</string> <string key="superclassName">NSViewController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">detailedView_</string> + <string key="NS.object.0">NSBox</string> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/cocoa/disclosure_view_controller.h</string> diff --git a/chrome/app/nibs/AutoFillCreditCardFormView.xib b/chrome/app/nibs/AutoFillCreditCardFormView.xib index b10535020..97d23f3 100644 --- a/chrome/app/nibs/AutoFillCreditCardFormView.xib +++ b/chrome/app/nibs/AutoFillCreditCardFormView.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="3"/> + <integer value="115"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -757,6 +757,14 @@ </object> <int key="connectionID">179</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">detailedView_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="436522406"/> + </object> + <int key="connectionID">181</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -1163,28 +1171,34 @@ <string>112.IBPluginDependency</string> <string>113.IBPluginDependency</string> <string>12.IBPluginDependency</string> + <string>13.CustomClassName</string> <string>13.IBPluginDependency</string> <string>14.IBPluginDependency</string> <string>157.IBPluginDependency</string> <string>17.IBPluginDependency</string> + <string>18.CustomClassName</string> <string>18.IBPluginDependency</string> <string>19.IBPluginDependency</string> <string>20.IBPluginDependency</string> <string>21.IBPluginDependency</string> + <string>22.CustomClassName</string> <string>22.IBPluginDependency</string> <string>23.IBPluginDependency</string> <string>24.IBPluginDependency</string> <string>25.IBPluginDependency</string> + <string>26.CustomClassName</string> <string>26.IBPluginDependency</string> <string>27.IBPluginDependency</string> <string>28.IBPluginDependency</string> <string>3.IBEditorWindowLastContentRect</string> <string>3.IBPluginDependency</string> <string>3.IBUserGuides</string> + <string>48.CustomClassName</string> <string>48.IBPluginDependency</string> <string>49.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>50.IBPluginDependency</string> + <string>51.CustomClassName</string> <string>51.IBPluginDependency</string> <string>52.IBPluginDependency</string> <string>53.IBPluginDependency</string> @@ -1217,18 +1231,22 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1237,10 +1255,12 @@ <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> </object> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>AutoFillTextField</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -1274,7 +1294,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">179</int> + <int key="maxID">181</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -1305,6 +1325,14 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">AutoFillTextField</string> + <string key="superclassName">NSTextField</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/autofill/autofill_text_field_mac.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">ChromeUILocalizer</string> <string key="superclassName">GTMUILocalizer</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -1315,6 +1343,10 @@ <object class="IBPartialClassDescription"> <string key="className">DisclosureViewController</string> <string key="superclassName">NSViewController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">detailedView_</string> + <string key="NS.object.0">NSBox</string> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/cocoa/disclosure_view_controller.h</string> diff --git a/chrome/browser/autofill/autofill_text_field_mac.h b/chrome/browser/autofill/autofill_text_field_mac.h new file mode 100644 index 0000000..559b0a8 --- /dev/null +++ b/chrome/browser/autofill/autofill_text_field_mac.h @@ -0,0 +1,18 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_TEXT_FIELD_MAC_ +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_TEXT_FIELD_MAC_ + +#import <Cocoa/Cocoa.h> + +// Subclass of NSTextField that automatically scrolls containing NSScrollView +// to visually reveal the text field. When the user tabs between text fields +// embedded in a scrolling view they'd like the "first responder" to be visible. +// This class helps achieve that. +@interface AutoFillTextField : NSTextField { +} +@end + +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TEXT_FIELD_MAC_ diff --git a/chrome/browser/autofill/autofill_text_field_mac.mm b/chrome/browser/autofill/autofill_text_field_mac.mm new file mode 100644 index 0000000..3b19da0 --- /dev/null +++ b/chrome/browser/autofill/autofill_text_field_mac.mm @@ -0,0 +1,23 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "chrome/browser/autofill/autofill_text_field_mac.h" + +@implementation AutoFillTextField + +// Override NSResponder method for when the text field may gain focus. We +// call |scrollRectToVisible| to ensure that this text field is visible within +// the scrolling area. +- (BOOL)becomeFirstResponder { + // Vertical inset is negative to indicate "outset". Provides some visual + // space above and below when tabbing between fields. + const CGFloat kVerticalInset = -40.0; + BOOL becoming = [super becomeFirstResponder]; + if (becoming) { + [self scrollRectToVisible:NSInsetRect([self bounds], 0.0, kVerticalInset)]; + } + return becoming; +} + +@end diff --git a/chrome/browser/cocoa/disclosure_view_controller.h b/chrome/browser/cocoa/disclosure_view_controller.h index 71a2c5f..d7e490e 100644 --- a/chrome/browser/cocoa/disclosure_view_controller.h +++ b/chrome/browser/cocoa/disclosure_view_controller.h @@ -6,8 +6,10 @@ #define CHROME_BROWSER_COCOA_DISCLOSURE_VIEW_CONTROLLER_ #import <Cocoa/Cocoa.h> +#include "base/scoped_nsobject.h" @class DisclosureViewState; +@class NSViewAnimation; // A view class that provides a disclosure triangle that controls the size // of the view. Toggling the disclosure triangle animates the change in @@ -16,11 +18,20 @@ // NSCellStateValue) which corresponds to "open". @interface DisclosureViewController : NSViewController { @private + // The |detailedView_| IBOutlet references the content that becomes visible + // when the disclosure view is in the "open" state. We hold a reference + // to the content so that we can hide and show it when disclosure state + // changes. + IBOutlet NSBox* detailedView_; // weak reference + // The |disclosureState_| is instantiated from within |awakeFromNib|. // We do not hold it as a scoped_nsobject because it is exposed as a KVO // compliant property. DisclosureViewState* disclosureState_; // strong reference CGFloat openHeight_; + + // Animation object for view disclosure transitions. + scoped_nsobject<NSViewAnimation> animation_; } @property (nonatomic, retain) DisclosureViewState* disclosureState; diff --git a/chrome/browser/cocoa/disclosure_view_controller.mm b/chrome/browser/cocoa/disclosure_view_controller.mm index f41acd5..d6046b6 100644 --- a/chrome/browser/cocoa/disclosure_view_controller.mm +++ b/chrome/browser/cocoa/disclosure_view_controller.mm @@ -4,11 +4,13 @@ #import "chrome/browser/cocoa/disclosure_view_controller.h" #include "base/logging.h" -#include "base/scoped_nsobject.h" +namespace { const NSCellStateValue kInitialDisclosureState = NSOffState; const NSInteger kClosedBoxHeight = 20; +const CGFloat kDisclosureAnimationDurationSeconds = .2; NSString* const kKVODisclosedKey = @"disclosed"; +} // This class externalizes the state of the disclosure control. When the // disclosure control is pressed it changes the state of this object. In turn @@ -28,13 +30,11 @@ NSString* const kKVODisclosedKey = @"disclosed"; - (void)initDisclosureState:(NSCellStateValue)state; - (NSRect)openStateFrameSize:(NSRect)startFrame; - (NSRect)closedStateFrameSize:(NSRect)startFrame; - - (void)startAnimations:(NSView*)view start:(NSRect)startFrame end:(NSRect)endFrame; - - (void)discloseDetails:(NSCellStateValue)state; - +- (void)setContentViewVisibility; - (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change @@ -61,6 +61,9 @@ NSString* const kKVODisclosedKey = @"disclosed"; // Set frame size according to initial disclosure state. [self initDisclosureState:kInitialDisclosureState]; + // Set content visibility according to initial disclosure state. + [self setContentViewVisibility]; + // Setup observers so that when disclosure state changes we resize frame // accordingly. [disclosureState_ addObserver:self forKeyPath:kKVODisclosedKey @@ -70,6 +73,7 @@ NSString* const kKVODisclosedKey = @"disclosed"; - (void)dealloc { [disclosureState_ removeObserver:self forKeyPath:kKVODisclosedKey]; + [animation_ stopAnimation]; [disclosureState_ release]; [super dealloc]; } @@ -133,17 +137,43 @@ NSString* const kKVODisclosedKey = @"disclosed"; [NSValue valueWithRect:endFrame], NSViewAnimationEndFrameKey, nil]; + // Stop any existing animation. + [animation_ stopAnimation]; + // Create the view animation object. - scoped_nsobject<NSViewAnimation> animation; - animation.reset([[NSViewAnimation alloc] initWithViewAnimations: + animation_.reset([[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject:dictionary]]); // Set some additional attributes for the animation. - [animation.get() setDuration:.2]; - [animation.get() setAnimationCurve:NSAnimationEaseIn]; + [animation_ setDuration:kDisclosureAnimationDurationSeconds]; + [animation_ setAnimationCurve:NSAnimationEaseIn]; + + // Set self as delegate so we can toggle visibility at end of animation. + [animation_ setDelegate:self]; // Run the animation. - [animation.get() startAnimation]; + [animation_ startAnimation]; +} + +// NSAnimationDelegate method. Before starting the animation we show the +// |detailedView_|. +- (BOOL)animationShouldStart:(NSAnimation*)animation { + [detailedView_ setHidden:NO]; + return YES; +} + +// NSAnimationDelegate method. If animation stops before ending we release +// our animation object. +- (void)animationDidStop:(NSAnimation*)animation { + animation_.reset(); +} + +// NSAnimationDelegate method. Once the disclosure animation is over we set +// content view visibility to match disclosure state. +// |animation_| reference is relinquished at end of animation. +- (void)animationDidEnd:(NSAnimation*)animation { + [self setContentViewVisibility]; + animation_.reset(); } // This method is invoked when the disclosure state changes. It computes @@ -165,6 +195,23 @@ NSString* const kKVODisclosedKey = @"disclosed"; [self startAnimations:[self view] start:startFrame end:endFrame]; } +// Sets the "hidden" state of the content view according to the current +// disclosure state. We do this so that the view hierarchy knows to remove +// undisclosed content from the first responder chain. +- (void)setContentViewVisibility { + NSCellStateValue disclosed = [[disclosureState_ valueForKey:kKVODisclosedKey] + intValue]; + + if (disclosed == NSOnState) { + [detailedView_ setHidden:NO]; + } else if (disclosed == NSOffState) { + [detailedView_ setHidden:YES]; + } else { + NOTREACHED(); + return; + } +} + // The |DisclosureViewController| is an observer of an instance of a // |DisclosureViewState| object. This object lives within the controller's // nib file. When the KVO machinery detects a change to the state diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index aafc27e..c4e8ed0 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -109,6 +109,8 @@ 'browser/autofill/autofill_manager.h', 'browser/autofill/autofill_profile.cc', 'browser/autofill/autofill_profile.h', + 'browser/autofill/autofill_text_field_mac.h', + 'browser/autofill/autofill_text_field_mac.mm', 'browser/autofill/autofill_type.cc', 'browser/autofill/autofill_type.h', 'browser/autofill/billing_address.h', |