diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 15:26:23 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 15:26:23 +0000 |
commit | ba499a0470bc949114850505f1169201fd9d82db (patch) | |
tree | 9774684d6722d99730763247ce7276c62c3a33a5 | |
parent | fe58318ed2129fb699354fac40c85634c8d07138 (diff) | |
download | chromium_src-ba499a0470bc949114850505f1169201fd9d82db.zip chromium_src-ba499a0470bc949114850505f1169201fd9d82db.tar.gz chromium_src-ba499a0470bc949114850505f1169201fd9d82db.tar.bz2 |
[Mac] Add icons to the search engine editor
* Put icons the "name" cell of KeywordEditor.
* Have KeywordEditorCocoaController be the observer of the table model, so that
it is properly notified of all model changes (esp. icons).
TEST=Open search engine editor, see icons.
Review URL: http://codereview.chromium.org/242020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28252 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/KeywordEditor.xib | 683 | ||||
-rw-r--r-- | chrome/browser/cocoa/keyword_editor_cocoa_controller.h | 23 | ||||
-rw-r--r-- | chrome/browser/cocoa/keyword_editor_cocoa_controller.mm | 105 |
3 files changed, 725 insertions, 86 deletions
diff --git a/chrome/app/nibs/KeywordEditor.xib b/chrome/app/nibs/KeywordEditor.xib index 85a263b6..7e28a4e 100644 --- a/chrome/app/nibs/KeywordEditor.xib +++ b/chrome/app/nibs/KeywordEditor.xib @@ -1,14 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9L30</string> - <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.54</string> - <string key="IBDocument.HIToolboxVersion">353.00</string> + <string key="IBDocument.SystemVersion">10B504</string> + <string key="IBDocument.InterfaceBuilderVersion">732</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> + <string key="NS.object.0">732</string> + </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="3"/> + <integer value="8"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -16,7 +20,7 @@ </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys" id="0"> <bool key="EncodedWithXMLCoder">YES</bool> </object> <object class="NSMutableArray" key="dict.values"> @@ -42,7 +46,7 @@ <string key="NSWindowTitle">^IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE</string> <string key="NSWindowClass">NSWindow</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> <string key="NSWindowContentMinSize">{400, 250}</string> <object class="NSView" key="NSWindowView" id="1006"> <reference key="NSNextResponder"/> @@ -82,16 +86,16 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="219687723"> <string key="NSIdentifier">name</string> - <double key="NSWidth">2.680000e+02</double> - <double key="NSMinWidth">4.000000e+01</double> - <double key="NSMaxWidth">1.000000e+03</double> + <double key="NSWidth">286</double> + <double key="NSMinWidth">40</double> + <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> <string key="NSContents">^IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN</string> <object class="NSFont" key="NSSupport" id="26"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.100000e+01</double> + <double key="NSSize">11</double> <int key="NSfFlags">3100</int> </object> <object class="NSColor" key="NSBackgroundColor" id="360181545"> @@ -108,31 +112,29 @@ </object> </object> </object> - <object class="NSTextFieldCell" key="NSDataCell" id="380310934"> - <int key="NSCellFlags">337772096</int> - <int key="NSCellFlags2">2048</int> - <string key="NSContents">Text Cell</string> + <object class="NSButtonCell" key="NSDataCell" id="730302505"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">33554432</int> + <string key="NSContents">Image and Text Cell</string> <object class="NSFont" key="NSSupport" id="28180702"> <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.300000e+01</double> + <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <reference key="NSControlView" ref="79465721"/> - <object class="NSColor" key="NSBackgroundColor" id="720866291"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlBackgroundColor</string> - <object class="NSColor" key="NSColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> - </object> + <int key="NSButtonFlags">-2042871297</int> + <int key="NSButtonFlags2">2</int> + <object class="NSCustomResource" key="NSNormalImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSSwitch</string> </object> - <object class="NSColor" key="NSTextColor" id="13785768"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlTextColor</string> - <reference key="NSColor" ref="499014551"/> + <object class="NSButtonImageSource" key="NSAlternateImage"> + <string key="NSImageName">NSSwitch</string> </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> </object> <int key="NSResizingMask">3</int> <bool key="NSIsResizeable">YES</bool> @@ -140,9 +142,9 @@ </object> <object class="NSTableColumn" id="683197110"> <string key="NSIdentifier">keyword</string> - <double key="NSWidth">2.840000e+02</double> - <double key="NSMinWidth">4.000000e+01</double> - <double key="NSMaxWidth">1.000000e+03</double> + <double key="NSWidth">266</double> + <double key="NSMinWidth">40</double> + <double key="NSMaxWidth">1000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> @@ -157,20 +159,30 @@ <string key="NSContents">Text Cell</string> <reference key="NSSupport" ref="28180702"/> <reference key="NSControlView" ref="79465721"/> - <reference key="NSBackgroundColor" ref="720866291"/> - <reference key="NSTextColor" ref="13785768"/> + <object class="NSColor" key="NSBackgroundColor" id="720866291"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <reference key="NSColor" ref="499014551"/> + </object> </object> <int key="NSResizingMask">3</int> <bool key="NSIsResizeable">YES</bool> <reference key="NSTableView" ref="79465721"/> </object> </object> - <double key="NSIntercellSpacingWidth">3.000000e+00</double> - <double key="NSIntercellSpacingHeight">2.000000e+00</double> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - </object> + <double key="NSIntercellSpacingWidth">3</double> + <double key="NSIntercellSpacingHeight">2</double> + <reference key="NSBackgroundColor" ref="720866291"/> <object class="NSColor" key="NSGridColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> @@ -180,12 +192,15 @@ <bytes key="NSWhite">MC41AA</bytes> </object> </object> - <double key="NSRowHeight">1.700000e+01</double> + <double key="NSRowHeight">18</double> <int key="NSTvFlags">1379958784</int> + <reference key="NSDelegate"/> + <reference key="NSDataSource"/> <int key="NSColumnAutoresizingStyle">1</int> <int key="NSDraggingSourceMaskForLocal">15</int> <int key="NSDraggingSourceMaskForNonLocal">0</int> <bool key="NSAllowsTypeSelect">YES</bool> + <int key="NSTableViewDraggingDestinationStyle">0</int> </object> </object> <string key="NSFrame">{{1, 17}, {558, 315}}</string> @@ -202,7 +217,7 @@ <reference key="NSSuperview" ref="905365236"/> <reference key="NSTarget" ref="905365236"/> <string key="NSAction">_doScroller:</string> - <double key="NSPercent">9.968355e-01</double> + <double key="NSPercent">0.99683549999999999</double> </object> <object class="NSScroller" id="565719222"> <reference key="NSNextResponder" ref="905365236"/> @@ -212,7 +227,7 @@ <int key="NSsFlags">1</int> <reference key="NSTarget" ref="905365236"/> <string key="NSAction">_doScroller:</string> - <double key="NSPercent">7.696552e-01</double> + <double key="NSPercent">0.93781512605042017</double> </object> <object class="NSClipView" id="466409131"> <reference key="NSNextResponder" ref="905365236"/> @@ -239,7 +254,7 @@ <reference key="NSContentView" ref="1071790246"/> <reference key="NSHeaderClipView" ref="466409131"/> <reference key="NSCornerView" ref="552435815"/> - <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes> + <bytes key="NSScrollAmts">QSAAAEEgAABBoAAAQaAAAA</bytes> </object> <object class="NSButton" id="97164574"> <reference key="NSNextResponder" ref="1006"/> @@ -315,7 +330,7 @@ </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{400, 272}</string> - <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> </object> <object class="NSCustomObject" id="757649325"> <string key="NSClassName">ChromeUILocalizer</string> @@ -426,28 +441,26 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBObjectRecord"> <int key="objectID">0</int> - <object class="NSArray" key="object" id="686454233"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="object" ref="0"/> <reference key="children" ref="1000"/> <nil key="parent"/> </object> <object class="IBObjectRecord"> <int key="objectID">-2</int> <reference key="object" ref="1001"/> - <reference key="parent" ref="686454233"/> - <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> </object> <object class="IBObjectRecord"> <int key="objectID">-1</int> <reference key="object" ref="1003"/> - <reference key="parent" ref="686454233"/> + <reference key="parent" ref="0"/> <string key="objectName">First Responder</string> </object> <object class="IBObjectRecord"> <int key="objectID">-3</int> <reference key="object" ref="1004"/> - <reference key="parent" ref="686454233"/> + <reference key="parent" ref="0"/> <string key="objectName">Application</string> </object> <object class="IBObjectRecord"> @@ -457,7 +470,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="1006"/> </object> - <reference key="parent" ref="686454233"/> + <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> <int key="objectID">2</int> @@ -513,7 +526,7 @@ <reference key="object" ref="219687723"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="380310934"/> + <reference ref="730302505"/> </object> <reference key="parent" ref="79465721"/> </object> @@ -532,11 +545,6 @@ <reference key="parent" ref="683197110"/> </object> <object class="IBObjectRecord"> - <int key="objectID">11</int> - <reference key="object" ref="380310934"/> - <reference key="parent" ref="219687723"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">12</int> <reference key="object" ref="97164574"/> <object class="NSMutableArray" key="children"> @@ -581,13 +589,18 @@ <object class="IBObjectRecord"> <int key="objectID">29</int> <reference key="object" ref="757649325"/> - <reference key="parent" ref="686454233"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">41</int> + <reference key="object" ref="730302505"/> + <reference key="parent" ref="219687723"/> </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>-1.IBPluginDependency</string> <string>-2.IBPluginDependency</string> @@ -601,7 +614,6 @@ <string>1.windowTemplate.hasMinSize</string> <string>1.windowTemplate.minSize</string> <string>10.IBPluginDependency</string> - <string>11.IBPluginDependency</string> <string>12.IBPluginDependency</string> <string>13.IBPluginDependency</string> <string>14.IBPluginDependency</string> @@ -612,6 +624,7 @@ <string>29.IBPluginDependency</string> <string>3.IBPluginDependency</string> <string>4.IBPluginDependency</string> + <string>41.IBPluginDependency</string> <string>5.IBPluginDependency</string> <string>6.IBPluginDependency</string> <string>7.IBPluginDependency</string> @@ -652,9 +665,7 @@ </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> @@ -662,15 +673,13 @@ <nil key="activeLocalization"/> <object class="NSMutableDictionary" key="localizations"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <reference key="dict.sortedKeys" ref="0"/> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> </object> </object> <nil key="sourceID"/> - <int key="maxID">38</int> + <int key="maxID">41</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -688,7 +697,7 @@ <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>otherObjectToLocalize_</string> <string>owner_</string> @@ -711,7 +720,7 @@ <string key="superclassName">NSWindowController</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addKeyword:</string> <string>deleteKeyword:</string> @@ -726,7 +735,7 @@ </object> <object class="NSMutableDictionary" key="outlets"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> + <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addButton_</string> <string>makeDefaultButton_</string> @@ -760,9 +769,537 @@ <string key="minorKey">browser/cocoa/tab_strip_model_observer_bridge.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/nswindow_local_state.h</string> + </object> + </object> + </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSActionCell</string> + <string key="superclassName">NSCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSActionCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="121988484"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplication.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="700489963"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="134565972"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSApplication</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButton</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButton.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSButtonCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSCell</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSControl</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="913227515"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSControl.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSFormatter</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSMenu</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="797656932"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenu.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="121988484"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="700489963"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="134565972"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="913227515"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDragging.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <reference key="sourceIdentifier" ref="797656932"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="558744269"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="742314025"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSError.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObject.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSThread.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURL.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFAuthorizationView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFCertificatePanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">SecurityInterface.framework/Headers/SFChooseIdentityPanel.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSResponder</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSResponder.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSScrollView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSScroller</string> + <string key="superclassName">NSControl</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSScroller.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTableColumn</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableColumn.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTableHeaderView</string> + <string key="superclassName">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTableHeaderView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTableView</string> + <string key="superclassName">NSControl</string> + <reference key="sourceIdentifier" ref="558744269"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSTextFieldCell</string> + <string key="superclassName">NSActionCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSTextFieldCell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSClipView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSView</string> + <string key="superclassName">NSResponder</string> + <reference key="sourceIdentifier" ref="742314025"/> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <string key="superclassName">NSResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindow.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindow</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSWindowController</string> + <string key="superclassName">NSResponder</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">showWindow:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string> + </object> + </object> </object> </object> <int key="IBDocument.localizationMode">0</int> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <integer value="1050" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> <string key="IBDocument.LastKnownRelativeProjectPath">../../chrome.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h index 5f74a20..ed9e8e7 100644 --- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h +++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h @@ -4,6 +4,7 @@ #import <Cocoa/Cocoa.h> +#include "app/table_model_observer.h" #include "base/scoped_ptr.h" #include "chrome/browser/search_engines/edit_search_engine_controller.h" #include "chrome/browser/search_engines/keyword_editor_controller.h" @@ -15,7 +16,8 @@ class Profile; // Very thin bridge that simply pushes notifications from C++ to ObjC. class KeywordEditorModelObserver : public TemplateURLModelObserver, - public EditSearchEngineControllerDelegate { + public EditSearchEngineControllerDelegate, + public TableModelObserver { public: explicit KeywordEditorModelObserver(KeywordEditorCocoaController* controller); virtual ~KeywordEditorModelObserver(); @@ -33,9 +35,26 @@ class KeywordEditorModelObserver : public TemplateURLModelObserver, const std::wstring& keyword, const std::wstring& url); + // TableModelObserver overrides. Invalidate icon cache. + virtual void OnModelChanged(); + virtual void OnItemsChanged(int start, int length); + virtual void OnItemsAdded(int start, int length); + virtual void OnItemsRemoved(int start, int length); + + // Lazily converts the image at the given row and caches it in |iconImages_|. + NSImage* GetImageForRow(int row); + + protected: + // Invalidates a range of the |iconImages_| cache. + void InvalidateIconCache(int start, int length); + private: KeywordEditorCocoaController* controller_; + // Stores strong NSImage refs for icons. If an entry is NULL, it will be + // created in GetImageForRow(). + scoped_nsobject<NSPointerArray> iconImages_; + DISALLOW_COPY_AND_ASSIGN(KeywordEditorModelObserver); }; @@ -57,6 +76,8 @@ class KeywordEditorModelObserver : public TemplateURLModelObserver, - (id)initWithProfile:(Profile*)profile; +- (KeywordEditorController*)controller; + // Message forwarded by KeywordEditorModelObserver. - (void)modelChanged; diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm index 4d90f15..4198cf0 100644 --- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm +++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm @@ -15,6 +15,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "grit/generated_resources.h" +#include "skia/ext/skia_utils_mac.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" @interface KeywordEditorCocoaController (Private) @@ -25,7 +26,13 @@ // KeywordEditorModelObserver ------------------------------------------------- KeywordEditorModelObserver::KeywordEditorModelObserver( - KeywordEditorCocoaController* controller) : controller_(controller) { + KeywordEditorCocoaController* controller) + : controller_(controller), + iconImages_([[NSPointerArray alloc] initWithOptions: + NSPointerFunctionsStrongMemory | + NSPointerFunctionsObjectPersonality]) { + int count = [controller_ controller]->table_model()->RowCount(); + [iconImages_ setCount:count]; } KeywordEditorModelObserver::~KeywordEditorModelObserver() { @@ -49,6 +56,56 @@ void KeywordEditorModelObserver::OnEditedKeyword( } } +void KeywordEditorModelObserver::OnModelChanged() { + InvalidateIconCache(0, [iconImages_ count]); + int count = [controller_ controller]->table_model()->RowCount(); + [iconImages_ setCount:count]; + [controller_ modelChanged]; +} + +void KeywordEditorModelObserver::OnItemsChanged(int start, int length) { + InvalidateIconCache(start, length); + [controller_ modelChanged]; +} + +void KeywordEditorModelObserver::OnItemsAdded(int start, int length) { + DCHECK_LE(start, static_cast<int>([iconImages_ count])); + for (int i = 0; i < length; ++i) { + [iconImages_ insertPointer:NULL atIndex:start]; // Values slide down. + } + [controller_ modelChanged]; +} + +void KeywordEditorModelObserver::OnItemsRemoved(int start, int length) { + DCHECK_LE(start + length, static_cast<int>([iconImages_ count])); + for (int i = 0; i < length; ++i) { + [iconImages_ removePointerAtIndex:start]; // Values slide up. + } + [controller_ modelChanged]; +} + +NSImage* KeywordEditorModelObserver::GetImageForRow(int row) { + DCHECK(row >= 0 && row < static_cast<int>([iconImages_ count])); + NSImage* image = static_cast<NSImage*>([iconImages_ pointerAtIndex:row]); + if (!image) { + const SkBitmap bitmapIcon = + [controller_ controller]->table_model()->GetIcon(row); + if (!bitmapIcon.isNull()) { + image = gfx::SkBitmapToNSImage(bitmapIcon); + DCHECK(image); + [iconImages_ replacePointerAtIndex:row withPointer:image]; + } + } + return image; +} + +void KeywordEditorModelObserver::InvalidateIconCache(int start, int length) { + DCHECK_LE(start + length, static_cast<int>([iconImages_ count])); + for (int i = start; i < (start + length); ++i) { + [iconImages_ replacePointerAtIndex:i withPointer:NULL]; + } +} + // KeywordEditorCocoaController ----------------------------------------------- @implementation KeywordEditorCocoaController @@ -62,12 +119,14 @@ void KeywordEditorModelObserver::OnEditedKeyword( profile_ = profile; controller_.reset(new KeywordEditorController(profile_)); observer_.reset(new KeywordEditorModelObserver(self)); + controller_->table_model()->SetObserver(observer_.get()); controller_->url_model()->AddObserver(observer_.get()); } return self; } - (void)dealloc { + controller_->table_model()->SetObserver(NULL); controller_->url_model()->RemoveObserver(observer_.get()); [super dealloc]; } @@ -175,18 +234,26 @@ void KeywordEditorModelObserver::OnEditedKeyword( } - (id)tableView:(NSTableView*)tv -objectValueForTableColumn:(NSTableColumn*)tableColumn - row:(NSInteger)row { + objectValueForTableColumn:(NSTableColumn*)tableColumn + row:(NSInteger)row { + if (!tableColumn) + return nil; NSString* identifier = [tableColumn identifier]; - int columnID = -1; + if ([identifier isEqualToString:@"name"]) { - columnID = IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN; + // The name column is an NSButtonCell so we can have text and image in the + // same cell. As such, the "object value" for a button cell is either on + // or off, so we always return off so we don't act like a button. + return [NSNumber numberWithInt:NSOffState]; } else if ([identifier isEqualToString:@"keyword"]) { - columnID = IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN; + // The keyword object value is a normal string. + int columnID = IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN; + std::wstring text = controller_->table_model()->GetText(row, columnID); + return base::SysWideToNSString(text); } - DCHECK_NE(columnID, -1); - std::wstring text = controller_->table_model()->GetText(row, columnID); - return base::SysWideToNSString(text); + // And we shouldn't have any other columns... + NOTREACHED(); + return nil; } // Table View Delegate -------------------------------------------------------- @@ -196,11 +263,25 @@ objectValueForTableColumn:(NSTableColumn*)tableColumn [self adjustEditingButtons]; } -- (NSCell*)tableView:(NSTableView *)tableView -dataCellForTableColumn:(NSTableColumn*)tableColumn - row:(NSInteger)row { +- (NSCell*)tableView:(NSTableView*)tableView + dataCellForTableColumn:(NSTableColumn*)tableColumn + row:(NSInteger)row { static const CGFloat kCellFontSize = 12.0; NSCell* cell = [tableColumn dataCellForRow:row]; + + // Set the favicon and title for the search engine in the name column. + if ([[tableColumn identifier] isEqualToString:@"name"]) { + DCHECK([cell isKindOfClass:[NSButtonCell class]]); + NSButtonCell* buttonCell = static_cast<NSButtonCell*>(cell); + std::wstring title = controller_->table_model()->GetText(row, + IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN); + [buttonCell setTitle:base::SysWideToNSString(title)]; + [buttonCell setImage:observer_->GetImageForRow(row)]; + [buttonCell setRefusesFirstResponder:YES]; // Don't push in like a button. + [buttonCell setHighlightsBy:NSNoCellMask]; + } + + // The default search engine should be in bold font. const TemplateURL* defaultEngine = controller_->url_model()->GetDefaultSearchProvider(); if (controller_->table_model()->IndexOfTemplateURL(defaultEngine) == row) { |