From 7a3bdc0069b8ae1ed6eb115999878cee5cfa9360 Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Fri, 28 Aug 2009 16:40:39 +0000 Subject: Add background_tile_view for tiling an image as UI background (about box needed it) Added restart_browser as a helper like Views helper for putting up a request for the user to restart. Added a new string needed for Mac style alerts to go with the existing restart string. Make Mac Chromium use a custom about box. Give Chromium and Google Chrome an about box that matches the one on other platforms Use all the existing UI strings for the about box so we get credits, copy rights, etc. TEST=New aboutbox for Chromium and Google Chrome. About box should be fully l10n and size as needed. Chrome update messaging should more match windows and be localized. BUG=13219,19020 Review URL: http://codereview.chromium.org/173606 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24737 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/restart_browser.mm | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 chrome/browser/cocoa/restart_browser.mm (limited to 'chrome/browser/cocoa/restart_browser.mm') diff --git a/chrome/browser/cocoa/restart_browser.mm b/chrome/browser/cocoa/restart_browser.mm new file mode 100644 index 0000000..9a17f04 --- /dev/null +++ b/chrome/browser/cocoa/restart_browser.mm @@ -0,0 +1,67 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/l10n_util_mac.h" +#import "chrome/browser/cocoa/restart_browser.h" +#include "grit/chromium_strings.h" +#include "grit/generated_resources.h" +#include "grit/app_strings.h" + +// Helper to clean up after the notification that the alert was dismissed. +@interface RestartHelper : NSObject { + @private + NSAlert* alert_; +} +- (NSAlert*)alert; +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo; +@end + +@implementation RestartHelper + +- (NSAlert*)alert { + alert_ = [[NSAlert alloc] init]; + return alert_; +} + +- (void)dealloc { + [alert_ release]; + [super dealloc]; +} + +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo { + // Nothing to do, just clean up + [self autorelease]; +} + +@end + +namespace restart_browser { + +void RequestRestart(NSWindow* parent) { + NSString* title = + l10n_util::GetNSStringFWithFixup(IDS_PLEASE_RESTART_BROWSER, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + NSString* text = + l10n_util::GetNSStringWithFixup(IDS_OPTIONS_RESTART_REQUIRED); + NSString* okBtn = l10n_util::GetNSStringWithFixup(IDS_APP_OK); + + RestartHelper* helper = [[RestartHelper alloc] init]; + + NSAlert* alert = [helper alert]; + [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setMessageText:title]; + [alert setInformativeText:text]; + [alert addButtonWithTitle:okBtn]; + + [alert beginSheetModalForWindow:parent + modalDelegate:helper + didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) + contextInfo:nil]; +} + +} // namespace restart_browser -- cgit v1.1