Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2041)

Unified Diff: chrome/browser/cocoa/download_shelf_controller.mm

Issue 132073: Add "Show all downloads" link to download shelf.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Address comments Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/download_shelf_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/download_shelf_controller.mm
===================================================================
--- chrome/browser/cocoa/download_shelf_controller.mm (revision 18784)
+++ chrome/browser/cocoa/download_shelf_controller.mm (working copy)
@@ -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
« no previous file with comments | « chrome/browser/cocoa/download_shelf_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698