Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: chrome/browser/ui/cocoa/login_prompt_cocoa.mm

Issue 12276010: Factor out uses of the WebContentsModalDialog interface from platform-independent code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove CloseWebContentsModalDialog call from ConstrainedWebDialogDelegateBase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/login_prompt_cocoa.h" 5 #import "chrome/browser/ui/cocoa/login_prompt_cocoa.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/memory/scoped_nsobject.h" 9 #include "base/memory/scoped_nsobject.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // will occur via an InvokeLater on the UI thread, which is guaranteed 70 // will occur via an InvokeLater on the UI thread, which is guaranteed
71 // to happen after this is called (since this was InvokeLater'd first). 71 // to happen after this is called (since this was InvokeLater'd first).
72 WebContents* requesting_contents = GetWebContentsForLogin(); 72 WebContents* requesting_contents = GetWebContentsForLogin();
73 DCHECK(requesting_contents); 73 DCHECK(requesting_contents);
74 74
75 scoped_nsobject<CustomConstrainedWindowSheet> sheet( 75 scoped_nsobject<CustomConstrainedWindowSheet> sheet(
76 [[CustomConstrainedWindowSheet alloc] 76 [[CustomConstrainedWindowSheet alloc]
77 initWithCustomWindow:[sheet_controller_ window]]); 77 initWithCustomWindow:[sheet_controller_ window]]);
78 constrained_window_.reset(new ConstrainedWindowMac( 78 constrained_window_.reset(new ConstrainedWindowMac(
79 this, requesting_contents, sheet)); 79 this, requesting_contents, sheet));
80 SetDialog(constrained_window_.get());
81 80
82 NotifyAuthNeeded(); 81 NotifyAuthNeeded();
83 } 82 }
84 83
84 virtual void CloseDialog() OVERRIDE {
85 // The hosting WebContentsModalDialog may have been freed.
86 if (constrained_window_.get())
sail 2013/02/16 21:45:22 don't need .get()
Mike Wittman 2013/02/19 19:08:36 Done.
87 constrained_window_->CloseWebContentsModalDialog();
88 }
89
85 // Overridden from ConstrainedWindowMacDelegate: 90 // Overridden from ConstrainedWindowMacDelegate:
86 virtual void OnConstrainedWindowClosed( 91 virtual void OnConstrainedWindowClosed(
87 ConstrainedWindowMac* window) OVERRIDE { 92 ConstrainedWindowMac* window) OVERRIDE {
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
89 SetDialog(NULL);
90 SetModel(NULL); 94 SetModel(NULL);
91 ReleaseSoon(); 95 ReleaseSoon();
92 96
93 constrained_window_.reset(); 97 constrained_window_.reset();
94 sheet_controller_.reset(); 98 sheet_controller_.reset();
95 } 99 }
96 100
97 void OnLoginPressed(const string16& username, 101 void OnLoginPressed(const string16& username,
98 const string16& password) { 102 const string16& password) {
99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Resize the text field. 184 // Resize the text field.
181 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker 185 CGFloat windowDelta = [GTMUILocalizerAndLayoutTweaker
182 sizeToFitFixedWidthTextField:explanationField_]; 186 sizeToFitFixedWidthTextField:explanationField_];
183 187
184 NSRect newFrame = [[self window] frame]; 188 NSRect newFrame = [[self window] frame];
185 newFrame.size.height += windowDelta; 189 newFrame.size.height += windowDelta;
186 [[self window] setFrame:newFrame display:NO]; 190 [[self window] setFrame:newFrame display:NO];
187 } 191 }
188 192
189 @end 193 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm ('k') | chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698