OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/l10n_util_mac.h" | 8 #include "app/l10n_util_mac.h" |
9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Make the message fit. | 52 // Make the message fit. |
53 CGFloat messageShift = | 53 CGFloat messageShift = |
54 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:messageView_]; | 54 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:messageView_]; |
55 | 55 |
56 // Move the graphic up to be top even with the message. | 56 // Move the graphic up to be top even with the message. |
57 NSRect graphicFrame = [imageView_ frame]; | 57 NSRect graphicFrame = [imageView_ frame]; |
58 graphicFrame.origin.y += messageShift; | 58 graphicFrame.origin.y += messageShift; |
59 [imageView_ setFrame:graphicFrame]; | 59 [imageView_ setFrame:graphicFrame]; |
60 | 60 |
61 // Make the window taller to fit everything. | 61 // Make the window taller to fit everything. |
62 NSWindow* window = [self window]; | 62 NSSize windowDelta = NSMakeSize(0, messageShift); |
63 [[window contentView] setAutoresizesSubviews:NO]; | 63 [GTMUILocalizerAndLayoutTweaker |
64 NSRect windowFrame = [window frame]; | 64 resizeWindowWithoutAutoResizingSubViews:[self window] |
65 windowFrame.size.height += messageShift; | 65 delta:windowDelta]; |
66 [window setFrame:windowFrame display:NO]; | |
67 [[window contentView] setAutoresizesSubviews:YES]; | |
68 } | 66 } |
69 | 67 |
70 - (IBAction)kill:(id)sender { | 68 - (IBAction)kill:(id)sender { |
71 if (hungContents_) | 69 if (hungContents_) |
72 base::KillProcess(hungContents_->process()->process().handle(), | 70 base::KillProcess(hungContents_->process()->process().handle(), |
73 ResultCodes::HUNG, false); | 71 ResultCodes::HUNG, false); |
74 // Cannot call performClose:, because the close button is disabled. | 72 // Cannot call performClose:, because the close button is disabled. |
75 [self close]; | 73 [self close]; |
76 } | 74 } |
77 | 75 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 initWithWindowNibName:@"HungRendererDialog"]; | 148 initWithWindowNibName:@"HungRendererDialog"]; |
151 [g_instance showForTabContents:contents]; | 149 [g_instance showForTabContents:contents]; |
152 } | 150 } |
153 } | 151 } |
154 | 152 |
155 // static | 153 // static |
156 void HungRendererDialog::HideForTabContents(TabContents* contents) { | 154 void HungRendererDialog::HideForTabContents(TabContents* contents) { |
157 if (!logging::DialogsAreSuppressed() && g_instance) | 155 if (!logging::DialogsAreSuppressed() && g_instance) |
158 [g_instance endForTabContents:contents]; | 156 [g_instance endForTabContents:contents]; |
159 } | 157 } |
OLD | NEW |