- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / download / download_show_all_button.mm
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
3 // found in the LICENSE file.
4
5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h"
6
7 #include "base/logging.h"
8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h"
9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h"
11 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/gfx/image/image.h"
13
14 @implementation DownloadShowAllButton
15
16 - (void)awakeFromNib {
17   DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]);
18   ResourceBundle& rb = ResourceBundle::GetSharedInstance();
19   NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON).ToNSImage();
20   [self setImage:favicon];
21 }
22
23 // GTM's layout tweaker calls sizeToFit to receive the desired width of views.
24 // By default, buttons will be only 14px high, but the Show All button needs to
25 // be higher.
26 - (void)sizeToFit {
27   NSRect oldRect = [self frame];
28   [super sizeToFit];
29   NSRect newRect = [self frame];
30
31   // Keep old height.
32   newRect.origin.y = oldRect.origin.y;
33   newRect.size.height = oldRect.size.height;
34
35   [self setFrame:newRect];
36 }
37
38 @end