| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h" | 5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h" | 8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
| 13 | 13 |
| 14 @implementation DownloadShowAllButton | 14 @implementation DownloadShowAllButton |
| 15 | 15 |
| 16 - (void)awakeFromNib { | 16 - (void)awakeFromNib { |
| 17 DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]); | 17 DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]); |
| 18 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 18 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 19 NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON); | 19 NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON).ToNSImage(); |
| 20 DCHECK(favicon); | |
| 21 [self setImage:favicon]; | 20 [self setImage:favicon]; |
| 22 } | 21 } |
| 23 | 22 |
| 24 // GTM's layout tweaker calls sizeToFit to receive the desired width of views. | 23 // GTM's layout tweaker calls sizeToFit to receive the desired width of views. |
| 25 // By default, buttons will be only 14px high, but the Show All button needs to | 24 // By default, buttons will be only 14px high, but the Show All button needs to |
| 26 // be higher. | 25 // be higher. |
| 27 - (void)sizeToFit { | 26 - (void)sizeToFit { |
| 28 NSRect oldRect = [self frame]; | 27 NSRect oldRect = [self frame]; |
| 29 [super sizeToFit]; | 28 [super sizeToFit]; |
| 30 NSRect newRect = [self frame]; | 29 NSRect newRect = [self frame]; |
| 31 | 30 |
| 32 // Keep old height. | 31 // Keep old height. |
| 33 newRect.origin.y = oldRect.origin.y; | 32 newRect.origin.y = oldRect.origin.y; |
| 34 newRect.size.height = oldRect.size.height; | 33 newRect.size.height = oldRect.size.height; |
| 35 | 34 |
| 36 [self setFrame:newRect]; | 35 [self setFrame:newRect]; |
| 37 } | 36 } |
| 38 | 37 |
| 39 @end | 38 @end |
| OLD | NEW |