Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / download / download_show_all_button.mm
blob81b635405d5a9e0b48a198cc29f67b7b373a679a
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.
5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h"
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"
14 @implementation DownloadShowAllButton
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];
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];
31   // Keep old height.
32   newRect.origin.y = oldRect.origin.y;
33   newRect.size.height = oldRect.size.height;
35   [self setFrame:newRect];
38 @end