diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 20:14:44 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 20:14:44 +0000 |
commit | 1f59108d85fe7aaa25d2a9906ca80bb7fa635393 (patch) | |
tree | 1691d8ca1e9af66233489d797102f9e170e8278e | |
parent | 60cab460a9f891d34efacddd3efc10d89279b6d6 (diff) | |
download | chromium_src-1f59108d85fe7aaa25d2a9906ca80bb7fa635393.zip chromium_src-1f59108d85fe7aaa25d2a9906ca80bb7fa635393.tar.gz chromium_src-1f59108d85fe7aaa25d2a9906ca80bb7fa635393.tar.bz2 |
Mac: Give links in infobars a reliable hand cursor.
Do this by switching the text from a NSTextField to a NSTextView.
xib changes: Make text field an ordinary NSTextField instead of our own subclass, connect it to labelPlaceholder_ instead of to label_.
BUG=?,22187
TEST=Open an infobar with a link (e.g. the new geolocation infobars). The cursor should become a hand on hover, and clicking the info bar should no longer put a caret in there. Other infobars (e.g. "Flash plugin crashed" when you kill the flash process on youtube) should look exactly as before. The cursor should still not become an ibeam.
Review URL: http://codereview.chromium.org/1552001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42985 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/InfoBar.xib | 34 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_controller.h | 13 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_controller.mm | 153 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_controller_unittest.mm | 10 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_text_field.h | 14 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_text_field.mm | 20 | ||||
-rw-r--r-- | chrome/browser/cocoa/infobar_text_field_unittest.mm | 70 | ||||
-rw-r--r-- | chrome/browser/cocoa/translate_infobar.mm | 2 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 |
10 files changed, 138 insertions, 181 deletions
diff --git a/chrome/app/nibs/InfoBar.xib b/chrome/app/nibs/InfoBar.xib index 265943c..2507f44 100644 --- a/chrome/app/nibs/InfoBar.xib +++ b/chrome/app/nibs/InfoBar.xib @@ -205,14 +205,6 @@ <int key="connectionID">10</int> </object> <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">label_</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="293244832"/> - </object> - <int key="connectionID">11</int> - </object> - <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> <string key="label">dismiss:</string> <reference key="source" ref="1001"/> @@ -292,6 +284,14 @@ </object> <int key="connectionID">34</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">labelPlaceholder_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="293244832"/> + </object> + <int key="connectionID">35</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -430,7 +430,6 @@ <string>15.CustomClassName</string> <string>15.IBPluginDependency</string> <string>16.IBPluginDependency</string> - <string>2.CustomClassName</string> <string>2.IBPluginDependency</string> <string>20.IBPluginDependency</string> <string>21.IBPluginDependency</string> @@ -454,14 +453,13 @@ <string>HoverCloseButton</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>InfoBarTextField</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>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{329, 1503}, {480, 31}}</string> + <string>{{329, 825}, {480, 31}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -487,7 +485,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">34</int> + <int key="maxID">35</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -556,7 +554,7 @@ <string>containerController_</string> <string>image_</string> <string>infoBarView_</string> - <string>label_</string> + <string>labelPlaceholder_</string> <string>okButton_</string> </object> <object class="NSMutableArray" key="dict.values"> @@ -565,7 +563,7 @@ <string>HoverCloseButton</string> <string>id</string> <string>NSImageView</string> - <string>NSView</string> + <string>InfoBarGradientView</string> <string>NSTextField</string> <string>NSButton</string> </object> @@ -584,14 +582,6 @@ </object> </object> <object class="IBPartialClassDescription"> - <string key="className">InfoBarTextField</string> - <string key="superclassName">NSTextField</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">browser/cocoa/infobar_text_field.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> diff --git a/chrome/browser/cocoa/infobar_controller.h b/chrome/browser/cocoa/infobar_controller.h index 4d1ab4b..d3bf003 100644 --- a/chrome/browser/cocoa/infobar_controller.h +++ b/chrome/browser/cocoa/infobar_controller.h @@ -4,6 +4,8 @@ #import <Cocoa/Cocoa.h> +#include "base/scoped_nsobject.h" + @class AnimatableView; @class HoverCloseButton; @protocol InfoBarContainer; @@ -22,7 +24,7 @@ class InfoBarDelegate; @protected IBOutlet InfoBarGradientView* infoBarView_; IBOutlet NSImageView* image_; - IBOutlet NSTextField* label_; + IBOutlet NSTextField* labelPlaceholder_; IBOutlet NSButton* okButton_; IBOutlet NSButton* cancelButton_; IBOutlet HoverCloseButton* closeButton_; @@ -31,6 +33,12 @@ class InfoBarDelegate; // while this controller is still alive. Always check |delegate_| against // NULL before using it. InfoBarDelegate* delegate_; // weak, can be NULL + + // Text fields don't work as well with embedded links as text views, but + // text views cannot conveniently be created in IB. The xib file contains + // a text field |labelPlaceholder_| that's replaced by this text view |label_| + // in -awakeFromNib. + scoped_nsobject<NSTextView> label_; }; // Initializes a new InfoBarController. @@ -61,6 +69,9 @@ class InfoBarDelegate; // default implementation does nothing. - (void)addAdditionalControls; +// Sets the info bar message to the specified |message|. +- (void)setLabelToMessage:(NSString*)message; + @property(assign, nonatomic) id<InfoBarContainer> containerController; @property(readonly) InfoBarDelegate* delegate; diff --git a/chrome/browser/cocoa/infobar_controller.mm b/chrome/browser/cocoa/infobar_controller.mm index b360041..fa3ec3b 100644 --- a/chrome/browser/cocoa/infobar_controller.mm +++ b/chrome/browser/cocoa/infobar_controller.mm @@ -23,7 +23,37 @@ const float kAnimateOpenDuration = 0.12; const float kAnimateCloseDuration = 0.12; } +// This simple subclass of |NSTextView| just doesn't show the (text) cursor +// (|NSTextView| displays the cursor with full keyboard accessibility enabled). +@interface InfoBarTextView : NSTextView +@end + +@implementation InfoBarTextView + +// Never draw the insertion point (otherwise, it shows up without any user +// action if full keyboard accessibility is enabled). +- (BOOL)shouldDrawInsertionPoint { + return NO; +} + +- (void)resetCursorRects { + // Do not show the ibeam cursor. Required for when the cursor is inside of the + // text view but outside of the attributed string. + [self addCursorRect:[self frame] cursor:[NSCursor arrowCursor]]; +} + +- (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange + granularity:(NSSelectionGranularity)granularity { + // Do not allow selections. + return NSMakeRange(0, 0); +} + +@end + @interface InfoBarController (PrivateMethods) +// Sets |label_| based on |labelPlaceholder_|, sets |labelPlaceholder_| to nil. +- (void)initializeLabel; + // Asks the container controller to remove the infobar for this delegate. This // call will trigger a notification that starts the infobar animating closed. - (void)removeInfoBar; @@ -38,10 +68,10 @@ const float kAnimateCloseDuration = 0.12; - (void)removeButtons; // Sets the info bar message to the specified |message|, with a hypertext -// style link. |link| will be inserted into message at |link_offset|. --(void)setLabelToMessage:(NSString*)message - withLink:(NSString*)link - atOffset:(NSUInteger)link_offset; +// style link. |link| will be inserted into message at |linkOffset|. +- (void)setLabelToMessage:(NSString*)message + withLink:(NSString*)link + atOffset:(NSUInteger)linkOffset; @end @implementation InfoBarController @@ -68,16 +98,26 @@ const float kAnimateCloseDuration = 0.12; // No icon, remove it from the view and grow the textfield to include the // space. NSRect imageFrame = [image_ frame]; - NSRect labelFrame = [label_ frame]; + NSRect labelFrame = [labelPlaceholder_ frame]; labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); labelFrame.origin.x = imageFrame.origin.x; [image_ removeFromSuperview]; - [label_ setFrame:labelFrame]; + [labelPlaceholder_ setFrame:labelFrame]; } + [self initializeLabel]; [self addAdditionalControls]; } +// Called when someone clicks on the embedded link. +- (BOOL) textView:(NSTextView*)textView + clickedOnLink:(id)link + atIndex:(NSUInteger)charIndex { + if ([self respondsToSelector:@selector(linkClicked)]) + [self performSelector:@selector(linkClicked)]; + return YES; +} + // Called when someone clicks on the ok button. - (void)ok:(id)sender { // Subclasses must override this method if they do not hide the ok button. @@ -138,10 +178,42 @@ const float kAnimateCloseDuration = 0.12; // Default implementation does nothing. } +- (void)setLabelToMessage:(NSString*)message { + NSMutableDictionary* attributes = [NSMutableDictionary dictionary]; + NSFont* font = [NSFont labelFontOfSize: + [NSFont systemFontSizeForControlSize:NSRegularControlSize]]; + [attributes setObject:font + forKey:NSFontAttributeName]; + [attributes setObject:[NSCursor arrowCursor] + forKey:NSCursorAttributeName]; + scoped_nsobject<NSAttributedString> attributedString( + [[NSAttributedString alloc] initWithString:message + attributes:attributes]); + [[label_.get() textStorage] setAttributedString:attributedString]; +} + @end @implementation InfoBarController (PrivateMethods) +- (void)initializeLabel { + // Replace the label placeholder NSTextField with the real label NSTextView. + // The former doesn't show links in a nice way, but the latter can't be added + // in IB without a containing scroll view, so create the NSTextView + // programmatically. + label_.reset([[InfoBarTextView alloc] + initWithFrame:[labelPlaceholder_ frame]]); + [label_.get() setAutoresizingMask:[labelPlaceholder_ autoresizingMask]]; + [[labelPlaceholder_ superview] + replaceSubview:labelPlaceholder_ with:label_.get()]; + labelPlaceholder_ = nil; // now released + [label_.get() setDelegate:self]; + [label_.get() setEditable:NO]; + [label_.get() setDrawsBackground:NO]; + [label_.get() setHorizontallyResizable:YES]; + [label_.get() setVerticallyResizable:NO]; +} + - (void)removeInfoBar { DCHECK(delegate_); [containerController_ removeDelegate:delegate_]; @@ -150,11 +222,11 @@ const float kAnimateCloseDuration = 0.12; - (void)removeButtons { // Extend the label all the way across. // Remove the ok and cancel buttons, since they are not needed. - NSRect labelFrame = [label_ frame]; + NSRect labelFrame = [label_.get() frame]; labelFrame.size.width = NSMaxX([cancelButton_ frame]) - NSMinX(labelFrame); [okButton_ removeFromSuperview]; [cancelButton_ removeFromSuperview]; - [label_ setFrame:labelFrame]; + [label_.get() setFrame:labelFrame]; } - (void)cleanUpAfterAnimation:(BOOL)finished { @@ -188,52 +260,47 @@ const float kAnimateCloseDuration = 0.12; // TODO(joth): This method factors out some common functionality between the // various derived infobar classes, however the class hierarchy itself could // use refactoring to reduce this duplication. http://crbug.com/38924 --(void)setLabelToMessage:(NSString*)message - withLink:(NSString*)link - atOffset:(NSUInteger)link_offset { +- (void)setLabelToMessage:(NSString*)message + withLink:(NSString*)link + atOffset:(NSUInteger)linkOffset { // Create an attributes dictionary for the entire message. We have // to expicitly set the font the control's font. We also override // the cursor to give us the normal cursor rather than the text // insertion cursor. - NSMutableDictionary* linkAttributes = - [NSMutableDictionary dictionaryWithObject:[NSCursor arrowCursor] - forKey:NSCursorAttributeName]; - [linkAttributes setObject:[label_ font] + NSMutableDictionary* linkAttributes = [NSMutableDictionary dictionary]; + [linkAttributes setObject:[NSCursor arrowCursor] + forKey:NSCursorAttributeName]; + NSFont* font = [NSFont labelFontOfSize: + [NSFont systemFontSizeForControlSize:NSRegularControlSize]]; + [linkAttributes setObject:font forKey:NSFontAttributeName]; // Create the attributed string for the main message text. - NSMutableAttributedString* infoText = - [[[NSMutableAttributedString alloc] - initWithString:message] autorelease]; - [infoText addAttributes:linkAttributes - range:NSMakeRange(0, [infoText length])]; - + scoped_nsobject<NSMutableAttributedString> infoText( + [[NSMutableAttributedString alloc] initWithString:message]); + [infoText.get() addAttributes:linkAttributes + range:NSMakeRange(0, [infoText.get() length])]; // Add additional attributes to style the link text appropriately as - // well as linkify it. We use an empty string for the NSLink - // attribute because the actual object we pass doesn't matter, but - // it cannot be nil. + // well as linkify it. [linkAttributes setObject:[NSColor blueColor] forKey:NSForegroundColorAttributeName]; [linkAttributes setObject:[NSNumber numberWithBool:YES] forKey:NSUnderlineStyleAttributeName]; [linkAttributes setObject:[NSCursor pointingHandCursor] forKey:NSCursorAttributeName]; + [linkAttributes setObject:[NSNumber numberWithInt:NSSingleUnderlineStyle] + forKey:NSUnderlineStyleAttributeName]; [linkAttributes setObject:[NSString string] // dummy value forKey:NSLinkAttributeName]; // Insert the link text into the string at the appropriate offset. - NSAttributedString* attributed_string = - [[[NSAttributedString alloc] initWithString:link - attributes:linkAttributes] autorelease]; - [infoText insertAttributedString:attributed_string - atIndex:link_offset]; - - // Update the label view with the new text. The view must be - // selectable and allow editing text attributes for the - // linkification to work correctly. - [label_ setAllowsEditingTextAttributes:YES]; - [label_ setSelectable:YES]; - [label_ setAttributedStringValue:infoText]; + scoped_nsobject<NSAttributedString> attributedString( + [[NSAttributedString alloc] initWithString:link + attributes:linkAttributes]); + [infoText.get() insertAttributedString:attributedString.get() + atIndex:linkOffset]; + // Update the label view with the new text. + [[label_.get() textStorage] setAttributedString:infoText]; } @end @@ -252,7 +319,7 @@ const float kAnimateCloseDuration = 0.12; // Insert the text. AlertInfoBarDelegate* delegate = delegate_->AsAlertInfoBarDelegate(); DCHECK(delegate); - [label_ setStringValue:base::SysWideToNSString(delegate->GetMessageText())]; + [self setLabelToMessage:base::SysWideToNSString(delegate->GetMessageText())]; } @end @@ -269,10 +336,6 @@ const float kAnimateCloseDuration = 0.12; // use a custom NSTextField subclass, which allows us to override // textView:clickedOnLink:atIndex: and intercept clicks. // -// TODO(rohitrao): Using an NSTextField here has some weird UI side -// effects, such as showing the wrong cursor at times. Explore other -// solutions. The About box legal block has the same issue, maybe share -// a solution. - (void)addAdditionalControls { // No buttons. [self removeButtons]; @@ -334,7 +397,7 @@ const float kAnimateCloseDuration = 0.12; CGFloat spaceBetweenButtons = NSMinX(cancelButtonFrame) - NSMaxX(okButtonFrame); CGFloat spaceBeforeButtons = - NSMinX(okButtonFrame) - NSMaxX([label_ frame]); + NSMinX(okButtonFrame) - NSMaxX([label_.get() frame]); // Update and position the Cancel button if needed. Otherwise, hide it. if (visibleButtons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { @@ -382,18 +445,18 @@ const float kAnimateCloseDuration = 0.12; rightEdge -= spaceBeforeButtons; } - NSRect frame = [label_ frame]; + NSRect frame = [label_.get() frame]; DCHECK(rightEdge > NSMinX(frame)) << "Need to make the xib larger to handle buttons with text this long"; frame.size.width = rightEdge - NSMinX(frame); - [label_ setFrame:frame]; + [label_.get() setFrame:frame]; // Set the text and link. NSString* message = base::SysWideToNSString(delegate->GetMessageText()); std::wstring link = delegate->GetLinkText(); if (link.empty()) { // Simple case: no link, so just set the message directly. - [label_ setStringValue:message]; + [self setLabelToMessage:message]; } else { // Inserting the link unintentionally causes the text to have a slightly // different result to the simple case above: text is truncated on word diff --git a/chrome/browser/cocoa/infobar_controller_unittest.mm b/chrome/browser/cocoa/infobar_controller_unittest.mm index 5ed5f12..23cabb9 100644 --- a/chrome/browser/cocoa/infobar_controller_unittest.mm +++ b/chrome/browser/cocoa/infobar_controller_unittest.mm @@ -16,12 +16,12 @@ #include "testing/platform_test.h" @interface InfoBarController (ExposedForTesting) -- (NSTextField*)label; +- (NSString*)labelString; @end @implementation InfoBarController (ExposedForTesting) -- (NSTextField*)label { - return label_; +- (NSString*)labelString { + return [label_.get() string]; } @end @@ -131,7 +131,7 @@ TEST_F(AlertInfoBarControllerTest, ShowAndDismiss) { // Check to make sure the infobar message was set properly. EXPECT_EQ(std::wstring(kMockAlertInfoBarMessage), - base::SysNSStringToWide([[controller_.get() label] stringValue])); + base::SysNSStringToWide([controller_.get() labelString])); // Check that dismissing the infobar calls InfoBarClosed() on the delegate. [controller_ dismiss:nil]; @@ -187,7 +187,7 @@ TEST_F(ConfirmInfoBarControllerTest, ShowAndDismiss) { // Check to make sure the infobar message was set properly. EXPECT_EQ(std::wstring(kMockConfirmInfoBarMessage), - base::SysNSStringToWide([[controller_.get() label] stringValue])); + base::SysNSStringToWide([controller_.get() labelString])); // Check that dismissing the infobar calls InfoBarClosed() on the delegate. [controller_ dismiss:nil]; diff --git a/chrome/browser/cocoa/infobar_text_field.h b/chrome/browser/cocoa/infobar_text_field.h deleted file mode 100644 index 6f7d482..0000000 --- a/chrome/browser/cocoa/infobar_text_field.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2009 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 <Cocoa/Cocoa.h> - -// A subclass of NSTextField that allows us to customize NSTextView -// delegate method implementations. We override -// textView:clickedOnLink:atIndex: to handle users clicking on URLs -// embedded in LinkInfoBars. -@interface InfoBarTextField : NSTextField { -} -@end - diff --git a/chrome/browser/cocoa/infobar_text_field.mm b/chrome/browser/cocoa/infobar_text_field.mm deleted file mode 100644 index accea6a..0000000 --- a/chrome/browser/cocoa/infobar_text_field.mm +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2009 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 <Cocoa/Cocoa.h> - -#import "chrome/browser/cocoa/infobar_text_field.h" - -@implementation InfoBarTextField - -- (BOOL)textView:(NSTextView*)aTextView - clickedOnLink:(id)link - atIndex:(NSUInteger)charIndex { - if ([[self delegate] respondsToSelector:@selector(linkClicked)]) - [[self delegate] performSelector:@selector(linkClicked)]; - - return YES; // We handled the click, so Cocoa does not need to do anything. -} - -@end diff --git a/chrome/browser/cocoa/infobar_text_field_unittest.mm b/chrome/browser/cocoa/infobar_text_field_unittest.mm deleted file mode 100644 index e9887acb..0000000 --- a/chrome/browser/cocoa/infobar_text_field_unittest.mm +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2009 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 <Cocoa/Cocoa.h> - -#include "chrome/browser/cocoa/cocoa_test_helper.h" -#import "chrome/browser/cocoa/infobar_text_field.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" - -@interface TextFieldDelegatePong: NSObject { - @private - BOOL pong_; -} -@property(readonly) BOOL pong; -@end - -@implementation TextFieldDelegatePong -@synthesize pong = pong_; - -- (id)init { - if ((self == [super init])) { - pong_ = NO; - } - return self; -} - -- (void)linkClicked { - pong_ = YES; -} -@end - -namespace { - -/////////////////////////////////////////////////////////////////////////// -// Test fixtures - -class InfoBarTextFieldTest : public CocoaTest { - public: - InfoBarTextFieldTest() { - NSRect frame = NSMakeRect(0, 0, 200, 200); - scoped_nsobject<InfoBarTextField> field( - [[InfoBarTextField alloc] initWithFrame:frame]); - field_ = field.get(); - [[test_window() contentView] addSubview:field_]; - } - - InfoBarTextField* field_; -}; - -//////////////////////////////////////////////////////////////////////////// -// Tests - -TEST_VIEW(InfoBarTextFieldTest, field_) - -TEST_F(InfoBarTextFieldTest, LinkClicked) { - scoped_nsobject<InfoBarTextField> field( - [[InfoBarTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]); - scoped_nsobject<TextFieldDelegatePong> delegate( - [[TextFieldDelegatePong alloc] init]); - [field setDelegate:delegate]; - - // Our implementation doesn't look at any of these fields, so they - // can all be nil. - [field textView:nil clickedOnLink:nil atIndex:0]; - EXPECT_TRUE([delegate pong]); -} - -} // namespace diff --git a/chrome/browser/cocoa/translate_infobar.mm b/chrome/browser/cocoa/translate_infobar.mm index 03e1d52..930ad5b 100644 --- a/chrome/browser/cocoa/translate_infobar.mm +++ b/chrome/browser/cocoa/translate_infobar.mm @@ -465,7 +465,7 @@ class TranslateNotificationObserverBridge : NSRange label2Range = NSMakeRange(offsets[0], offsets[1] - offsets[0]); NSString* label2Text = [message_text substringWithRange:label2Range]; - [label_ setStringValue:label1Text]; + [self setLabelToMessage:label1Text]; [label2_ setStringValue:label2Text]; numLabelsDisplayed_ = 2; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index a6ad5ea..fa03ff9 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -690,8 +690,6 @@ 'browser/cocoa/infobar_gradient_view.h', 'browser/cocoa/infobar_gradient_view.mm', 'browser/cocoa/infobar_test_helper.h', - 'browser/cocoa/infobar_text_field.h', - 'browser/cocoa/infobar_text_field.mm', 'browser/cocoa/keystone_glue.h', 'browser/cocoa/keystone_glue.mm', 'browser/cocoa/keystone_infobar.h', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 94c0275..b9c1da6 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -679,7 +679,6 @@ 'browser/cocoa/infobar_container_controller_unittest.mm', 'browser/cocoa/infobar_controller_unittest.mm', 'browser/cocoa/infobar_gradient_view_unittest.mm', - 'browser/cocoa/infobar_text_field_unittest.mm', 'browser/cocoa/keystone_glue_unittest.mm', 'browser/cocoa/keyword_editor_cocoa_controller_unittest.mm', 'browser/cocoa/location_bar_view_mac_unittest.mm', |