diff options
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/hung_renderer_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/hung_renderer_controller.mm | 38 |
2 files changed, 31 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/hung_renderer_controller.h b/chrome/browser/cocoa/hung_renderer_controller.h index 9139503b..caf61b2 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.h +++ b/chrome/browser/cocoa/hung_renderer_controller.h @@ -26,6 +26,8 @@ IBOutlet NSButton* waitButton_; IBOutlet NSButton* killButton_; IBOutlet NSTableView* tableView_; + IBOutlet NSImageView* imageView_; + IBOutlet NSTextField* messageView_; // The TabContents for which this dialog is open. Should never be // NULL while this dialog is open. diff --git a/chrome/browser/cocoa/hung_renderer_controller.mm b/chrome/browser/cocoa/hung_renderer_controller.mm index 0303f29..e401e8b 100644 --- a/chrome/browser/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/cocoa/hung_renderer_controller.mm @@ -4,11 +4,11 @@ #import <Cocoa/Cocoa.h> -#include "app/l10n_util.h" +#include "app/resource_bundle.h" +#include "app/l10n_util_mac.h" #include "base/mac_util.h" #include "base/process_util.h" #include "base/sys_string_conversions.h" -#include "grit/generated_resources.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/hung_renderer_dialog.h" #import "chrome/browser/cocoa/hung_renderer_controller.h" @@ -16,6 +16,8 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/result_codes.h" #include "grit/chromium_strings.h" +#include "grit/generated_resources.h" +#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" namespace { // We only support showing one of these at a time per app. The @@ -41,10 +43,28 @@ HungRendererController* g_instance = NULL; } - (void)awakeFromNib { - // This is easier than creating a localizer, since we only have one - // string to modify. - std::wstring productString = l10n_util::GetString(IDS_PRODUCT_NAME); - [[self window] setTitle:base::SysWideToNSString(productString)]; + // Load in the image + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + NSImage* backgroundImage = rb.GetNSImageNamed(IDR_FROZEN_TAB_ICON); + DCHECK(backgroundImage); + [imageView_ setImage:backgroundImage]; + + // Make the message fit. + CGFloat messageShift = + [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:messageView_]; + + // Move the graphic up to be top even with the message. + NSRect graphicFrame = [imageView_ frame]; + graphicFrame.origin.y += messageShift; + [imageView_ setFrame:graphicFrame]; + + // Make the window taller to fit everything. + NSWindow* window = [self window]; + [[window contentView] setAutoresizesSubviews:NO]; + NSRect windowFrame = [window frame]; + windowFrame.size.height += messageShift; + [window setFrame:windowFrame display:NO]; + [[window contentView] setAutoresizesSubviews:YES]; } - (IBAction)kill:(id)sender { @@ -72,9 +92,9 @@ HungRendererController* g_instance = NULL; // TODO(rohitrao): Add favicons. TabContents* contents = hungRenderers_[rowIndex]; string16 title = contents->GetTitle(); - if (title.empty()) - title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE); - return base::SysUTF16ToNSString(title); + if (!title.empty()) + return base::SysUTF16ToNSString(title); + return l10n_util::GetNSStringWithFixup(IDS_TAB_UNTITLED_TITLE); } - (void)windowWillClose:(NSNotification*)notification { |