Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

Unified Diff: chrome/browser/cocoa/hung_renderer_controller.mm

Issue 193020: Hung Renderer dialog:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/hung_renderer_controller.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/hung_renderer_controller.mm
===================================================================
--- chrome/browser/cocoa/hung_renderer_controller.mm (revision 25442)
+++ chrome/browser/cocoa/hung_renderer_controller.mm (working copy)
@@ -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 @@
}
- (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 @@
// 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 {
« no previous file with comments | « chrome/browser/cocoa/hung_renderer_controller.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698