OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_standard.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); |
20 DCHECK(favicon); | 20 DCHECK(favicon); |
21 [self setImage:favicon]; | 21 [self setImage:favicon]; |
22 } | 22 } |
23 | 23 |
24 // GTM's layout tweaker calls sizeToFit to receive the desired width of views. | 24 // 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 | 25 // By default, buttons will be only 14px high, but the Show All button needs to |
26 // be higher. | 26 // be higher. |
27 - (void)sizeToFit { | 27 - (void)sizeToFit { |
28 NSRect oldRect = [self frame]; | 28 NSRect oldRect = [self frame]; |
29 [super sizeToFit]; | 29 [super sizeToFit]; |
30 NSRect newRect = [self frame]; | 30 NSRect newRect = [self frame]; |
31 | 31 |
32 // Keep old height. | 32 // Keep old height. |
33 newRect.origin.y = oldRect.origin.y; | 33 newRect.origin.y = oldRect.origin.y; |
34 newRect.size.height = oldRect.size.height; | 34 newRect.size.height = oldRect.size.height; |
35 | 35 |
36 [self setFrame:newRect]; | 36 [self setFrame:newRect]; |
37 } | 37 } |
38 | 38 |
39 @end | 39 @end |
OLD | NEW |