summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 15:07:52 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 15:07:52 +0000
commit0711b7a78082250b9fb18835e8bf12e9d3f5d749 (patch)
tree5399362082bfff1bc65713f66751995b3e686968 /chrome/browser/cocoa
parent63df3733f2f453c732d9da60bf26996859779f37 (diff)
downloadchromium_src-0711b7a78082250b9fb18835e8bf12e9d3f5d749.zip
chromium_src-0711b7a78082250b9fb18835e8bf12e9d3f5d749.tar.gz
chromium_src-0711b7a78082250b9fb18835e8bf12e9d3f5d749.tar.bz2
Hung Renderer dialog:
Resize to fit the graphic. Fetch the hung from ResourceBundle since it looks like it should be under theme control. Swap the kill and wait buttons. Add in localization objects. Resize message and window to find localized content. Bookmark Bubble: Right align labels to fields. Make window resize to fit labels. Switch to small controls per Cole. Stop bringing the frozen tab graphic into the bundle so we avoid the extra copy. BUG=20525 BUG=20533 TEST=Hung renderer localized and fits content. Bookmark bubble fits labels in all languages. Review URL: http://codereview.chromium.org/193020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/hung_renderer_controller.h2
-rw-r--r--chrome/browser/cocoa/hung_renderer_controller.mm38
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 {