blob: 726fe6521111bed95b51c6bdcd84d7633eaaf4e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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:NSInformationalAlertStyle];
[alert setMessageText:title];
[alert setInformativeText:text];
[alert addButtonWithTitle:okBtn];
[alert beginSheetModalForWindow:parent
modalDelegate:helper
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}
} // namespace restart_browser
|