diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 18:15:59 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 18:15:59 +0000 |
commit | 0fbde57962200fc5fb7b7c3b7bb283dca0b8133f (patch) | |
tree | 3d01b9a373f7a21ded7beea42c6c4c1814460fd2 /chrome | |
parent | 2a6b362c7563d36cf99e3954baa14bb7f6578f6c (diff) | |
download | chromium_src-0fbde57962200fc5fb7b7c3b7bb283dca0b8133f.zip chromium_src-0fbde57962200fc5fb7b7c3b7bb283dca0b8133f.tar.gz chromium_src-0fbde57962200fc5fb7b7c3b7bb283dca0b8133f.tar.bz2 |
Add "Show all downloads" link to download shelf.
BUG=14665
TEST=Download something, check that "show all downloads" text is on
shelf, click it, check that the downloads tab opens.
Review URL: http://codereview.chromium.org/132073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/en.lproj/DownloadShelf.xib | 313 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_shelf_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/download_shelf_controller.mm | 32 |
3 files changed, 341 insertions, 6 deletions
diff --git a/chrome/app/nibs/en.lproj/DownloadShelf.xib b/chrome/app/nibs/en.lproj/DownloadShelf.xib index 857009c2..24331a1 100644 --- a/chrome/app/nibs/en.lproj/DownloadShelf.xib +++ b/chrome/app/nibs/en.lproj/DownloadShelf.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="10"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -25,15 +25,15 @@ </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSCustomObject" id="1001"> - <string key="NSClassName">DownloadShelfController</string> - </object> <object class="NSCustomObject" id="1003"> <string key="NSClassName">FirstResponder</string> </object> <object class="NSCustomObject" id="1004"> <string key="NSClassName">NSApplication</string> </object> + <object class="NSCustomObject" id="1001"> + <string key="NSClassName">DownloadShelfController</string> + </object> <object class="NSCustomView" id="1005"> <reference key="NSNextResponder"/> <int key="NSvFlags">290</int> @@ -71,6 +71,260 @@ <int key="NSPeriodicInterval">25</int> </object> </object> + <object class="NSScrollView" id="433009119"> + <reference key="NSNextResponder" ref="1005"/> + <int key="NSvFlags">289</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSClipView" id="581923208"> + <reference key="NSNextResponder" ref="433009119"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextView" id="550190606"> + <reference key="NSNextResponder" ref="581923208"/> + <int key="NSvFlags">2322</int> + <string key="NSFrameSize">{182, 45}</string> + <reference key="NSSuperview" ref="581923208"/> + <object class="NSTextContainer" key="NSTextContainer" id="526453298"> + <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> + </object> + <object class="NSDictionary" key="NSAttributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSFont</string> + <string>NSParagraphStyle</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSFont"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.000000e+01</double> + <int key="NSfFlags">2843</int> + </object> + <object class="NSParagraphStyle"> + <int key="NSAlignment">3</int> + <object class="NSArray" key="NSTabStops"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextTab"> + <double key="NSLocation">0.000000e+00</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">5.600000e+01</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.120000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.680000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">2.240000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">2.800000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">3.360000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">3.920000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">4.480000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">5.040000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">5.600000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">6.160000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">6.720000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">7.280000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">7.840000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">8.400000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">8.960000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">9.520000e+02</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.008000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.064000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.120000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.176000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.232000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.288000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.344000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.400000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.456000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.512000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.568000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.624000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.680000e+03</double> + </object> + <object class="NSTextTab"> + <double key="NSLocation">1.736000e+03</double> + </object> + </object> + </object> + </object> + </object> + <nil key="NSDelegate"/> + </object> + <object class="NSMutableArray" key="NSTextContainers"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="526453298"/> + </object> + <int key="NSLMFlags">6</int> + <nil key="NSDelegate"/> + </object> + <reference key="NSTextView" ref="550190606"/> + <double key="NSWidth">1.820000e+02</double> + <int key="NSTCFlags">1</int> + </object> + <object class="NSTextViewSharedData" key="NSSharedData"> + <int key="NSFlags">2565</int> + <object class="NSColor" key="NSBackgroundColor" id="323581292"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + <object class="NSColor" key="NSInsertionColor" id="265257428"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + <object class="NSDictionary" key="NSSelectedAttributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSBackgroundColor</string> + <string>NSColor</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">selectedTextBackgroundColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + </object> + </object> + <object class="NSColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">selectedTextColor</string> + <reference key="NSColor" ref="265257428"/> + </object> + </object> + </object> + <nil key="NSMarkedAttributes"/> + <object class="NSDictionary" key="NSLinkAttributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSColor</string> + <string>NSUnderline</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MCAwIDEAA</bytes> + </object> + <integer value="1"/> + </object> + </object> + <nil key="NSDefaultParagraphStyle"/> + </object> + <int key="NSTVFlags">6</int> + <string key="NSMaxSize">{463, 1e+07}</string> + <string key="NSMinize">{63, 45}</string> + <nil key="NSDelegate"/> + </object> + </object> + <string key="NSFrameSize">{182, 14}</string> + <reference key="NSSuperview" ref="433009119"/> + <reference key="NSNextKeyView" ref="550190606"/> + <reference key="NSDocView" ref="550190606"/> + <reference key="NSBGColor" ref="323581292"/> + <object class="NSCursor" key="NSCursor"> + <string key="NSHotSpot">{4, -5}</string> + <int key="NSCursorType">1</int> + </object> + <int key="NScvFlags">2</int> + </object> + <object class="NSScroller" id="888760421"> + <reference key="NSNextResponder" ref="433009119"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{-100, -100}, {15, 12}}</string> + <reference key="NSSuperview" ref="433009119"/> + <bool key="NSEnabled">YES</bool> + <reference key="NSTarget" ref="433009119"/> + <string key="NSAction">_doScroller:</string> + <double key="NSPercent">1.369863e-02</double> + </object> + <object class="NSScroller" id="199551096"> + <reference key="NSNextResponder" ref="433009119"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{-100, -100}, {87, 18}}</string> + <reference key="NSSuperview" ref="433009119"/> + <int key="NSsFlags">1</int> + <reference key="NSTarget" ref="433009119"/> + <string key="NSAction">_doScroller:</string> + <double key="NSCurValue">1.000000e+00</double> + <double key="NSPercent">9.456522e-01</double> + </object> + </object> + <string key="NSFrame">{{266, 13}, {182, 14}}</string> + <reference key="NSSuperview" ref="1005"/> + <reference key="NSNextKeyView" ref="581923208"/> + <int key="NSsFlags">64</int> + <reference key="NSVScroller" ref="888760421"/> + <reference key="NSHScroller" ref="199551096"/> + <reference key="NSContentView" ref="581923208"/> + </object> </object> <string key="NSFrameSize">{480, 40}</string> <reference key="NSSuperview"/> @@ -96,6 +350,14 @@ </object> <int key="connectionID">9</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">showAllDownloadsLink_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="550190606"/> + </object> + <int key="connectionID">15</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -132,6 +394,7 @@ <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="538957441"/> + <reference ref="433009119"/> </object> <reference key="parent" ref="1002"/> </object> @@ -149,6 +412,32 @@ <reference key="object" ref="104399124"/> <reference key="parent" ref="538957441"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="433009119"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="888760421"/> + <reference ref="199551096"/> + <reference ref="550190606"/> + </object> + <reference key="parent" ref="1005"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="888760421"/> + <reference key="parent" ref="433009119"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">12</int> + <reference key="object" ref="199551096"/> + <reference key="parent" ref="433009119"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">13</int> + <reference key="object" ref="550190606"/> + <reference key="parent" ref="433009119"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -162,6 +451,10 @@ <string>1.IBPluginDependency</string> <string>1.WindowOrigin</string> <string>1.editorWindowContentRectSynchronizationRect</string> + <string>10.IBPluginDependency</string> + <string>11.IBPluginDependency</string> + <string>12.IBPluginDependency</string> + <string>13.IBPluginDependency</string> <string>3.IBPluginDependency</string> <string>4.IBPluginDependency</string> </object> @@ -170,12 +463,16 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{509, 905}, {480, 40}}</string> + <string>{{79, 87}, {480, 40}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{628, 654}</string> <string>{{357, 416}, {480, 272}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -198,7 +495,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">9</int> + <int key="maxID">15</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -219,6 +516,10 @@ <string>id</string> </object> </object> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">showAllDownloadsLink_</string> + <string key="NS.object.0">NSTextView</string> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> <string key="minorKey">browser/cocoa/download_shelf_controller.h</string> diff --git a/chrome/browser/cocoa/download_shelf_controller.h b/chrome/browser/cocoa/download_shelf_controller.h index 86c5535..58241c6 100644 --- a/chrome/browser/cocoa/download_shelf_controller.h +++ b/chrome/browser/cocoa/download_shelf_controller.h @@ -15,6 +15,8 @@ class DownloadShelf; @interface DownloadShelfController : NSViewController { @private + IBOutlet NSTextView* showAllDownloadsLink_; + // Currently these two are always the same, but they mean slightly // different things. contentAreaHasOffset_ is an implementation // detail of download shelf visibility. diff --git a/chrome/browser/cocoa/download_shelf_controller.mm b/chrome/browser/cocoa/download_shelf_controller.mm index b82f67f..e0b8cd0 100644 --- a/chrome/browser/cocoa/download_shelf_controller.mm +++ b/chrome/browser/cocoa/download_shelf_controller.mm @@ -4,11 +4,14 @@ #import "download_shelf_controller.h" +#include "app/l10n_util.h" #include "base/mac_util.h" +#include "base/sys_string_conversions.h" #import "chrome/browser/cocoa/browser_window_controller.h" #include "chrome/browser/cocoa/browser_window_cocoa.h" #include "chrome/browser/cocoa/download_shelf_mac.h" #import "chrome/browser/cocoa/download_shelf_view.h" +#include "grit/generated_resources.h" @interface DownloadShelfController(Private) @@ -36,6 +39,35 @@ return self; } +- (void)awakeFromNib { + // Initialize "Show all downloads" link. + + scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( + [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); + // TODO(thakis): left-align for RTL languages? + [paragraphStyle.get() setAlignment:NSRightTextAlignment]; + + NSDictionary* linkAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + self, NSLinkAttributeName, + [NSCursor pointingHandCursor], NSCursorAttributeName, + paragraphStyle.get(), NSParagraphStyleAttributeName, + nil]; + NSString* text = + base::SysWideToNSString(l10n_util::GetString(IDS_SHOW_ALL_DOWNLOADS)); + scoped_nsobject<NSAttributedString> linkText([[NSAttributedString alloc] + initWithString:text attributes:linkAttributes]); + + [[showAllDownloadsLink_ textStorage] setAttributedString:linkText.get()]; + [showAllDownloadsLink_ setDelegate:self]; +} + +- (BOOL)textView:(NSTextView *)aTextView + clickedOnLink:(id)link + atIndex:(NSUInteger)charIndex { + bridge_->ShowAllDownloads(); + return YES; +} + // Initializes the download shelf at the bottom edge of |contentArea_|. - (void)positionBar { // Set the bar's height to zero and position it at the bottom of the |