Skip to content

Commit aec6069

Browse files
committed
[OSX] support for login dialog queue
1 parent a3baf7d commit aec6069

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/browser/shell_login_dialog.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ class ShellLoginDialog : public ResourceDispatcherHostLoginDelegate,
8888
// Returns whether authentication had been handled (SetAuth or CancelAuth).
8989
bool WasAuthHandled() const;
9090

91+
// Performs necessary cleanup before deletion.
92+
void ReleaseSoon();
93+
9194
protected:
9295
// Threading: any
9396
virtual ~ShellLoginDialog();
9497

95-
// Performs necessary cleanup before deletion.
96-
void ReleaseSoon();
97-
9898
private:
9999

100100
// popup next dialog in queue on closing of this dialog
@@ -172,6 +172,7 @@ class ShellLoginDialog : public ResourceDispatcherHostLoginDelegate,
172172
#if defined(OS_MACOSX)
173173
// Threading: UI thread.
174174
ShellLoginDialogHelper* helper_; // owned
175+
base::string16 message_;
175176
#elif defined(OS_WIN)
176177
HWND dialog_win_;
177178
string16 message_text_;

src/browser/shell_login_dialog_mac.mm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,14 @@ - (void)focus {
8080
- (void)alertDidEnd:(NSAlert*)alert
8181
returnCode:(int)returnCode
8282
contextInfo:(void*)contextInfo {
83-
if (returnCode == NSRunStoppedResponse)
84-
return;
8583

8684
content::ShellLoginDialog* this_dialog =
8785
reinterpret_cast<content::ShellLoginDialog*>(contextInfo);
86+
if (returnCode == NSRunStoppedResponse) {
87+
this_dialog->ReleaseSoon();
88+
return;
89+
}
90+
8891
if (returnCode == NSAlertFirstButtonReturn) {
8992
this_dialog->UserAcceptedAuth(
9093
base::SysNSStringToUTF16([usernameField_ stringValue]),
@@ -106,11 +109,14 @@ - (void)cancel {
106109
void ShellLoginDialog::PlatformCreateDialog(const string16& message) {
107110
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
108111
helper_ = [[ShellLoginDialogHelper alloc] init];
112+
message_ = message;
113+
}
109114

115+
void ShellLoginDialog::PlatformShowDialog() {
110116
// Show the modal dialog.
111117
NSAlert* alert = [helper_ alert];
112118
[alert setDelegate:helper_];
113-
[alert setInformativeText:base::SysUTF16ToNSString(message)];
119+
[alert setInformativeText:base::SysUTF16ToNSString(message_)];
114120
[alert setMessageText:@"Please log in."];
115121
[alert addButtonWithTitle:@"OK"];
116122
NSButton* other = [alert addButtonWithTitle:@"Cancel"];

0 commit comments

Comments
 (0)