| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "app/l10n_util_mac.h" |
| 6 #import "chrome/browser/cocoa/restart_browser.h" |
| 7 #include "grit/chromium_strings.h" |
| 8 #include "grit/generated_resources.h" |
| 9 #include "grit/app_strings.h" |
| 10 |
| 11 // Helper to clean up after the notification that the alert was dismissed. |
| 12 @interface RestartHelper : NSObject { |
| 13 @private |
| 14 NSAlert* alert_; |
| 15 } |
| 16 - (NSAlert*)alert; |
| 17 - (void)alertDidEnd:(NSAlert*)alert |
| 18 returnCode:(int)returnCode |
| 19 contextInfo:(void*)contextInfo; |
| 20 @end |
| 21 |
| 22 @implementation RestartHelper |
| 23 |
| 24 - (NSAlert*)alert { |
| 25 alert_ = [[NSAlert alloc] init]; |
| 26 return alert_; |
| 27 } |
| 28 |
| 29 - (void)dealloc { |
| 30 [alert_ release]; |
| 31 [super dealloc]; |
| 32 } |
| 33 |
| 34 - (void)alertDidEnd:(NSAlert*)alert |
| 35 returnCode:(int)returnCode |
| 36 contextInfo:(void*)contextInfo { |
| 37 // Nothing to do, just clean up |
| 38 [self autorelease]; |
| 39 } |
| 40 |
| 41 @end |
| 42 |
| 43 namespace restart_browser { |
| 44 |
| 45 void RequestRestart(NSWindow* parent) { |
| 46 NSString* title = |
| 47 l10n_util::GetNSStringFWithFixup(IDS_PLEASE_RESTART_BROWSER, |
| 48 l10n_util::GetStringUTF16(IDS_PRODUCT_NAM
E)); |
| 49 NSString* text = |
| 50 l10n_util::GetNSStringWithFixup(IDS_OPTIONS_RESTART_REQUIRED); |
| 51 NSString* okBtn = l10n_util::GetNSStringWithFixup(IDS_APP_OK); |
| 52 |
| 53 RestartHelper* helper = [[RestartHelper alloc] init]; |
| 54 |
| 55 NSAlert* alert = [helper alert]; |
| 56 [alert setAlertStyle:NSCriticalAlertStyle]; |
| 57 [alert setMessageText:title]; |
| 58 [alert setInformativeText:text]; |
| 59 [alert addButtonWithTitle:okBtn]; |
| 60 |
| 61 [alert beginSheetModalForWindow:parent |
| 62 modalDelegate:helper |
| 63 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) |
| 64 contextInfo:nil]; |
| 65 } |
| 66 |
| 67 } // namespace restart_browser |
| OLD | NEW |