diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 20:52:49 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 20:52:49 +0000 |
commit | 6342b6000d045862bbf1255c1fcafa9a1f24df48 (patch) | |
tree | 5cc55a7c5fbe44e40a316de727a75a59f2f8c7b5 | |
parent | 8aaba6608dfe2f1e9faf15a1c72547a20f7435f3 (diff) | |
download | chromium_src-6342b6000d045862bbf1255c1fcafa9a1f24df48.zip chromium_src-6342b6000d045862bbf1255c1fcafa9a1f24df48.tar.gz chromium_src-6342b6000d045862bbf1255c1fcafa9a1f24df48.tar.bz2 |
L10N pass through download item and download shelf.
- l10n the menus
- l10n the dangerous item buttons
- make view auto size for the dangerous item buttons
TEST=download shelf item buttons and menus are localized
BUG=20529
BUG=20530
Review URL: http://codereview.chromium.org/245009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27242 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/DownloadItem.xib | 313 | ||||
-rw-r--r-- | chrome/app/nibs/DownloadShelf.xib | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_item_controller.h | 7 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_item_controller.mm | 38 | ||||
-rw-r--r-- | chrome/chrome.gyp | 1 |
5 files changed, 282 insertions, 79 deletions
diff --git a/chrome/app/nibs/DownloadItem.xib b/chrome/app/nibs/DownloadItem.xib index df701d3..733acdb 100644 --- a/chrome/app/nibs/DownloadItem.xib +++ b/chrome/app/nibs/DownloadItem.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9L31a</string> + <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> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="66"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -49,60 +49,16 @@ <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSButton" id="185082033"> - <reference key="NSNextResponder" ref="325658281"/> - <int key="NSvFlags">289</int> - <string key="NSFrame">{{300, 1}, {67, 28}}</string> - <reference key="NSSuperview" ref="325658281"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="136006556"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134348800</int> - <string key="NSContents">Save</string> - <object class="NSFont" key="NSSupport" id="26"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">1.100000e+01</double> - <int key="NSfFlags">3100</int> - </object> - <reference key="NSControlView" ref="185082033"/> - <int key="NSButtonFlags">-2038284033</int> - <int key="NSButtonFlags2">129</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> - <object class="NSButton" id="979385092"> - <reference key="NSNextResponder" ref="325658281"/> - <int key="NSvFlags">289</int> - <string key="NSFrame">{{365, 1}, {67, 28}}</string> - <reference key="NSSuperview" ref="325658281"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="93953286"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">134348800</int> - <string key="NSContents">Discard</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="979385092"/> - <int key="NSButtonFlags">-2038284033</int> - <int key="NSButtonFlags2">129</int> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> <object class="NSTextField" id="146169749"> <reference key="NSNextResponder" ref="325658281"/> <int key="NSvFlags">290</int> - <string key="NSFrame">{{36, 5}, {264, 22}}</string> + <string key="NSFrame">{{36, 5}, {261, 22}}</string> <reference key="NSSuperview" ref="325658281"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="622024590"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">272891904</int> - <string key="NSContents">DO NOT TRANSLATE some placeholder text to make layout easier in Interface Builder</string> + <string key="NSContents">some placeholder text to make layout easier in Interface Builder</string> <object class="NSFont" key="NSSupport"> <string key="NSName">LucidaGrande</string> <double key="NSSize">9.000000e+00</double> @@ -154,7 +110,11 @@ <string key="NSClassName">NSImage</string> <string key="NSResourceName">alert_small</string> </object> - <reference key="NSSupport" ref="26"/> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.100000e+01</double> + <int key="NSfFlags">3100</int> + </object> <int key="NSAlign">0</int> <int key="NSScale">0</int> <int key="NSStyle">0</int> @@ -162,6 +122,56 @@ </object> <bool key="NSEditable">YES</bool> </object> + <object class="NSCustomView" id="411206214"> + <reference key="NSNextResponder" ref="325658281"/> + <int key="NSvFlags">289</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="185082033"> + <reference key="NSNextResponder" ref="411206214"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{5, 13}, {67, 28}}</string> + <reference key="NSSuperview" ref="411206214"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="136006556"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134348800</int> + <string key="NSContents">^IDS_SAVE_DOWNLOAD</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="185082033"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="979385092"> + <reference key="NSNextResponder" ref="411206214"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{70, 13}, {67, 28}}</string> + <reference key="NSSuperview" ref="411206214"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="93953286"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134348800</int> + <string key="NSContents">^IDS_DISCARD_DOWNLOAD</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="979385092"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">129</int> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + </object> + <string key="NSFrame">{{295, -12}, {152, 57}}</string> + <reference key="NSSuperview" ref="325658281"/> + <string key="NSClassName">GTMWidthBasedTweaker</string> + </object> </object> <string key="NSFrame">{{1, 1}, {438, 32}}</string> <reference key="NSSuperview" ref="55478397"/> @@ -230,7 +240,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="770771657"> <reference key="NSMenu" ref="571207526"/> - <string key="NSTitle">Open</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_OPEN</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -246,7 +256,7 @@ </object> <object class="NSMenuItem" id="530126839"> <reference key="NSMenu" ref="571207526"/> - <string key="NSTitle">Always open type</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -266,7 +276,7 @@ </object> <object class="NSMenuItem" id="191249624"> <reference key="NSMenu" ref="571207526"/> - <string key="NSTitle">Show in Finder</string> + <string key="NSTitle">^IDS_DOWNLOAD_LINK_SHOW</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -286,7 +296,7 @@ </object> <object class="NSMenuItem" id="426590582"> <reference key="NSMenu" ref="571207526"/> - <string key="NSTitle">Remove from list</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_REMOVE_ITEM</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -296,7 +306,7 @@ </object> <object class="NSMenuItem" id="693025028"> <reference key="NSMenu" ref="571207526"/> - <string key="NSTitle">Cancel</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_CANCEL</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -312,7 +322,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMenuItem" id="514660119"> <reference key="NSMenu" ref="231354576"/> - <string type="base64-UTF8" key="NSTitle">T3BlbiB3aGVuIGNvbXBsZXRl4oCmA</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -322,7 +332,7 @@ </object> <object class="NSMenuItem" id="769910664"> <reference key="NSMenu" ref="231354576"/> - <string key="NSTitle">Always open type</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -342,7 +352,7 @@ </object> <object class="NSMenuItem" id="434679781"> <reference key="NSMenu" ref="231354576"/> - <string key="NSTitle">Show in Finder</string> + <string key="NSTitle">^IDS_DOWNLOAD_LINK_SHOW</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -362,7 +372,7 @@ </object> <object class="NSMenuItem" id="372396952"> <reference key="NSMenu" ref="231354576"/> - <string key="NSTitle">Remove from list</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_REMOVE_ITEM</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -372,7 +382,7 @@ </object> <object class="NSMenuItem" id="93640760"> <reference key="NSMenu" ref="231354576"/> - <string key="NSTitle">Cancel</string> + <string key="NSTitle">^IDS_DOWNLOAD_MENU_CANCEL</string> <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> @@ -382,6 +392,12 @@ </object> </object> </object> + <object class="NSCustomObject" id="410401106"> + <string key="NSClassName">GTMUILocalizerAndLayoutTweaker</string> + </object> + <object class="NSCustomObject" id="857584043"> + <string key="NSClassName">ChromeUILocalizer</string> + </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> @@ -546,6 +562,46 @@ </object> <int key="connectionID">79</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">otherObjectToLocalize_</string> + <reference key="source" ref="857584043"/> + <reference key="destination" ref="571207526"/> + </object> + <int key="connectionID">84</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">yetAnotherObjectToLocalize_</string> + <reference key="source" ref="857584043"/> + <reference key="destination" ref="231354576"/> + </object> + <int key="connectionID">85</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">uiObject_</string> + <reference key="source" ref="410401106"/> + <reference key="destination" ref="1005"/> + </object> + <int key="connectionID">86</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">localizer_</string> + <reference key="source" ref="410401106"/> + <reference key="destination" ref="857584043"/> + </object> + <int key="connectionID">87</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">buttonTweaker_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="411206214"/> + </object> + <int key="connectionID">93</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -707,8 +763,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="263710528"/> <reference ref="146169749"/> - <reference ref="185082033"/> - <reference ref="979385092"/> + <reference ref="411206214"/> </object> <reference key="parent" ref="1005"/> </object> @@ -731,13 +786,38 @@ <reference key="parent" ref="55478397"/> </object> <object class="IBObjectRecord"> + <int key="objectID">72</int> + <reference key="object" ref="622024590"/> + <reference key="parent" ref="146169749"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">74</int> + <reference key="object" ref="925428167"/> + <reference key="parent" ref="263710528"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">80</int> + <reference key="object" ref="411206214"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="185082033"/> + <reference ref="979385092"/> + </object> + <reference key="parent" ref="55478397"/> + </object> + <object class="IBObjectRecord"> <int key="objectID">67</int> <reference key="object" ref="185082033"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="136006556"/> </object> - <reference key="parent" ref="55478397"/> + <reference key="parent" ref="411206214"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">68</int> + <reference key="object" ref="136006556"/> + <reference key="parent" ref="185082033"/> </object> <object class="IBObjectRecord"> <int key="objectID">69</int> @@ -746,7 +826,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="93953286"/> </object> - <reference key="parent" ref="55478397"/> + <reference key="parent" ref="411206214"/> </object> <object class="IBObjectRecord"> <int key="objectID">70</int> @@ -754,19 +834,14 @@ <reference key="parent" ref="979385092"/> </object> <object class="IBObjectRecord"> - <int key="objectID">68</int> - <reference key="object" ref="136006556"/> - <reference key="parent" ref="185082033"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">72</int> - <reference key="object" ref="622024590"/> - <reference key="parent" ref="146169749"/> + <int key="objectID">82</int> + <reference key="object" ref="410401106"/> + <reference key="parent" ref="1002"/> </object> <object class="IBObjectRecord"> - <int key="objectID">74</int> - <reference key="object" ref="925428167"/> - <reference key="parent" ref="263710528"/> + <int key="objectID">83</int> + <reference key="object" ref="857584043"/> + <reference key="parent" ref="1002"/> </object> </object> </object> @@ -804,6 +879,7 @@ <string>60.IBPluginDependency</string> <string>66.IBEditorWindowLastContentRect</string> <string>66.IBPluginDependency</string> + <string>66.IBUserGuides</string> <string>67.IBPluginDependency</string> <string>68.IBPluginDependency</string> <string>69.IBPluginDependency</string> @@ -812,6 +888,8 @@ <string>72.IBPluginDependency</string> <string>73.IBPluginDependency</string> <string>74.IBPluginDependency</string> + <string>82.IBPluginDependency</string> + <string>83.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -822,7 +900,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{628, 654}</string> <string>{{357, 416}, {480, 272}}</string> - <string>{{47, 630}, {188, 123}}</string> + <string>{{47, 630}, {382, 123}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -831,7 +909,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{42, 470}, {227, 123}}</string> + <string>{{42, 470}, {406, 123}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -845,6 +923,11 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{275, 354}, {440, 34}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSMutableArray"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <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> @@ -875,12 +958,20 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">79</int> + <int key="maxID">93</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> + <string key="className">ChromeUILocalizer</string> + <string key="superclassName">GTMUILocalizer</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/ui_localizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">DownloadItemCell</string> <string key="superclassName">GradientButtonCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -923,6 +1014,7 @@ <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>activeDownloadMenu_</string> + <string>buttonTweaker_</string> <string>cell_</string> <string>completeDownloadMenu_</string> <string>dangerousDownloadLabel_</string> @@ -932,6 +1024,7 @@ <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSMenu</string> + <string>GTMWidthBasedTweaker</string> <string>DownloadItemCell</string> <string>NSMenu</string> <string>NSTextField</string> @@ -945,6 +1038,72 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">GTMUILocalizer</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>otherObjectToLocalize_</string> + <string>owner_</string> + <string>yetAnotherObjectToLocalize_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">../third_party/GTM/AppKit/GTMUILocalizer.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">GTMUILocalizerAndLayoutTweaker</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>localizerOwner_</string> + <string>localizer_</string> + <string>uiObject_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>GTMUILocalizer</string> + <string>id</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier" id="609436413"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">GTMWidthBasedTweaker</string> + <string key="superclassName">NSView</string> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>viewToResize_</string> + <string>viewToSlideAndResize_</string> + <string>viewToSlide_</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>NSView</string> + <string>NSView</string> + </object> + </object> + <reference key="sourceIdentifier" ref="609436413"/> + </object> + <object class="IBPartialClassDescription"> <string key="className">GradientButtonCell</string> <string key="superclassName">NSButtonCell</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> diff --git a/chrome/app/nibs/DownloadShelf.xib b/chrome/app/nibs/DownloadShelf.xib index 9d05154..4064870 100644 --- a/chrome/app/nibs/DownloadShelf.xib +++ b/chrome/app/nibs/DownloadShelf.xib @@ -90,7 +90,7 @@ <object class="NSLayoutManager" key="NSLayoutManager"> <object class="NSTextStorage" key="NSTextStorage"> <object class="NSMutableString" key="NSString"> - <characters key="NS.bytes">DO NOT TRANSLATE download link</characters> + <characters key="NS.bytes">download link</characters> </object> <object class="NSDictionary" key="NSAttributes"> <bool key="EncodedWithXMLCoder">YES</bool> diff --git a/chrome/browser/cocoa/download_item_controller.h b/chrome/browser/cocoa/download_item_controller.h index c34c557..0be578b 100644 --- a/chrome/browser/cocoa/download_item_controller.h +++ b/chrome/browser/cocoa/download_item_controller.h @@ -13,6 +13,7 @@ class DownloadItem; class DownloadItemMac; class DownloadShelfContextMenuMac; @class DownloadShelfController; +@class GTMWidthBasedTweaker; // A controller class that manages one download item. @@ -30,12 +31,16 @@ class DownloadShelfContextMenuMac; IBOutlet NSView* dangerousDownloadView_; IBOutlet NSTextField* dangerousDownloadLabel_; + // So we can find out how much the tweaker changed sizes to update the + // other views. + IBOutlet GTMWidthBasedTweaker* buttonTweaker_; + scoped_ptr<DownloadItemMac> bridge_; scoped_ptr<DownloadShelfContextMenuMac> menuBridge_; // Weak pointer to the shelf that owns us. DownloadShelfController* shelf_; - + // The time at which this view was created. base::Time creationTime_; diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm index a02426ca..17cfaec 100644 --- a/chrome/browser/cocoa/download_item_controller.mm +++ b/chrome/browser/cocoa/download_item_controller.mm @@ -15,9 +15,35 @@ #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/download_util.h" #include "grit/generated_resources.h" +#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" static const int kTextWidth = 140; // Pixels +namespace { + +// Helper to widen a view. +void WidenView(NSView* view, CGFloat widthChange) { + // If it is an NSBox, the autoresize of the contentView is the issue. + NSView* contentView = view; + if ([view isKindOfClass:[NSBox class]]) { + contentView = [(NSBox*)view contentView]; + } + BOOL autoresizesSubviews = [contentView autoresizesSubviews]; + if (autoresizesSubviews) { + [contentView setAutoresizesSubviews:NO]; + } + + NSRect frame = [view frame]; + frame.size.width += widthChange; + [view setFrame:frame]; + + if (autoresizesSubviews) { + [contentView setAutoresizesSubviews:YES]; + } +} + +} // namespace + // A class for the chromium-side part of the download shelf context menu. class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { @@ -66,6 +92,18 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { } - (void)awakeFromNib { + // Since the shelf keeps laying out views as more items are added, relying on + // the WidthBaseTweaker to resize the dangerous download part does not work. + DCHECK(buttonTweaker_ != nil); + CGFloat widthChange = [buttonTweaker_ changedWidth]; + // Grow the parent views + WidenView([self view], widthChange); + WidenView(dangerousDownloadView_, widthChange); + // Slide the two buttons over. + NSPoint frameOrigin = [buttonTweaker_ frame].origin; + frameOrigin.x += widthChange; + [buttonTweaker_ setFrameOrigin:frameOrigin]; + [self setStateFromDownload:bridge_->download_model()]; bridge_->LoadIcon(); } diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index a6b5034..c95383b 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2377,6 +2377,7 @@ 'app/nibs/BookmarkEditor.xib', 'app/nibs/BookmarkNameFolder.xib', 'app/nibs/ClearBrowsingData.xib', + 'app/nibs/DownloadItem.xib', 'app/nibs/EditSearchEngine.xib', 'app/nibs/FirstRunDialog.xib', 'app/nibs/HttpAuthLoginSheet.xib', |