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

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

Issue 245009: L10N pass through download item and download shelf.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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_item_controller.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/download_item_controller.mm
===================================================================
--- chrome/browser/cocoa/download_item_controller.mm (revision 27179)
+++ chrome/browser/cocoa/download_item_controller.mm (working copy)
@@ -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,19 @@
}
- (void)awakeFromNib {
+ // Since the shelf keeps relaying out views as more items are added, relaying
Mark Mentovai 2009/09/25 20:20:41 "relaying" 1: "relaying" means something other tha
+ // 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();
}
« no previous file with comments | « chrome/browser/cocoa/download_item_controller.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698