summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 15:34:32 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 15:34:32 +0000
commitc1275b92a99f3e4163c3cc133132e983a424cc90 (patch)
treef271e81aa7f157d7328f30d8fd97c738e7cb22cc /chrome
parenta5f44c93e83cb964fa4c0529d6333f50ee5e73cf (diff)
downloadchromium_src-c1275b92a99f3e4163c3cc133132e983a424cc90.zip
chromium_src-c1275b92a99f3e4163c3cc133132e983a424cc90.tar.gz
chromium_src-c1275b92a99f3e4163c3cc133132e983a424cc90.tar.bz2
[Mac] Create HyperlinkButtonCell and make the "Get themes" button an instance
* Creates a HyperlinkButtonCell that can be used in conjuction with a NSButton to display the control as a hyperlink (blue underliend text), rather than a normal Cocoa control. * Switch the "Get themes..." button in Preferences to be one. BUG=17989,21414 TEST=Preferences-->Personal Stuff, "Get themes..." is a hyperlink. Review URL: http://codereview.chromium.org/248019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/nibs/Preferences.xib48
-rw-r--r--chrome/browser/cocoa/hyperlink_button_cell.h21
-rw-r--r--chrome/browser/cocoa/hyperlink_button_cell.mm105
-rw-r--r--chrome/browser/cocoa/hyperlink_button_cell_unittest.mm85
-rw-r--r--chrome/chrome.gyp3
5 files changed, 236 insertions, 26 deletions
diff --git a/chrome/app/nibs/Preferences.xib b/chrome/app/nibs/Preferences.xib
index 4d3f2ec..027c422 100644
--- a/chrome/app/nibs/Preferences.xib
+++ b/chrome/app/nibs/Preferences.xib
@@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10A432</string>
+ <string key="IBDocument.SystemVersion">10B504</string>
<string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038</string>
+ <string key="IBDocument.AppKitVersion">1038.2</string>
<string key="IBDocument.HIToolboxVersion">437.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -13,6 +13,7 @@
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="74"/>
+ <integer value="18"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -57,7 +58,6 @@
<int key="NSvFlags">36</int>
<string key="NSFrame">{{13, 10}, {533, 499}}</string>
<reference key="NSSuperview" ref="408649839"/>
- <reference key="NSWindow"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTabViewItem" id="1024664267">
@@ -1098,7 +1098,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{22, 419}, {138, 17}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="218087448">
<int key="NSCellFlags">68288064</int>
@@ -1115,7 +1114,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{171, 396}, {300, 40}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<int key="NSNumRows">2</int>
<int key="NSNumCols">1</int>
@@ -1308,7 +1306,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{165, 354}, {184, 32}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="745829249">
<int key="NSCellFlags">67239424</int>
@@ -1329,7 +1326,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{22, 125}, {139, 17}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1066495099">
<int key="NSCellFlags">68288064</int>
@@ -1346,7 +1342,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{22, 317}, {138, 17}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="677476881">
<int key="NSCellFlags">68288064</int>
@@ -1363,7 +1358,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{22, 246}, {138, 17}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="340834043">
<int key="NSCellFlags">68288064</int>
@@ -1380,7 +1374,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{168, 173}, {331, 30}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1066779324">
<int key="NSCellFlags">67239424</int>
@@ -1397,7 +1390,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{165, 235}, {153, 32}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="325720834">
<int key="NSCellFlags">604110336</int>
@@ -1418,7 +1410,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{165, 203}, {180, 32}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="551321318">
<int key="NSCellFlags">67239424</int>
@@ -1439,7 +1430,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{171, 294}, {300, 40}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<int key="NSNumRows">2</int>
<int key="NSNumCols">1</int>
@@ -1630,17 +1620,16 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="423027085">
<reference key="NSNextResponder" ref="712581699"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{165, 83}, {129, 32}}</string>
+ <string key="NSFrame">{{161, 117}, {117, 32}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="309945174">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Get Themes…</string>
+ <string key="NSContents">Get themes…</string>
<reference key="NSSupport" ref="445696277"/>
<reference key="NSControlView" ref="423027085"/>
- <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags">-2034876161</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1651,9 +1640,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSButton" id="865039969">
<reference key="NSNextResponder" ref="712581699"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{165, 115}, {183, 32}}</string>
+ <string key="NSFrame">{{274, 116}, {183, 32}}</string>
<reference key="NSSuperview" ref="712581699"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="270492768">
<int key="NSCellFlags">67239424</int>
@@ -1672,7 +1660,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<string key="NSFrame">{{10, 33}, {513, 453}}</string>
<reference key="NSSuperview" ref="838559838"/>
- <reference key="NSWindow"/>
</object>
<string key="NSLabel">Personal Stuff</string>
<reference key="NSColor" ref="592613688"/>
@@ -1781,7 +1768,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<string key="NSFrameSize">{559, 515}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
@@ -2946,8 +2932,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference ref="885386403"/>
<reference ref="987908490"/>
<reference ref="854747859"/>
- <reference ref="865039969"/>
<reference ref="423027085"/>
+ <reference ref="865039969"/>
</object>
<reference key="parent" ref="614928174"/>
</object>
@@ -4012,6 +3998,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>44.IBPluginDependency</string>
<string>45.IBPluginDependency</string>
<string>457.IBPluginDependency</string>
+ <string>458.CustomClassName</string>
<string>458.IBPluginDependency</string>
<string>47.IBPluginDependency</string>
<string>472.IBPluginDependency</string>
@@ -4115,8 +4102,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{784, 543}, {559, 515}}</string>
- <string>{{784, 543}, {559, 515}}</string>
+ <string>{{556, 284}, {559, 515}}</string>
+ <string>{{556, 284}, {559, 515}}</string>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4162,6 +4149,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>HyperlinkButtonCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4192,7 +4180,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{317, 217}, {466, 639}}</string>
+ <string>{{348, 217}, {466, 639}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4230,7 +4218,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">474</int>
+ <int key="maxID">476</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -4259,6 +4247,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">HyperlinkButtonCell</string>
+ <string key="superclassName">NSButtonCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/cocoa/hyperlink_button_cell.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/hyperlink_button_cell.h b/chrome/browser/cocoa/hyperlink_button_cell.h
new file mode 100644
index 0000000..67b5c20
--- /dev/null
+++ b/chrome/browser/cocoa/hyperlink_button_cell.h
@@ -0,0 +1,21 @@
+// 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 "base/scoped_nsobject.h"
+
+// A HyperlinkButtonCell is used to create an NSButton that looks and acts
+// like a hyperlink. The default styling is to look like blue, underlined text
+// and to have the pointingHand cursor on mouse over.
+//
+// To use in Interface Builder:
+// 1. Drag out an NSButton.
+// 2. Double click on the button so you have the cell component selected.
+// 3. In the Identity panel of the inspector, set the custom class to this.
+@interface HyperlinkButtonCell : NSButtonCell {
+ scoped_nsobject<NSColor> textColor_;
+}
+@property (retain) NSColor* textColor;
+
+@end
diff --git a/chrome/browser/cocoa/hyperlink_button_cell.mm b/chrome/browser/cocoa/hyperlink_button_cell.mm
new file mode 100644
index 0000000..8493a8c
--- /dev/null
+++ b/chrome/browser/cocoa/hyperlink_button_cell.mm
@@ -0,0 +1,105 @@
+// 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 "chrome/browser/cocoa/hyperlink_button_cell.h"
+
+@interface HyperlinkButtonCell (Private)
+- (NSDictionary*)linkAttributres;
+- (void)customizeButtonCell;
+@end
+
+@implementation HyperlinkButtonCell
+@dynamic textColor;
+
+// Designated initializer.
+- (id)init {
+ if ((self = [super init])) {
+ [self customizeButtonCell];
+ }
+ return self;
+}
+
+// Initializer called when the cell is loaded from the NIB.
+- (id)initWithCoder:(NSCoder*)aDecoder {
+ if ((self = [super initWithCoder:aDecoder])) {
+ [self customizeButtonCell];
+ }
+ return self;
+}
+
+// Initializer for code-based creation.
+- (id)initTextCell:(NSString*)title {
+ if ((self = [super initTextCell:title])) {
+ [self customizeButtonCell];
+ }
+ return self;
+}
+
+// Because an NSButtonCell has multiple initializers, this method performs the
+// common cell customization code.
+- (void)customizeButtonCell {
+ [self setBordered:NO];
+ [self setTextColor:[NSColor blueColor]];
+
+ CGFloat fontSize = [NSFont systemFontSizeForControlSize:[self controlSize]];
+ NSFont* font = [NSFont controlContentFontOfSize:fontSize];
+ [self setFont:font];
+
+ // Do not change button appearance when we are pushed.
+ // TODO(rsesek): Change text color to red?
+ [self setHighlightsBy:NSNoCellMask];
+
+ // We need to set this so that we can override |-mouseEntered:| and
+ // |-mouseExited:| to change the cursor style on hover states.
+ [self setShowsBorderOnlyWhileMouseInside:YES];
+}
+
+// Creates the NSDictionary of attributes for the attributed string.
+- (NSDictionary*)linkAttributes {
+ NSUInteger underlineMask = NSUnderlinePatternSolid | NSUnderlineStyleSingle;
+ NSMutableParagraphStyle* paragraphStyle =
+ [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
+ [paragraphStyle setAlignment:[self alignment]];
+
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ [self textColor], NSForegroundColorAttributeName,
+ [NSNumber numberWithInt:underlineMask], NSUnderlineStyleAttributeName,
+ [self font], NSFontAttributeName,
+ [NSCursor pointingHandCursor], NSCursorAttributeName,
+ paragraphStyle, NSParagraphStyleAttributeName,
+ nil
+ ];
+}
+
+// Override the drawing point for the cell so that the custom style attributes
+// can always be applied.
+- (NSRect)drawTitle:(NSAttributedString*)title
+ withFrame:(NSRect)frame
+ inView:(NSView*)controlView {
+ NSAttributedString* attrString =
+ [[NSAttributedString alloc] initWithString:[title string]
+ attributes:[self linkAttributes]];
+ [attrString autorelease];
+ return [super drawTitle:attrString withFrame:frame inView:controlView];
+}
+
+// Override the default behavior to draw the border. Instead, change the cursor.
+- (void)mouseEntered:(NSEvent*)event {
+ [[NSCursor pointingHandCursor] push];
+}
+
+- (void)mouseExited:(NSEvent*)event {
+ [NSCursor pop];
+}
+
+// Setters and getters.
+- (NSColor*)textColor {
+ return textColor_.get();
+}
+
+- (void)setTextColor:(NSColor*)color {
+ textColor_.reset(color);
+}
+
+@end
diff --git a/chrome/browser/cocoa/hyperlink_button_cell_unittest.mm b/chrome/browser/cocoa/hyperlink_button_cell_unittest.mm
new file mode 100644
index 0000000..bbcb202
--- /dev/null
+++ b/chrome/browser/cocoa/hyperlink_button_cell_unittest.mm
@@ -0,0 +1,85 @@
+// 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 "base/scoped_nsobject.h"
+#import "chrome/browser/cocoa/hyperlink_button_cell.h"
+#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace {
+
+class HyperlinkButtonCellTest : public PlatformTest {
+ public:
+ HyperlinkButtonCellTest() {
+ NSRect frame = NSMakeRect(0, 0, 50, 30);
+ view_.reset([[NSButton alloc] initWithFrame:frame]);
+ cell_.reset([[HyperlinkButtonCell alloc] initTextCell:@"Testing"]);
+ [view_ setCell:cell_.get()];
+ [cocoa_helper_.contentView() addSubview:view_.get()];
+ }
+
+ void TestCellCustomization() {
+ EXPECT_FALSE([cell_ isBordered]);
+ EXPECT_EQ(NSNoCellMask, [cell_ highlightsBy]);
+ EXPECT_TRUE([cell_ showsBorderOnlyWhileMouseInside]);
+ EXPECT_TRUE([cell_ textColor]);
+ }
+
+ CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
+ scoped_nsobject<NSButton> view_;
+ scoped_nsobject<HyperlinkButtonCell> cell_;
+};
+
+// Test adding/removing from the view hierarchy, mostly to ensure nothing
+// leaks or crashes.
+TEST_F(HyperlinkButtonCellTest, AddRemove) {
+ EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]);
+ [view_.get() removeFromSuperview];
+ EXPECT_FALSE([view_ superview]);
+}
+
+// Test drawing, mostly to ensure nothing leaks or crashes.
+TEST_F(HyperlinkButtonCellTest, Display) {
+ [view_ display];
+}
+
+// Tests the three designated intializers.
+TEST_F(HyperlinkButtonCellTest, Initializers) {
+ TestCellCustomization(); // |-initTextFrame:|
+
+ cell_.reset([[HyperlinkButtonCell alloc] init]);
+ TestCellCustomization();
+
+ // Need to create a dummy archiver to test |-initWithCoder:|.
+ NSData* emptyData = [NSKeyedArchiver archivedDataWithRootObject:@""];
+ NSCoder* coder =
+ [[[NSKeyedUnarchiver alloc] initForReadingWithData:emptyData] autorelease];
+ cell_.reset([[HyperlinkButtonCell alloc] initWithCoder:coder]);
+ TestCellCustomization();
+}
+
+// Test set color.
+TEST_F(HyperlinkButtonCellTest, SetTextColor) {
+ NSColor* textColor = [NSColor redColor];
+ EXPECT_NE(textColor, [cell_ textColor]);
+ [cell_ setTextColor:textColor];
+ EXPECT_EQ(textColor, [cell_ textColor]);
+}
+
+// Test mouse events.
+// TODO(rsesek): See if we can synthesize mouse events to more accurately
+// test this.
+TEST_F(HyperlinkButtonCellTest, MouseHover) {
+ [[NSCursor disappearingItemCursor] push]; // Set a known state.
+ [cell_ mouseEntered:nil];
+ EXPECT_EQ([NSCursor pointingHandCursor], [NSCursor currentCursor]);
+ [cell_ mouseExited:nil];
+ EXPECT_EQ([NSCursor disappearingItemCursor], [NSCursor currentCursor]);
+ [NSCursor pop];
+}
+
+} // namespace
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 92cbd29..d26a644 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1052,6 +1052,8 @@
'browser/cocoa/history_menu_bridge.mm',
'browser/cocoa/history_menu_cocoa_controller.h',
'browser/cocoa/history_menu_cocoa_controller.mm',
+ 'browser/cocoa/hyperlink_button_cell.h',
+ 'browser/cocoa/hyperlink_button_cell.mm',
'browser/cocoa/hung_renderer_controller.h',
'browser/cocoa/hung_renderer_controller.mm',
'browser/cocoa/import_progress_dialog.h',
@@ -4253,6 +4255,7 @@
'browser/cocoa/gradient_button_cell_unittest.mm',
'browser/cocoa/history_menu_bridge_unittest.mm',
'browser/cocoa/history_menu_cocoa_controller_unittest.mm',
+ 'browser/cocoa/hyperlink_button_cell_unittest.mm',
'browser/cocoa/menu_button_unittest.mm',
'browser/cocoa/nsimage_cache_unittest.mm',
'browser/cocoa/nswindow_local_state_unittest.mm',